about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2022-10-22 13:59:45 +0200
committerRalf Jung <post@ralfj.de>2022-10-24 11:49:40 +0200
commit84e6732d1e41ad8f928132cf9035a099a65c7010 (patch)
treee8c7caab5e99e8ba418d74f14506d0ebfcbf723a /src/bootstrap
parenta61737ed6e169c64c851dd9a6f9bbcf5d78f70b4 (diff)
downloadrust-84e6732d1e41ad8f928132cf9035a099a65c7010.tar.gz
rust-84e6732d1e41ad8f928132cf9035a099a65c7010.zip
also smoke-test 'cargo miri test'
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/test.rs38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 7f63226a061..ebac73d8aad 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -563,10 +563,10 @@ impl Step for Miri {
         cargo.add_rustc_lib_path(builder, compiler);
 
         // miri tests need to know about the stage sysroot
-        cargo.env("MIRI_SYSROOT", miri_sysroot);
+        cargo.env("MIRI_SYSROOT", &miri_sysroot);
         cargo.env("MIRI_HOST_SYSROOT", sysroot);
         cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
-        cargo.env("MIRI", miri);
+        cargo.env("MIRI", &miri);
         // propagate --bless
         if builder.config.cmd.bless() {
             cargo.env("MIRI_BLESS", "Gesundheit");
@@ -579,6 +579,40 @@ impl Step for Miri {
 
         let mut cargo = Command::from(cargo);
         builder.run(&mut cargo);
+
+        // # Run `cargo miri test`.
+        // This is just a smoke test (Miri's own CI invokes this in a bunch of different ways and ensures
+        // that we get the desired output), but that is sufficient to make sure that the libtest harness
+        // itself executes properly under Miri.
+        let mut cargo = tool::prepare_tool_cargo(
+            builder,
+            compiler,
+            Mode::ToolRustc,
+            host,
+            "run",
+            "src/tools/miri/cargo-miri",
+            SourceType::Submodule,
+            &[],
+        );
+        cargo.add_rustc_lib_path(builder, compiler);
+        cargo.arg("--").arg("miri").arg("test");
+        cargo
+            .arg("--manifest-path")
+            .arg(builder.src.join("src/tools/miri/test-cargo-miri/Cargo.toml"));
+        cargo.arg("--target").arg(target.rustc_target_arg());
+        cargo.arg("--tests"); // don't run doctests, they are too confused by the staging
+        cargo.arg("--").args(builder.config.cmd.test_args());
+
+        // Tell `cargo miri` where to find things.
+        cargo.env("MIRI_SYSROOT", &miri_sysroot);
+        cargo.env("MIRI_HOST_SYSROOT", sysroot);
+        cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(compiler));
+        cargo.env("MIRI", &miri);
+        // Debug things.
+        cargo.env("RUST_BACKTRACE", "1");
+
+        let mut cargo = Command::from(cargo);
+        builder.run(&mut cargo);
     }
 }