Skip to content

Commit ab1463d

Browse files
authored
test: redact host target when comparing CARGO_ENV path (#15279)
This was found when updating git submodule in rust-lang/rust ``` ---- cargo_command::overwrite_cargo_environment_variable stdout ---- running `/projects/rust/build/aarch64-apple-darwin/stage1-tools/aarch64-apple-darwin/release/cargo run` thread 'cargo_command::overwrite_cargo_environment_variable' panicked at src/tools/cargo/tests/testsuite/cargo_command.rs:636:58: test failed running `/projects/rust/build/aarch64-apple-darwin/stage1-tools/aarch64-apple-darwin/release/cargo run` error: expected to find: /projects/rust/build/aarch64-apple-darwin/stage1-tools/aarch64-apple-darwin/release/cargo did not find in output: [COMPILING] foo v1.0.0 ([ROOT]/foo) [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s [RUNNING] `target/debug/foo` ```
2 parents aecb765 + 21af60a commit ab1463d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tests/testsuite/cargo_command.rs

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use std::str;
1010
use cargo_test_support::basic_manifest;
1111
use cargo_test_support::prelude::*;
1212
use cargo_test_support::registry::Package;
13+
use cargo_test_support::rustc_host;
1314
use cargo_test_support::str;
1415
use cargo_test_support::tools::echo_subcommand;
1516
use cargo_test_support::{
@@ -576,6 +577,7 @@ fn full_did_you_mean() {
576577

577578
#[cargo_test]
578579
fn overwrite_cargo_environment_variable() {
580+
let rustc_host = rustc_host();
579581
// If passed arguments `arg1 arg2 ...`, this program runs them as a command.
580582
// If passed no arguments, this program simply prints `$CARGO`.
581583
let p = project()
@@ -626,6 +628,7 @@ fn overwrite_cargo_environment_variable() {
626628
.with_extension("")
627629
.to_str()
628630
.unwrap()
631+
.replace(rustc_host, "[HOST_TARGET]")
629632
);
630633

631634
for cmd in [

0 commit comments

Comments
 (0)