Skip to content

Commit 822feaa

Browse files
committed
Stop parsing ui_test annotations in run-dep mode
1 parent 89c2596 commit 822feaa

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

src/tools/miri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,9 @@ dependencies = [
842842

843843
[[package]]
844844
name = "ui_test"
845-
version = "0.11.6"
845+
version = "0.11.7"
846846
source = "registry+https://github.com/rust-lang/crates.io-index"
847-
checksum = "24a2e70adc9d18b9b4dd80ea57aeec447103c6fbb354a07c080adad451c645e1"
847+
checksum = "c21899b59f53717dfad29e4f46e5b21a200a1b6888ab86532a07cfc8b48dd78c"
848848
dependencies = [
849849
"bstr",
850850
"cargo-platform",

src/tools/miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ libloading = "0.7"
3636

3737
[dev-dependencies]
3838
colored = "2"
39-
ui_test = "0.11.6"
39+
ui_test = "0.11.7"
4040
rustc_version = "0.4"
4141
# Features chosen to match those required by env_logger, to avoid rebuilds
4242
regex = { version = "1.5.5", default-features = false, features = ["perf", "std"] }

src/tools/miri/tests/compiletest.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,20 @@ fn main() -> Result<()> {
274274
fn run_dep_mode(target: String, mut args: impl Iterator<Item = OsString>) -> Result<()> {
275275
let path = args.next().expect("./miri run-dep must be followed by a file name");
276276
let mut config = test_config(&target, "", Mode::Yolo, /* with dependencies */ true);
277-
config.program.args.remove(0); // remove the `--error-format=json` argument
278-
config.program.args.push("--color".into());
279-
config.program.args.push("always".into());
280-
let mut cmd = ui_test::test_command(config, Path::new(&path))?;
281-
// Separate the arguments to the `cargo miri` invocation from
282-
// the arguments to the interpreted prog
283-
cmd.arg("--");
277+
config.program.args.clear(); // We want to give the user full control over flags
278+
config.build_dependencies_and_link_them()?;
279+
280+
if let Ok(extra_flags) = env::var("MIRIFLAGS") {
281+
for flag in extra_flags.split_whitespace() {
282+
config.program.args.push(flag.into());
283+
}
284+
}
285+
let mut cmd = config.program.build(&config.out_dir);
286+
287+
cmd.arg("--color").arg("always");
288+
cmd.arg(path);
289+
284290
cmd.args(args);
291+
println!("Running {cmd:?}");
285292
if cmd.spawn()?.wait()?.success() { Ok(()) } else { std::process::exit(1) }
286293
}

0 commit comments

Comments
 (0)