From 41ff588c70109d1ebaeed1cbb15769889158c35e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 8 May 2025 15:17:47 +0200 Subject: [PATCH] Make `rustdoc-tempdir-removal` run-make tests work on other platforms than linux --- tests/run-make/rustdoc-tempdir-removal/rmake.rs | 14 +++++++++++--- 1 file 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 bd87f05b7cf51..9ad369ae5b10f 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",