Correctly set --cap-lints when running regex tests

This commit is contained in:
Guillaume Gomez 2023-11-23 18:10:01 +01:00
parent ad1d5417e7
commit 7d71b87691
2 changed files with 6 additions and 2 deletions

View File

@ -149,9 +149,11 @@ pub fn setup(
.extend_from_slice(&["--sysroot".to_string(), sysroot_path.display().to_string()]);
};
// This environment variable is useful in case we want to change options of rustc commands.
if let Some(cg_rustflags) = env.get("CG_RUSTFLAGS") {
rustflags.extend_from_slice(&split_args(&cg_rustflags));
}
if let Some(linker) = linker {
rustflags.push(linker.to_string());
}

View File

@ -750,7 +750,8 @@ fn extended_regex_example_tests(env: &Env, args: &TestArg) -> Result<(), String>
println!("[TEST] rust-lang/regex example shootout-regex-dna");
let mut env = env.clone();
// newer aho_corasick versions throw a deprecation warning
env.insert("CG_RUSTFLAGS".to_string(), "--cap-lints warn".to_string());
let rustflags = format!("{} --cap-lints warn", env.get("RUSTFLAGS").cloned().unwrap_or_default());
env.insert("RUSTFLAGS".to_string(), rustflags);
// Make sure `[codegen mono items] start` doesn't poison the diff
run_cargo_command(
&[&"build", &"--example", &"shootout-regex-dna"],
@ -798,7 +799,8 @@ fn extended_regex_tests(env: &Env, args: &TestArg) -> Result<(), String> {
println!("[TEST] rust-lang/regex tests");
let mut env = env.clone();
// newer aho_corasick versions throw a deprecation warning
env.insert("CG_RUSTFLAGS".to_string(), "--cap-lints warn".to_string());
let rustflags = format!("{} --cap-lints warn", env.get("RUSTFLAGS").cloned().unwrap_or_default());
env.insert("RUSTFLAGS".to_string(), rustflags);
run_cargo_command(
&[
&"test",