about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChris Denton <christophersdenton@gmail.com>2022-03-19 14:55:59 +0000
committerChris Denton <christophersdenton@gmail.com>2022-03-19 15:09:36 +0000
commit68c03cd386a52e0391402941e8b87c37f5f9924a (patch)
tree97243b8c3afaf65be7ebab1171ce3fbdb8f31ad0
parent31535841701e0bf7ef33998024376f2cedd8b3e3 (diff)
downloadrust-68c03cd386a52e0391402941e8b87c37f5f9924a.tar.gz
rust-68c03cd386a52e0391402941e8b87c37f5f9924a.zip
Skip a test if symlink creation is not possible
-rw-r--r--library/std/src/sys/windows/process/tests.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/library/std/src/sys/windows/process/tests.rs b/library/std/src/sys/windows/process/tests.rs
index 96477fb19da..cd535afb4a3 100644
--- a/library/std/src/sys/windows/process/tests.rs
+++ b/library/std/src/sys/windows/process/tests.rs
@@ -186,8 +186,15 @@ fn windows_exe_resolver() {
     let temp = tmpdir();
     let mut exe_path = temp.path().to_owned();
     exe_path.push("exists.exe");
-    symlink("<DOES NOT EXIST>".as_ref(), &exe_path).unwrap();
 
     // A broken symlink should still be resolved.
-    assert!(resolve_exe(OsStr::new("exists.exe"), empty_paths, Some(temp.path().as_ref())).is_ok());
+    // Skip this check if not in CI and creating symlinks isn't possible.
+    let is_ci = env::var("CI").is_ok();
+    let result = symlink("<DOES NOT EXIST>".as_ref(), &exe_path);
+    if is_ci || result.is_ok() {
+        result.unwrap();
+        assert!(
+            resolve_exe(OsStr::new("exists.exe"), empty_paths, Some(temp.path().as_ref())).is_ok()
+        );
+    }
 }