mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Fix test target_in_environment_contains_lower_case
This commit is contained in:
parent
8eb0e9a855
commit
f344f73063
@ -357,25 +357,28 @@ fn custom_linker_env() {
|
|||||||
fn target_in_environment_contains_lower_case() {
|
fn target_in_environment_contains_lower_case() {
|
||||||
let p = project().file("src/main.rs", "fn main() {}").build();
|
let p = project().file("src/main.rs", "fn main() {}").build();
|
||||||
|
|
||||||
let target_keys = [
|
let target = rustc_host();
|
||||||
"CARGO_TARGET_X86_64_UNKNOWN_LINUX_musl_LINKER",
|
let env_key = format!(
|
||||||
"CARGO_TARGET_x86_64_unknown_linux_musl_LINKER",
|
"CARGO_TARGET_{}_LINKER",
|
||||||
];
|
target.to_lowercase().replace('-', "_")
|
||||||
|
);
|
||||||
|
|
||||||
for target_key in &target_keys {
|
let mut execs = p.cargo("build -v --target");
|
||||||
let mut execs = p.cargo("build -v --target x86_64-unknown-linux-musl");
|
execs.arg(target).env(&env_key, "nonexistent-linker");
|
||||||
execs.env(target_key, "nonexistent-linker").with_status(101);
|
if cfg!(windows) {
|
||||||
if cfg!(windows) {
|
// Windows env keys are case insensitive, so no warning, but it will
|
||||||
execs.with_stderr_does_not_contain("warning:[..]");
|
// fail due to the missing linker.
|
||||||
} else {
|
execs
|
||||||
execs.with_stderr_contains(format!(
|
.with_stderr_does_not_contain("warning:[..]")
|
||||||
"warning: Environment variables are expected to use uppercase letters and underscores, \
|
.with_status(101);
|
||||||
the variable `{}` will be ignored and have no effect",
|
} else {
|
||||||
target_key
|
execs.with_stderr_contains(format!(
|
||||||
));
|
"warning: Environment variables are expected to use uppercase letters and underscores, \
|
||||||
}
|
the variable `{}` will be ignored and have no effect",
|
||||||
execs.run();
|
env_key
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
execs.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user