@@ -20,32 +20,62 @@ fn test_backends() {
20
20
) ,
21
21
"use-default does not depend on linux-raw-sys"
22
22
) ;
23
+ assert ! (
24
+ !has_dependency( "test-crates/use-default" , & [ ] , & [ ] , & [ "RUSTFLAGS" ] , "libc" ) ,
25
+ "use-default depends on libc"
26
+ ) ;
27
+ // If the libc backend is explicitly requested (by a cfg), check that
28
+ // it's used.
29
+ assert ! (
30
+ has_dependency(
31
+ "test-crates/use-default" ,
32
+ & [ ] ,
33
+ & [ ( "RUSTFLAGS" , "--cfg=rustix_use_libc" ) ] ,
34
+ & [ ] ,
35
+ "libc"
36
+ ) ,
37
+ "use-default with `RUSTFLAGS=--cfg=use-libc` doesn't depend on libc"
38
+ ) ;
39
+ // If the libc backend is explicitly requested (by a feature flag),
40
+ // check that it's used.
41
+ assert ! (
42
+ has_dependency(
43
+ "test-crates/use-default" ,
44
+ & [ "--features=rustix/use-libc" ] ,
45
+ & [ ] ,
46
+ & [ ] ,
47
+ "libc"
48
+ ) ,
49
+ "use-default with `--features=use-libc` doesn't depend on libc"
50
+ ) ;
23
51
}
24
52
25
- // Pick an arbitrary platform where linux_raw is enabled by default and
26
- // ensure that the use-rustix-auxv crate uses it, and does not use libc.
53
+ // Rustix's use-libc-auxv feature calls into libc, but does not use the
54
+ // libc crate to do so. Pick an arbitrary platform where linux_raw is
55
+ // enabled by default and ensure that the use-libc-auxv crate uses it,
56
+ // and does not use the libc crate.
27
57
#[ cfg( all( target_os = "linux" , target_arch = "aarch64" ) ) ]
28
58
{
29
59
assert ! (
30
60
!has_dependency(
31
- "test-crates/use-rustix -auxv" ,
61
+ "test-crates/use-libc -auxv" ,
32
62
& [ ] ,
33
63
& [ ] ,
34
64
& [ "RUSTFLAGS" ] ,
35
65
"libc"
36
66
) ,
37
- "use-rustix -auxv depends on libc"
67
+ "use-libc -auxv depends on libc"
38
68
) ;
39
69
40
70
assert ! (
41
71
has_dependency(
42
- "test-crates/use-rustix -auxv" ,
72
+ "test-crates/use-libc -auxv" ,
43
73
& [ ] ,
44
74
& [ ] ,
45
75
& [ "RUSTFLAGS" ] ,
46
76
"linux-raw-sys"
47
77
) ,
48
- "use-rustix -auxv does not depend on linux-raw-sys"
78
+ "use-libc -auxv does not depend on linux-raw-sys"
49
79
) ;
50
80
}
51
81
0 commit comments