@@ -1444,7 +1444,7 @@ fn test_android(target: &str) {
1444
1444
// `linux/fcntl.h` and `fcntl.h` fails.
1445
1445
//
1446
1446
// This also tests strerror_r.
1447
- test_linux_termios2 ( ) ;
1447
+ test_linux_termios2 ( target ) ;
1448
1448
}
1449
1449
1450
1450
fn test_freebsd ( target : & str ) {
@@ -2660,7 +2660,7 @@ fn test_linux(target: &str) {
2660
2660
// On Linux also generate another script for testing linux/fcntl declarations.
2661
2661
// These cannot be tested normally because including both `linux/fcntl.h` and `fcntl.h`
2662
2662
// fails on a lot of platforms.
2663
- test_linux_termios2 ( ) ;
2663
+ test_linux_termios2 ( target ) ;
2664
2664
2665
2665
// Test Elf64_Phdr and Elf32_Phdr
2666
2666
// These types have a field called `p_type`, but including
@@ -2683,7 +2683,9 @@ fn test_linux(target: &str) {
2683
2683
cfg. generate ( "../src/lib.rs" , "linux_elf.rs" ) ;
2684
2684
}
2685
2685
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" ) ;
2687
2689
let mut cfg = ctest:: TestGenerator :: new ( ) ;
2688
2690
cfg. skip_type ( |_| true )
2689
2691
. skip_fn ( |f| match f {
@@ -2693,13 +2695,20 @@ fn test_linux_termios2() {
2693
2695
. skip_static ( |_| true ) ;
2694
2696
headers ! {
2695
2697
cfg:
2696
- "linux/fcntl.h" ,
2697
- "net/if.h" ,
2698
- "linux/if.h" ,
2699
- "linux/quota.h" ,
2698
+ "linux/quota.h" ,
2700
2699
"asm/termbits.h" ,
2701
2700
"string.h"
2702
2701
}
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
+
2703
2712
cfg. skip_const ( move |name| match name {
2704
2713
"F_CANCELLK" | "F_ADD_SEALS" | "F_GET_SEALS" => false ,
2705
2714
"F_SEAL_SEAL" | "F_SEAL_SHRINK" | "F_SEAL_GROW" | "F_SEAL_WRITE" => {
0 commit comments