Skip to content

Commit fbe5cd5

Browse files
committed
run_dep_mode: treat program.args and program.env consistently
1 parent 6df153c commit fbe5cd5

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

tests/ui.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) ->
5959
let mut program = CommandBuilder::rustc();
6060
program.program = miri_path();
6161

62+
// Add a test env var to do environment communication tests.
63+
program.envs.push(("MIRI_ENV_VAR_TEST".into(), Some("0".into())));
64+
// Let the tests know where to store temp files (they might run for a different target, which can make this hard to find).
65+
program.envs.push(("MIRI_TEMP".into(), Some(tmpdir.to_owned().into())));
66+
// If a test ICEs, we want to see a backtrace.
67+
program.envs.push(("RUST_BACKTRACE".into(), Some("1".into())));
68+
6269
// Add some flags we always want.
6370
program.args.push(
6471
format!(
@@ -128,15 +135,6 @@ fn run_tests(
128135
) -> Result<()> {
129136
let mut config = test_config(target, path, mode, with_dependencies);
130137

131-
// Add a test env var to do environment communication tests.
132-
config.program.envs.push(("MIRI_ENV_VAR_TEST".into(), Some("0".into())));
133-
134-
// Let the tests know where to store temp files (they might run for a different target, which can make this hard to find).
135-
config.program.envs.push(("MIRI_TEMP".into(), Some(tmpdir.to_owned().into())));
136-
137-
// If a test ICEs, we want to see a backtrace.
138-
config.program.envs.push(("RUST_BACKTRACE".into(), Some("1".into())));
139-
140138
// Handle command-line arguments.
141139
let args = ui_test::Args::test()?;
142140
let default_bless = env::var_os("RUSTC_BLESS").is_some_and(|v| v != "0");
@@ -306,6 +304,7 @@ fn run_dep_mode(target: String, mut args: impl Iterator<Item = OsString>) -> Res
306304
/* with dependencies */ true,
307305
);
308306
config.program.args.clear(); // We want to give the user full control over flags
307+
config.program.env.clear(); // and the env
309308
let dep_args = config.build_dependencies()?;
310309

311310
let mut cmd = config.program.build(&config.out_dir);

0 commit comments

Comments
 (0)