diff --git a/libc-test/build.rs b/libc-test/build.rs
index f7f8c7c192f04d804b1b16749e9c052667a7edb5..e35dcb4eb197d876d72e60ac9e59a63a6200b794 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -1428,7 +1428,7 @@ fn test_android(target: &str) {
 
     cfg.generate("../src/lib.rs", "main.rs");
 
-    test_linux_incompatible_apis(target);
+    test_linux_like_apis(target);
 }
 
 fn test_freebsd(target: &str) {
@@ -2241,17 +2241,19 @@ fn test_linux(target: &str) {
 
     cfg.generate("../src/lib.rs", "main.rs");
 
-    test_linux_incompatible_apis(target);
+    test_linux_like_apis(target);
 }
 
 // This function tests APIs that are incompatible to test when other APIs
 // are included (e.g. because including both sets of headers clashes)
-fn test_linux_incompatible_apis(target: &str) {
-    assert!(target.contains("linux") || target.contains("android"));
+fn test_linux_like_apis(target: &str) {
     let musl = target.contains("musl");
     let linux = target.contains("linux");
+    let emscripten = target.contains("emscripten");
+    let android = target.contains("android");
+    assert!(linux || android || emscripten);
 
-    {
+    if linux || android || emscripten {
         // test strerror_r from the `string.h` header
         let mut cfg = ctest::TestGenerator::new();
         cfg.skip_type(|_| true).skip_static(|_| true);
@@ -2265,7 +2267,8 @@ fn test_linux_incompatible_apis(target: &str) {
         .skip_struct(|_| true);
         cfg.generate("../src/lib.rs", "linux_strerror_r.rs");
     }
-    {
+
+    if linux || android || emscripten {
         // test fcntl - see:
         // http://man7.org/linux/man-pages/man2/fcntl.2.html
         let mut cfg = ctest::TestGenerator::new();
@@ -2295,7 +2298,8 @@ fn test_linux_incompatible_apis(target: &str) {
 
         cfg.generate("../src/lib.rs", "linux_fcntl.rs");
     }
-    {
+
+    if linux || android {
         // test termios
         let mut cfg = ctest::TestGenerator::new();
         cfg.header("asm/termbits.h");
@@ -2312,12 +2316,7 @@ fn test_linux_incompatible_apis(target: &str) {
         cfg.generate("../src/lib.rs", "linux_termios.rs");
     }
 
-    if !linux {
-        return;
-    }
-    // linux-only tests (no android):
-
-    {
+    if linux || android {
         // test IPV6_ constants:
         let mut cfg = ctest::TestGenerator::new();
         headers! {
@@ -2344,7 +2343,8 @@ fn test_linux_incompatible_apis(target: &str) {
             });
         cfg.generate("../src/lib.rs", "linux_ipv6.rs");
     }
-    {
+
+    if linux || android {
         // Test Elf64_Phdr and Elf32_Phdr
         // These types have a field called `p_type`, but including
         // "resolve.h" defines a `p_type` macro that expands to `__p_type`
diff --git a/libc-test/test/linux_elf.rs b/libc-test/test/linux_elf.rs
index 8744200e82aa592031e97aefe66caeb3fcfacfaa..d149c9aaff38e043bc437120cf5263f4983e19ec 100644
--- a/libc-test/test/linux_elf.rs
+++ b/libc-test/test/linux_elf.rs
@@ -7,4 +7,6 @@ use libc::*;
 include!(concat!(env!("OUT_DIR"), "/linux_elf.rs"));
 
 #[cfg(not(target_os = "linux"))]
-fn main() { println!("PASSED 0 tests"); }
+fn main() {
+    println!("PASSED 0 tests");
+}
diff --git a/libc-test/test/linux_fcntl.rs b/libc-test/test/linux_fcntl.rs
index 915a87dc7595b2fec5718427fef341345301e38f..49c06cc4f6517a114e11e12756d0bfa0fbab2990 100644
--- a/libc-test/test/linux_fcntl.rs
+++ b/libc-test/test/linux_fcntl.rs
@@ -7,4 +7,6 @@ use libc::*;
 include!(concat!(env!("OUT_DIR"), "/linux_fcntl.rs"));
 
 #[cfg(not(any(target_os = "linux", target_os = "android")))]
-fn main() { println!("PASSED 0 tests"); }
+fn main() {
+    println!("PASSED 0 tests");
+}
diff --git a/libc-test/test/linux_ipv6.rs b/libc-test/test/linux_ipv6.rs
index c4d0965a0f99090818a1b895447b8db215effa76..83c389ce16a0345fbc2204871c390115bcb312c9 100644
--- a/libc-test/test/linux_ipv6.rs
+++ b/libc-test/test/linux_ipv6.rs
@@ -7,4 +7,6 @@ use libc::*;
 include!(concat!(env!("OUT_DIR"), "/linux_ipv6.rs"));
 
 #[cfg(not(target_os = "linux"))]
-fn main() { println!("PASSED 0 tests"); }
+fn main() {
+    println!("PASSED 0 tests");
+}
diff --git a/libc-test/test/linux_strerror_r.rs b/libc-test/test/linux_strerror_r.rs
index 5139175f9ead6aa6b7e75ac407341402ccf9fcf1..17db959d8cb933edc21f6165bc1c5be225ac1174 100644
--- a/libc-test/test/linux_strerror_r.rs
+++ b/libc-test/test/linux_strerror_r.rs
@@ -7,4 +7,6 @@ use libc::*;
 include!(concat!(env!("OUT_DIR"), "/linux_strerror_r.rs"));
 
 #[cfg(not(any(target_os = "linux", target_os = "android")))]
-fn main() { println!("PASSED 0 tests"); }
+fn main() {
+    println!("PASSED 0 tests");
+}
diff --git a/libc-test/test/linux_termios.rs b/libc-test/test/linux_termios.rs
index 9ee47631e530b4d2631195e7e243d2d6b9b41edd..703a9b9b25b0d721ab76c201256dacc8802c1911 100644
--- a/libc-test/test/linux_termios.rs
+++ b/libc-test/test/linux_termios.rs
@@ -7,4 +7,6 @@ use libc::*;
 include!(concat!(env!("OUT_DIR"), "/linux_termios.rs"));
 
 #[cfg(not(any(target_os = "linux", target_os = "android")))]
-fn main() { println!("PASSED 0 tests"); }
+fn main() {
+    println!("PASSED 0 tests");
+}