Skip to content

Commit ccad8b4

Browse files
committed
Fix musl build jobs
1 parent cc13d75 commit ccad8b4

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

libc-test/build.rs

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ fn test_android(target: &str) {
14441444
// `linux/fcntl.h` and `fcntl.h` fails.
14451445
//
14461446
// This also tests strerror_r.
1447-
test_linux_termios2();
1447+
test_linux_termios2(target);
14481448
}
14491449

14501450
fn test_freebsd(target: &str) {
@@ -2660,7 +2660,7 @@ fn test_linux(target: &str) {
26602660
// On Linux also generate another script for testing linux/fcntl declarations.
26612661
// These cannot be tested normally because including both `linux/fcntl.h` and `fcntl.h`
26622662
// fails on a lot of platforms.
2663-
test_linux_termios2();
2663+
test_linux_termios2(target);
26642664

26652665
// Test Elf64_Phdr and Elf32_Phdr
26662666
// These types have a field called `p_type`, but including
@@ -2683,7 +2683,9 @@ fn test_linux(target: &str) {
26832683
cfg.generate("../src/lib.rs", "linux_elf.rs");
26842684
}
26852685

2686-
fn test_linux_termios2() {
2686+
fn test_linux_termios2(target: &str) {
2687+
assert!(target.contains("linux") || target.contains("android"));
2688+
let musl = target.contains("musl");
26872689
let mut cfg = ctest::TestGenerator::new();
26882690
cfg.skip_type(|_| true)
26892691
.skip_fn(|f| match f {
@@ -2693,13 +2695,20 @@ fn test_linux_termios2() {
26932695
.skip_static(|_| true);
26942696
headers! {
26952697
cfg:
2696-
"linux/fcntl.h",
2697-
"net/if.h",
2698-
"linux/if.h",
2699-
"linux/quota.h",
2698+
"linux/quota.h",
27002699
"asm/termbits.h",
27012700
"string.h"
27022701
}
2702+
if musl {
2703+
cfg.header("fcntl.h");
2704+
} else {
2705+
cfg.header("linux/fcntl.h");
2706+
}
2707+
if !musl {
2708+
cfg.header("net/if.h");
2709+
cfg.header("linux/if.h");
2710+
}
2711+
27032712
cfg.skip_const(move |name| match name {
27042713
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false,
27052714
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => {

0 commit comments

Comments
 (0)