Skip to content

Commit

Permalink
Fix the backends test to accept that the default options now depend o…
Browse files Browse the repository at this point in the history
…n libc.
  • Loading branch information
sunfishcode committed Jul 20, 2022
1 parent 5d524e1 commit c41b59d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
9 changes: 9 additions & 0 deletions 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"] }
Empty file.
24 changes: 20 additions & 4 deletions tests/backends.rs
Expand Up @@ -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",
Expand All @@ -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)]
Expand Down

0 comments on commit c41b59d

Please sign in to comment.