Skip to content

Commit 147c8dc

Browse files
committed
fix miri-script being silent when running './miri test'
1 parent 25a74de commit 147c8dc

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

miri-script/src/commands.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,25 @@ const JOSH_FILTER: &str =
1616
":rev(75dd959a3a40eb5b4574f8d2e23aa6efbeb33573:prefix=src/tools/miri):/src/tools/miri";
1717

1818
impl MiriEnv {
19-
fn build_miri_sysroot(&mut self) -> Result<()> {
19+
fn build_miri_sysroot(&mut self, quiet: bool) -> Result<()> {
2020
if self.sh.var("MIRI_SYSROOT").is_ok() {
2121
// Sysroot already set, use that.
2222
return Ok(());
2323
}
2424
let manifest_path = path!(self.miri_dir / "cargo-miri" / "Cargo.toml");
2525
let Self { toolchain, cargo_extra_flags, .. } = &self;
26+
27+
// Make sure everything is built. Also Miri itself.
28+
self.build(path!(self.miri_dir / "Cargo.toml"), &[], quiet)?;
29+
self.build(&manifest_path, &[], quiet)?;
30+
2631
let target = &match self.sh.var("MIRI_TEST_TARGET") {
2732
Ok(target) => vec!["--target".into(), target],
2833
Err(_) => vec![],
2934
};
35+
if !quiet {
36+
eprintln!("$ (buildig Miri sysroot)");
37+
}
3038
let output = cmd!(self.sh,
3139
"cargo +{toolchain} --quiet run {cargo_extra_flags...} --manifest-path {manifest_path} --
3240
miri setup --print-sysroot {target...}"
@@ -365,9 +373,8 @@ impl Command {
365373
fn test(bless: bool, flags: Vec<OsString>) -> Result<()> {
366374
Self::auto_actions()?;
367375
let mut e = MiriEnv::new()?;
368-
// First build, and get a sysroot.
369-
e.build(path!(e.miri_dir / "Cargo.toml"), &[], /* quiet */ true)?;
370-
e.build_miri_sysroot()?;
376+
// Prepare a sysroot.
377+
e.build_miri_sysroot(/* quiet */ false)?;
371378

372379
// Then test, and let caller control flags.
373380
// Only in root project as `cargo-miri` has no tests.
@@ -393,12 +400,11 @@ impl Command {
393400
let miriflags = e.sh.var("MIRIFLAGS").unwrap_or_default();
394401
e.sh.set_var("MIRIFLAGS", format!("{miriflags} --target {target}"));
395402
}
396-
// First build, and get a sysroot.
397-
let miri_manifest = path!(e.miri_dir / "Cargo.toml");
398-
e.build(&miri_manifest, &[], /* quiet */ true)?;
399-
e.build_miri_sysroot()?;
403+
// Prepare a sysroot.
404+
e.build_miri_sysroot(/* quiet */ true)?;
400405

401406
// Then run the actual command.
407+
let miri_manifest = path!(e.miri_dir / "Cargo.toml");
402408
let miri_flags = e.sh.var("MIRIFLAGS").unwrap_or_default();
403409
let miri_flags = flagsplit(&miri_flags);
404410
let toolchain = &e.toolchain;

0 commit comments

Comments
 (0)