Skip to content

./x test miri: fix cleaning the miri_ui directory #143822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,13 @@ impl Step for Miri {
// Miri has its own "target dir" for ui test dependencies. Make sure it gets cleared when
// the sysroot gets rebuilt, to avoid "found possibly newer version of crate `std`" errors.
if !builder.config.dry_run() {
let ui_test_dep_dir =
builder.stage_out(miri.build_compiler, Mode::ToolStd).join("miri_ui");
// This has to match `CARGO_TARGET_TMPDIR` in Miri's `ui.rs`.
// This means we need `host` here as that's the target `ui.rs` is built for.
let ui_test_dep_dir = builder
.stage_out(miri.build_compiler, Mode::ToolStd)
.join(host)
.join("tmp")
.join("miri_ui");
// The mtime of `miri_sysroot` changes when the sysroot gets rebuilt (also see
// <https://github.com/RalfJung/rustc-build-sysroot/commit/10ebcf60b80fe2c3dc765af0ff19fdc0da4b7466>).
// We can hence use that directly as a signal to clear the ui test dir.
Expand Down
2 changes: 2 additions & 0 deletions src/tools/miri/tests/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ fn miri_config(
let mut config = Config {
target: Some(target.to_owned()),
program,
// When changing this, remember to also adjust the logic in bootstrap, in Miri's test step,
// that deletes the `miri_ui` dir when it needs a rebuild.
out_dir: PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("miri_ui"),
threads: std::env::var("MIRI_TEST_THREADS")
.ok()
Expand Down
Loading