diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-03-20 20:42:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-20 20:42:43 +0100 |
| commit | 3c02b5192e88306271f071d403f14c826524fa90 (patch) | |
| tree | 0b407cafed88198ca97db29a090a9fece11c2047 /library/std/src | |
| parent | 4767ccec935824fa5d08ce3502b233d7a66adec1 (diff) | |
| parent | 68c03cd386a52e0391402941e8b87c37f5f9924a (diff) | |
Rollup merge of #95114 - ChrisDenton:symlink-test, r=the8472
Skip a test if symlink creation is not possible If someone running tests on Windows does not have Developer Mode enabled then creating symlinks will fail which in turn would cause this test to fail. This can be a stumbling block for contributors.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/sys/windows/process/tests.rs | 11 |
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() + ); + } } |
