Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: adjust cargo_test_env to unblock rust submodule update #14803

Merged
merged 2 commits into from
Nov 9, 2024
Merged
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
29 changes: 19 additions & 10 deletions tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3870,6 +3870,7 @@ fn doctest_and_registry() {

#[cargo_test]
fn cargo_test_env() {
let rustc_host = rustc_host();
let src = format!(
r#"
#![crate_type = "rlib"]
Expand All @@ -3888,12 +3889,16 @@ fn cargo_test_env() {
.file("src/lib.rs", &src)
.build();

let cargo = cargo_exe()
.canonicalize()
.unwrap()
.to_str()
.unwrap()
.replace(std::env::consts::EXE_SUFFIX, "[EXE]");
let cargo = format!(
"{}[EXE]",
cargo_exe()
.canonicalize()
.unwrap()
.with_extension("")
.to_str()
.unwrap()
.replace(rustc_host, "[HOST_TARGET]")
);
p.cargo("test --lib -- --nocapture")
.with_stderr_contains(cargo)
.with_stdout_data(str![[r#"
Expand All @@ -3908,10 +3913,14 @@ test env_test ... ok
.unwrap()
.canonicalize()
.unwrap();
let stderr_rustc = rustc
.to_str()
.unwrap()
.replace(std::env::consts::EXE_SUFFIX, "[EXE]");
let stderr_rustc = format!(
"{}[EXE]",
rustc
.with_extension("")
.to_str()
.unwrap()
.replace(rustc_host, "[HOST_TARGET]")
);
p.cargo("test --lib -- --nocapture")
// we use rustc since $CARGO is only used if it points to a path that exists
.env(cargo::CARGO_ENV, rustc)
Expand Down