about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2025-05-08 15:17:47 +0200
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2025-05-08 15:24:05 +0200
commit41ff588c70109d1ebaeed1cbb15769889158c35e (patch)
treec938cf045eff856d5e19727c755e29496bae7114
parent19738720130a82959acd4fc45259166262f3ffbe (diff)
downloadrust-41ff588c70109d1ebaeed1cbb15769889158c35e.tar.gz
rust-41ff588c70109d1ebaeed1cbb15769889158c35e.zip
Make `rustdoc-tempdir-removal` run-make tests work on other platforms than linux
-rw-r--r--tests/run-make/rustdoc-tempdir-removal/rmake.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/tests/run-make/rustdoc-tempdir-removal/rmake.rs b/tests/run-make/rustdoc-tempdir-removal/rmake.rs
index bd87f05b7cf..9ad369ae5b1 100644
--- a/tests/run-make/rustdoc-tempdir-removal/rmake.rs
+++ b/tests/run-make/rustdoc-tempdir-removal/rmake.rs
@@ -1,14 +1,22 @@
 // This test ensures that no temporary folder is "left behind" when doctests fail for any reason.
 
-//@ only-linux
+//@ ignore-cross-compile
 
 use std::path::Path;
 
 use run_make_support::{path, rfs, rustdoc};
 
 fn run_doctest_and_check_tmpdir(tmp_dir: &Path, doctest: &str, edition: &str) {
-    let output =
-        rustdoc().input(doctest).env("TMPDIR", tmp_dir).arg("--test").edition(edition).run_fail();
+    let mut runner = rustdoc();
+    runner.input(doctest).arg("--test").edition(edition);
+    let output = if cfg!(unix) {
+        runner.env("TMPDIR", tmp_dir)
+    } else if cfg!(windows) {
+        runner.env("TEMP", tmp_dir).env("TMP", tmp_dir)
+    } else {
+        panic!("unsupported OS")
+    }
+    .run_fail();
 
     output.assert_exit_code(101).assert_stdout_contains(
         "test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out",