Skip to content

Commit 8e26ab4

Browse files
committed
Minor nitpicks
1 parent cf0bd36 commit 8e26ab4

File tree

6 files changed

+29
-19
lines changed

6 files changed

+29
-19
lines changed

libc-test/build.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1428,7 +1428,7 @@ fn test_android(target: &str) {
14281428

14291429
cfg.generate("../src/lib.rs", "main.rs");
14301430

1431-
test_linux_incompatible_apis(target);
1431+
test_linux_like_apis(target);
14321432
}
14331433

14341434
fn test_freebsd(target: &str) {
@@ -2241,17 +2241,19 @@ fn test_linux(target: &str) {
22412241

22422242
cfg.generate("../src/lib.rs", "main.rs");
22432243

2244-
test_linux_incompatible_apis(target);
2244+
test_linux_like_apis(target);
22452245
}
22462246

22472247
// This function tests APIs that are incompatible to test when other APIs
22482248
// are included (e.g. because including both sets of headers clashes)
2249-
fn test_linux_incompatible_apis(target: &str) {
2250-
assert!(target.contains("linux") || target.contains("android"));
2249+
fn test_linux_like_apis(target: &str) {
22512250
let musl = target.contains("musl");
22522251
let linux = target.contains("linux");
2252+
let emscripten = target.contains("emscripten");
2253+
let android = target.contains("android");
2254+
assert!(linux || android || emscripten);
22532255

2254-
{
2256+
if linux || android || emscripten {
22552257
// test strerror_r from the `string.h` header
22562258
let mut cfg = ctest::TestGenerator::new();
22572259
cfg.skip_type(|_| true).skip_static(|_| true);
@@ -2265,7 +2267,8 @@ fn test_linux_incompatible_apis(target: &str) {
22652267
.skip_struct(|_| true);
22662268
cfg.generate("../src/lib.rs", "linux_strerror_r.rs");
22672269
}
2268-
{
2270+
2271+
if linux || android || emscripten {
22692272
// test fcntl - see:
22702273
// http://man7.org/linux/man-pages/man2/fcntl.2.html
22712274
let mut cfg = ctest::TestGenerator::new();
@@ -2295,7 +2298,8 @@ fn test_linux_incompatible_apis(target: &str) {
22952298

22962299
cfg.generate("../src/lib.rs", "linux_fcntl.rs");
22972300
}
2298-
{
2301+
2302+
if linux || android {
22992303
// test termios
23002304
let mut cfg = ctest::TestGenerator::new();
23012305
cfg.header("asm/termbits.h");
@@ -2312,12 +2316,7 @@ fn test_linux_incompatible_apis(target: &str) {
23122316
cfg.generate("../src/lib.rs", "linux_termios.rs");
23132317
}
23142318

2315-
if !linux {
2316-
return;
2317-
}
2318-
// linux-only tests (no android):
2319-
2320-
{
2319+
if linux || android {
23212320
// test IPV6_ constants:
23222321
let mut cfg = ctest::TestGenerator::new();
23232322
headers! {
@@ -2344,7 +2343,8 @@ fn test_linux_incompatible_apis(target: &str) {
23442343
});
23452344
cfg.generate("../src/lib.rs", "linux_ipv6.rs");
23462345
}
2347-
{
2346+
2347+
if linux || android {
23482348
// Test Elf64_Phdr and Elf32_Phdr
23492349
// These types have a field called `p_type`, but including
23502350
// "resolve.h" defines a `p_type` macro that expands to `__p_type`

libc-test/test/linux_elf.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ use libc::*;
77
include!(concat!(env!("OUT_DIR"), "/linux_elf.rs"));
88

99
#[cfg(not(target_os = "linux"))]
10-
fn main() { println!("PASSED 0 tests"); }
10+
fn main() {
11+
println!("PASSED 0 tests");
12+
}

libc-test/test/linux_fcntl.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ use libc::*;
77
include!(concat!(env!("OUT_DIR"), "/linux_fcntl.rs"));
88

99
#[cfg(not(any(target_os = "linux", target_os = "android")))]
10-
fn main() { println!("PASSED 0 tests"); }
10+
fn main() {
11+
println!("PASSED 0 tests");
12+
}

libc-test/test/linux_ipv6.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ use libc::*;
77
include!(concat!(env!("OUT_DIR"), "/linux_ipv6.rs"));
88

99
#[cfg(not(target_os = "linux"))]
10-
fn main() { println!("PASSED 0 tests"); }
10+
fn main() {
11+
println!("PASSED 0 tests");
12+
}

libc-test/test/linux_strerror_r.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ use libc::*;
77
include!(concat!(env!("OUT_DIR"), "/linux_strerror_r.rs"));
88

99
#[cfg(not(any(target_os = "linux", target_os = "android")))]
10-
fn main() { println!("PASSED 0 tests"); }
10+
fn main() {
11+
println!("PASSED 0 tests");
12+
}

libc-test/test/linux_termios.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ use libc::*;
77
include!(concat!(env!("OUT_DIR"), "/linux_termios.rs"));
88

99
#[cfg(not(any(target_os = "linux", target_os = "android")))]
10-
fn main() { println!("PASSED 0 tests"); }
10+
fn main() {
11+
println!("PASSED 0 tests");
12+
}

0 commit comments

Comments
 (0)