Skip to content

Commit 7347918

Browse files
committed
test: redact host target when comparing CARGO_ENV path
This was found when updating git submodule in rust-lang/rust ``` ---- test::cargo_test_env stdout ---- running `/Users/weihanglo/dev/rust/build/aarch64-apple-darwin/stage2-tools/aarch64-apple-darwin/release/cargo test --lib -- --nocapture` thread 'test::cargo_test_env' panicked at tests/testsuite/test.rs:3904:10: test failed running `/Users/weihanglo/dev/rust/build/aarch64-apple-darwin/stage2-tools/aarch64-apple-darwin/release/cargo test --lib -- --nocapture` error: expected to find: /Users/weihanglo/dev/rust/build/aarch64-apple-darwin/stage2-tools/aarch64-apple-darwin/release/cargo did not find in output: [COMPILING] foo v0.5.0 ([ROOT]/foo) [FINISHED] `test` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] unittests src/lib.rs (target/debug/deps/foo-[HASH]) /Users/weihanglo/dev/rust/build/[HOST_TARGET]/stage2-tools/[HOST_TARGET]/release/cargo ```
1 parent c03c580 commit 7347918

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

tests/testsuite/test.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3870,6 +3870,7 @@ fn doctest_and_registry() {
38703870

38713871
#[cargo_test]
38723872
fn cargo_test_env() {
3873+
let rustc_host = rustc_host();
38733874
let src = format!(
38743875
r#"
38753876
#![crate_type = "rlib"]
@@ -3896,6 +3897,7 @@ fn cargo_test_env() {
38963897
.with_extension("")
38973898
.to_str()
38983899
.unwrap()
3900+
.replace(rustc_host, "[HOST_TARGET]")
38993901
);
39003902
p.cargo("test --lib -- --nocapture")
39013903
.with_stderr_contains(cargo)
@@ -3911,7 +3913,14 @@ test env_test ... ok
39113913
.unwrap()
39123914
.canonicalize()
39133915
.unwrap();
3914-
let stderr_rustc = format!("{}[EXE]", rustc.with_extension("").to_str().unwrap());
3916+
let stderr_rustc = format!(
3917+
"{}[EXE]",
3918+
rustc
3919+
.with_extension("")
3920+
.to_str()
3921+
.unwrap()
3922+
.replace(rustc_host, "[HOST_TARGET]")
3923+
);
39153924
p.cargo("test --lib -- --nocapture")
39163925
// we use rustc since $CARGO is only used if it points to a path that exists
39173926
.env(cargo::CARGO_ENV, rustc)

0 commit comments

Comments
 (0)