Skip to content

Commit

Permalink
Check if windows has_symlink for tests (#771)
Browse files Browse the repository at this point in the history
Symlinking is privileged operation on Windows, so we check if the running user can make symlinks before running tests that require them.
  • Loading branch information
create2000 authored Oct 21, 2024
1 parent debe356 commit eb8fe3e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib_eio_windows/test/test_fs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ let test_symlink env () =
Unix.mkdir "another" 0o700;
print_endline @@ Unix.realpath "to-subdir" |}
*)
if not (Unix.has_symlink ()) then
Printf.printf "Skipping test_symlink on systems that don't support symlinks.\n"
else
let cwd = Eio.Stdenv.cwd env in
try_mkdir (cwd / "sandbox");
Unix.symlink ~to_dir:true ".." "sandbox\\to-root";
Expand Down Expand Up @@ -277,4 +280,5 @@ let tests env = [
"unlink", `Quick, test_unlink env;
"failing-unlink", `Quick, try_failing_unlink env;
"rmdir", `Quick, test_remove_dir env;
"mkdirs", `Quick, test_mkdirs env;
]

0 comments on commit eb8fe3e

Please sign in to comment.