From c41b59d02de08c7fe71c9ae1dd435191a1e872d6 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Wed, 20 Jul 2022 15:14:17 -0700 Subject: [PATCH] Fix the backends test to accept that the default options now depend on libc. --- test-crates/use-rustix-auxv/Cargo.toml | 9 +++++++++ test-crates/use-rustix-auxv/src/lib.rs | 0 tests/backends.rs | 24 ++++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 test-crates/use-rustix-auxv/Cargo.toml create mode 100644 test-crates/use-rustix-auxv/src/lib.rs diff --git a/test-crates/use-rustix-auxv/Cargo.toml b/test-crates/use-rustix-auxv/Cargo.toml new file mode 100644 index 000000000..8122570b4 --- /dev/null +++ b/test-crates/use-rustix-auxv/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "use-rustix-auxv" +version = "0.0.0" +edition = "2018" +publish = false + +[dependencies] +# Request that rustix use the default backend, and disable use-libc-auxv. +rustix = { path = "../..", default-features = false, features = ["std"] } diff --git a/test-crates/use-rustix-auxv/src/lib.rs b/test-crates/use-rustix-auxv/src/lib.rs new file mode 100644 index 000000000..e69de29bb diff --git a/tests/backends.rs b/tests/backends.rs index 4b88bd11c..d3f692abf 100644 --- a/tests/backends.rs +++ b/tests/backends.rs @@ -6,10 +6,6 @@ fn test_backends() { // ensure that the use-default crate uses it. #[cfg(all(target_os = "linux", target_arch = "aarch64"))] { - assert!( - !has_dependency("test-crates/use-default", &[], &[], &["RUSTFLAGS"], "libc"), - "use-default depends on libc" - ); assert!( has_dependency( "test-crates/use-default", @@ -22,6 +18,26 @@ fn test_backends() { ); } + // Pick an arbitrary platform where linux_raw is enabled by default and + // ensure that the use-rustix-auxv crate uses it, and does not use libc. + #[cfg(all(target_os = "linux", target_arch = "aarch64"))] + { + assert!( + !has_dependency("test-crates/use-rustix-auxv", &[], &[], &["RUSTFLAGS"], "libc"), + "use-rustix-auxv depends on libc" + ); + assert!( + has_dependency( + "test-crates/use-rustix-auxv", + &[], + &[], + &["RUSTFLAGS"], + "linux-raw-sys" + ), + "use-rustix-auxv does not depend on linux-raw-sys" + ); + } + #[cfg(windows)] let libc_dep = "windows-sys"; #[cfg(unix)]