Skip to content

Commit 4a2d8dc

Browse files
authored
Merge pull request #14803 from weihanglo/test
test: adjust `cargo_test_env` to unblock rust submodule update
2 parents d8cb5fb + 7347918 commit 4a2d8dc

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

tests/testsuite/test.rs

Lines changed: 19 additions & 10 deletions
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"]
@@ -3888,12 +3889,16 @@ fn cargo_test_env() {
38883889
.file("src/lib.rs", &src)
38893890
.build();
38903891

3891-
let cargo = cargo_exe()
3892-
.canonicalize()
3893-
.unwrap()
3894-
.to_str()
3895-
.unwrap()
3896-
.replace(std::env::consts::EXE_SUFFIX, "[EXE]");
3892+
let cargo = format!(
3893+
"{}[EXE]",
3894+
cargo_exe()
3895+
.canonicalize()
3896+
.unwrap()
3897+
.with_extension("")
3898+
.to_str()
3899+
.unwrap()
3900+
.replace(rustc_host, "[HOST_TARGET]")
3901+
);
38973902
p.cargo("test --lib -- --nocapture")
38983903
.with_stderr_contains(cargo)
38993904
.with_stdout_data(str![[r#"
@@ -3908,10 +3913,14 @@ test env_test ... ok
39083913
.unwrap()
39093914
.canonicalize()
39103915
.unwrap();
3911-
let stderr_rustc = rustc
3912-
.to_str()
3913-
.unwrap()
3914-
.replace(std::env::consts::EXE_SUFFIX, "[EXE]");
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)