about summary refs log tree commit diff
path: root/tests/run-make/invalid-tmpdir-env-var
diff options
context:
space:
mode:
authorOneirical <manchot@videotron.ca>2024-07-16 13:24:19 -0400
committerOneirical <manchot@videotron.ca>2024-07-22 10:12:00 -0400
commit8990df7d13871b388cbb51add034eb301e68956b (patch)
treeceb71448ac3812ae9c66f772671042d767158399 /tests/run-make/invalid-tmpdir-env-var
parent613a7a79e7ce7f733e622040d45e392c159d13e3 (diff)
rewrite and rename issue-107094 to rmake
Diffstat (limited to 'tests/run-make/invalid-tmpdir-env-var')
-rw-r--r--tests/run-make/invalid-tmpdir-env-var/rmake.rs22
1 files changed, 12 insertions, 10 deletions
diff --git a/tests/run-make/invalid-tmpdir-env-var/rmake.rs b/tests/run-make/invalid-tmpdir-env-var/rmake.rs
index d4258775a11..db44debb319 100644
--- a/tests/run-make/invalid-tmpdir-env-var/rmake.rs
+++ b/tests/run-make/invalid-tmpdir-env-var/rmake.rs
@@ -1,18 +1,20 @@
-// When the TMP or TMPDIR variable is set to an invalid or non-existing directory,
-// this used to cause an internal compiler error (ICE). After the addition of proper
-// error handling in #28430, this test checks that the expected message is printed.
+// When the TMP (on Windows) or TMPDIR (on Unix) variable is set to an invalid
+// or non-existing directory, this used to cause an internal compiler error (ICE). After the
+// addition of proper error handling in #28430, this test checks that the expected message is
+// printed.
 // See https://github.com/rust-lang/rust/issues/14698
 
-use run_make_support::rustc;
+use run_make_support::{is_windows, rustc};
 
 // NOTE: This is not a UI test despite its simplicity, as the error message contains a path
 // with some variability that is difficult to normalize
 
 fn main() {
-    rustc()
-        .input("foo.rs")
-        .env("TMP", "fake")
-        .env("TMPDIR", "fake")
-        .run_fail()
-        .assert_stderr_contains("couldn't create a temp dir");
+    let mut rustc = rustc();
+    if is_windows() {
+        rustc.env("TMP", "fake");
+    } else {
+        rustc.env("TMPDIR", "fake");
+    }
+    rustc.input("foo.rs").run_fail().assert_stderr_contains("couldn't create a temp dir");
 }