From ee1c691befd416221354b3595fd109a7d480ec01 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Wed, 6 Mar 2024 20:34:31 +0000 Subject: [PATCH 1/2] Make `x t miri` respect `MIRI_TEMP` --- src/tools/miri/tests/compiletest.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/miri/tests/compiletest.rs b/src/tools/miri/tests/compiletest.rs index 9f46772456518..db0768848fd37 100644 --- a/src/tools/miri/tests/compiletest.rs +++ b/src/tools/miri/tests/compiletest.rs @@ -81,8 +81,10 @@ fn test_config(target: &str, path: &str, mode: Mode, with_dependencies: bool) -> // Add a test env var to do environment communication tests. program.envs.push(("MIRI_ENV_VAR_TEST".into(), Some("0".into()))); + // Let the tests know where to store temp files (they might run for a different target, which can make this hard to find). - program.envs.push(("MIRI_TEMP".into(), Some(env::temp_dir().into()))); + let miri_temp = env::var_os("MIRI_TEMP").unwrap_or_else(|| env::temp_dir().into()); + program.envs.push(("MIRI_TEMP".into(), Some(miri_temp))); let mut config = Config { target: Some(target.to_owned()), From 9891d6a33737117dcc93c620c0bb027aa26a246e Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Wed, 6 Mar 2024 20:34:50 +0000 Subject: [PATCH 2/2] Add advice for failing `shims/fs.rs` miri test --- src/tools/miri/tests/pass/shims/fs.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/miri/tests/pass/shims/fs.rs b/src/tools/miri/tests/pass/shims/fs.rs index 6ba39c1f563f9..304a178dc3404 100644 --- a/src/tools/miri/tests/pass/shims/fs.rs +++ b/src/tools/miri/tests/pass/shims/fs.rs @@ -1,6 +1,10 @@ //@ignore-target-windows: File handling is not implemented yet //@compile-flags: -Zmiri-disable-isolation +// If this test is failing for you locally, you can try +// 1. Deleting the files `/tmp/miri_*` +// 2. Setting `MIRI_TEMP` or `TMPDIR` to a different directory, without the `miri_*` files + #![feature(io_error_more)] #![feature(io_error_uncategorized)]