diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-04-06 13:00:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-06 13:00:06 +0200 |
| commit | d9727d1c5a615db1b9085976f402745f8d2b1392 (patch) | |
| tree | ea06725650e72f30f47914a46f01940b4bd33de8 /src/bootstrap | |
| parent | 459dd38611e9373ab43e5401fcb43ed98e2a9b83 (diff) | |
| parent | 234057d7176b5a03ee75beca04195386deface16 (diff) | |
| download | rust-d9727d1c5a615db1b9085976f402745f8d2b1392.tar.gz rust-d9727d1c5a615db1b9085976f402745f8d2b1392.zip | |
Rollup merge of #123504 - RalfJung:test-cargo-miri, r=Mark-Simulacrum
bootstrap: split cargo-miri test into separate Step This makes it easier to test just the driver or the cargo-miri integration. ````@rust-lang/miri```` this means to test both you now need to do `./x.py test miri cargo-miri`.
Diffstat (limited to 'src/bootstrap')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 39 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder.rs | 1 |
2 files changed, 36 insertions, 4 deletions
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index bacf5f0d33c..028e0f6d05f 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -597,7 +597,7 @@ impl Step for Miri { builder.ensure(compile::Std::new(target_compiler, host)); let host_sysroot = builder.sysroot(target_compiler); - // # Run `cargo test`. + // Run `cargo test`. // This is with the Miri crate, so it uses the host compiler. let mut cargo = tool::prepare_tool_cargo( builder, @@ -652,15 +652,46 @@ impl Step for Miri { builder.run(&mut cargo); } } + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct CargoMiri { + target: TargetSelection, +} + +impl Step for CargoMiri { + type Output = (); + const ONLY_HOSTS: bool = false; - // # Run `cargo miri test`. + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/tools/miri/cargo-miri") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(CargoMiri { target: run.target }); + } + + /// Tests `cargo miri test`. + fn run(self, builder: &Builder<'_>) { + let host = builder.build.build; + let target = self.target; + let stage = builder.top_stage; + if stage == 0 { + eprintln!("cargo-miri cannot be tested at stage 0"); + std::process::exit(1); + } + + // This compiler runs on the host, we'll just use it for the target. + let compiler = builder.compiler(stage, host); + + // 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, and that all the logic in `cargo-miri` does not explode. - // This is running the build `cargo-miri` for the given target, so we need the target compiler. let mut cargo = tool::prepare_tool_cargo( builder, - target_compiler, + compiler, Mode::ToolStd, // it's unclear what to use here, we're not building anything just doing a smoke test! target, "miri-test", diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs index 9555be481e6..e8977a4b173 100644 --- a/src/bootstrap/src/core/builder.rs +++ b/src/bootstrap/src/core/builder.rs @@ -808,6 +808,7 @@ impl<'a> Builder<'a> { test::EditionGuide, test::Rustfmt, test::Miri, + test::CargoMiri, test::Clippy, test::RustDemangler, test::CompiletestTest, |
