diff options
| author | Ralf Jung <post@ralfj.de> | 2022-10-22 11:18:23 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-10-24 11:49:36 +0200 |
| commit | a61737ed6e169c64c851dd9a6f9bbcf5d78f70b4 (patch) | |
| tree | 372cb4df599e8c1eba9b0bd6eb79bc3bb69ada09 | |
| parent | 64f56d238cc49aff79f12c31a08d22316f43d532 (diff) | |
| download | rust-a61737ed6e169c64c851dd9a6f9bbcf5d78f70b4.tar.gz rust-a61737ed6e169c64c851dd9a6f9bbcf5d78f70b4.zip | |
add support for testing Miri on other targets, and do some cross-testing on CI
| -rw-r--r-- | src/bootstrap/test.rs | 16 | ||||
| -rwxr-xr-x | src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh | 4 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 8d491409778..7f63226a061 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -461,24 +461,30 @@ impl Step for RustDemangler { pub struct Miri { stage: u32, host: TargetSelection, + target: TargetSelection, } impl Step for Miri { type Output = (); - const ONLY_HOSTS: bool = true; + const ONLY_HOSTS: bool = false; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { run.path("src/tools/miri") } fn make_run(run: RunConfig<'_>) { - run.builder.ensure(Miri { stage: run.builder.top_stage, host: run.target }); + run.builder.ensure(Miri { + stage: run.builder.top_stage, + host: run.build_triple(), + target: run.target, + }); } /// Runs `cargo test` for miri. fn run(self, builder: &Builder<'_>) { let stage = self.stage; let host = self.host; + let target = self.target; let compiler = builder.compiler(stage, host); // We need the stdlib for the *next* stage, as it was built with this compiler that also built Miri. // Except if we are at stage 2, the bootstrap loop is complete and we can stick with our current stage. @@ -495,7 +501,7 @@ impl Step for Miri { builder.ensure(compile::Std::new(compiler_std, host)); let sysroot = builder.sysroot(compiler_std); - // # Run `cargo miri setup`. + // # Run `cargo miri setup` for the given target. let mut cargo = tool::prepare_tool_cargo( builder, compiler, @@ -508,6 +514,7 @@ impl Step for Miri { ); cargo.add_rustc_lib_path(builder, compiler); cargo.arg("--").arg("miri").arg("setup"); + cargo.arg("--target").arg(target.rustc_target_arg()); // Tell `cargo miri setup` where to find the sources. cargo.env("MIRI_LIB_SRC", builder.src.join("library")); @@ -565,6 +572,9 @@ impl Step for Miri { cargo.env("MIRI_BLESS", "Gesundheit"); } + // Set the target. + cargo.env("MIRI_TEST_TARGET", target.rustc_target_arg()); + // Forward test filters. cargo.arg("--").args(builder.config.cmd.test_args()); let mut cargo = Command::from(cargo); diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh b/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh index 3e1f39eaab5..086d04a178a 100755 --- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh +++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/checktools.sh @@ -25,3 +25,7 @@ python3 "$X_PY" test --stage 2 check-tools python3 "$X_PY" test --stage 2 src/tools/clippy python3 "$X_PY" test --stage 2 src/tools/rustfmt python3 "$X_PY" test --stage 2 src/tools/miri +# We natively run this script on x86_64-unknown-linux-gnu and x86_64-pc-windows-msvc. +# Also cover some other targets (on both of these hosts) via cross-testing. +python3 "$X_PY" test --stage 2 src/tools/miri --target i686-pc-windows-msvc +python3 "$X_PY" test --stage 2 src/tools/miri --target aarch64-apple-darwin |
