Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description = "Automatic cfg for Rust compiler features"
readme = "README.md"
keywords = ["rustc", "build", "autoconf"]
categories = ["development-tools::build-utils"]
exclude = ["/.github/**"]
rust-version = "1.0"
include = ["Cargo.toml", "LICENSE-APACHE", "LICENSE-MIT", "README.md", "src/**/*.rs", "tests/**/*.rs"]

[dependencies]
7 changes: 7 additions & 0 deletions tests/support/wrap_ignored.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn main() {
let mut args = std::env::args();
// Add our own version so we can check that the wrapper is used for that.
if args.any(|f| f == "--version") {
println!("release: 12345.6789.0");
}
}
12 changes: 0 additions & 12 deletions tests/wrap_ignored

This file was deleted.

15 changes: 14 additions & 1 deletion tests/wrappers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ fn test_wrappers() {
}
}

let original_rustc = std::env::var("RUSTC").unwrap_or_else(|_| String::from("rustc"));

let out = support::out_dir();

// This is used as a heuristic to detect rust-lang/cargo#9601.
Expand Down Expand Up @@ -44,9 +46,20 @@ fn test_wrappers() {
}
}

// compile the wrap_ignored wrapper
let wrapper_output_path = format!("{}/wrap_ignored", out.display());
let res = std::process::Command::new(original_rustc)
.arg("./tests/support/wrap_ignored.rs")
.arg("-o")
.arg(&wrapper_output_path)
.status()
.unwrap();
assert!(res.success(), "Failed to compile wrapper");
println!("{wrapper_output_path}");

// Finally, make sure that `RUSTC_WRAPPER` is applied outermost
// by using something that doesn't pass through at all.
env::set_var("RUSTC_WRAPPER", "./tests/wrap_ignored");
env::set_var("RUSTC_WRAPPER", wrapper_output_path);
env::set_var("RUSTC_WORKSPACE_WRAPPER", "/bin/false");
let ac = autocfg::AutoCfg::with_dir(out.as_ref()).unwrap();
assert!(ac.probe_type("mesize")); // anything goes!
Expand Down