summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgnzlbg <gonzalobg88@gmail.com>2019-05-28 16:07:46 +0200
committergnzlbg <gonzalobg88@gmail.com>2019-05-28 16:21:18 +0200
commit8e26ab496429b0bb8f98041d63fffd20c03afc5d (patch)
tree4e4be97a8ef36eb05b3682b750ed39173bae6943
parentcf0bd36e78358651942dc0fe9ec97afcc7857b08 (diff)
downloadrust-libc-8e26ab496429b0bb8f98041d63fffd20c03afc5d.tar.gz
Minor nitpicks
-rw-r--r--libc-test/build.rs28
-rw-r--r--libc-test/test/linux_elf.rs4
-rw-r--r--libc-test/test/linux_fcntl.rs4
-rw-r--r--libc-test/test/linux_ipv6.rs4
-rw-r--r--libc-test/test/linux_strerror_r.rs4
-rw-r--r--libc-test/test/linux_termios.rs4
6 files changed, 29 insertions, 19 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index f7f8c7c192..e35dcb4eb1 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 8744200e82..d149c9aaff 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 915a87dc75..49c06cc4f6 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 c4d0965a0f..83c389ce16 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 5139175f9e..17db959d8c 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 9ee47631e5..703a9b9b25 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");
+}