Skip to content

Commit

Permalink
Auto merge of #123192 - RalfJung:bootstrap-test-miri, r=onur-ozkan
Browse files Browse the repository at this point in the history
Refactor the way bootstrap invokes `cargo miri`

Instead of basically doing `cargo run --manifest-path=<cargo-miri's manifest> -- miri`, let's invoke the `cargo-miri` binary directly. That means less indirections, and also makes it easier to e.g. run the libcore test suite in Miri. (But there are still other issues with that.)

Also also adjusted Miri's stage numbering so that it is consistent with rustc/rustdoc.

This also makes `./x.py test miri` honor `--no-doc`.

And this fixes rust-lang/rust#123177 by moving where we handle parallel_compiler.
  • Loading branch information
bors committed Apr 1, 2024
2 parents a284c5c + a560cb4 commit 829aadc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions cargo-miri/src/phases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
let verbose = num_arg_flag("-v");

// Determine the involved architectures.
let rustc_version = VersionMeta::for_command(miri_for_host())
.expect("failed to determine underlying rustc version of Miri");
let rustc_version = VersionMeta::for_command(miri_for_host()).unwrap_or_else(|err| {
panic!(
"failed to determine underlying rustc version of Miri ({:?}):\n{err:?}",
miri_for_host()
)
});
let host = &rustc_version.host;
let target = get_arg_flag_value("--target");
let target = target.as_ref().unwrap_or(host);
Expand Down Expand Up @@ -222,7 +226,7 @@ pub fn phase_cargo_miri(mut args: impl Iterator<Item = String>) {
}

// Run cargo.
debug_cmd("[cargo-miri miri]", verbose, &cmd);
debug_cmd("[cargo-miri cargo]", verbose, &cmd);
exec(cmd)
}

Expand Down
6 changes: 3 additions & 3 deletions cargo-miri/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ pub fn setup(
let cargo_cmd = {
let mut command = cargo();
// Use Miri as rustc to build a libstd compatible with us (and use the right flags).
// We set ourselves (`cargo-miri`) instead of Miri directly to be able to patch the flags
// for `libpanic_abort` (usually this is done by bootstrap but we have to do it ourselves).
// The `MIRI_CALLED_FROM_SETUP` will mean we dispatch to `phase_setup_rustc`.
// However, when we are running in bootstrap, we cannot just overwrite `RUSTC`,
// because we still need bootstrap to distinguish between host and target crates.
// In that case we overwrite `RUSTC_REAL` instead which determines the rustc used
// for target crates.
// We set ourselves (`cargo-miri`) instead of Miri directly to be able to patch the flags
// for `libpanic_abort` (usually this is done by bootstrap but we have to do it ourselves).
// The `MIRI_CALLED_FROM_SETUP` will mean we dispatch to `phase_setup_rustc`.
let cargo_miri_path = std::env::current_exe().expect("current executable path invalid");
if env::var_os("RUSTC_STAGE").is_some() {
assert!(env::var_os("RUSTC").is_some());
Expand Down

0 comments on commit 829aadc

Please sign in to comment.