Skip to content

Commit b0e4c35

Browse files
committed
./x test miri: fix cleaning the miri_ui directory
1 parent 855e0fe commit b0e4c35

File tree

2 files changed

+9
-2
lines changed
  • src

2 files changed

+9
-2
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -556,8 +556,13 @@ impl Step for Miri {
556556
// Miri has its own "target dir" for ui test dependencies. Make sure it gets cleared when
557557
// the sysroot gets rebuilt, to avoid "found possibly newer version of crate `std`" errors.
558558
if !builder.config.dry_run() {
559-
let ui_test_dep_dir =
560-
builder.stage_out(miri.build_compiler, Mode::ToolStd).join("miri_ui");
559+
// This has to match `CARGO_TARGET_TMPDIR` in Miri's `ui.rs`.
560+
// This means we need `host` here as that's the target `ui.rs` is built for.
561+
let ui_test_dep_dir = builder
562+
.stage_out(miri.build_compiler, Mode::ToolStd)
563+
.join(host)
564+
.join("tmp")
565+
.join("miri_ui");
561566
// The mtime of `miri_sysroot` changes when the sysroot gets rebuilt (also see
562567
// <https://github.com/RalfJung/rustc-build-sysroot/commit/10ebcf60b80fe2c3dc765af0ff19fdc0da4b7466>).
563568
// We can hence use that directly as a signal to clear the ui test dir.

src/tools/miri/tests/ui.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ fn miri_config(
9797
let mut config = Config {
9898
target: Some(target.to_owned()),
9999
program,
100+
// When changing this, remember to also adjust the logic in bootstrap, in Miri's test step,
101+
// that deletes the `miri_ui` dir when it needs a rebuild.
100102
out_dir: PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("miri_ui"),
101103
threads: std::env::var("MIRI_TEST_THREADS")
102104
.ok()

0 commit comments

Comments
 (0)