diff --git a/ocamltest/actions_helpers.ml b/ocamltest/actions_helpers.ml index 4c216f8be..7ce407f39 100644 --- a/ocamltest/actions_helpers.ml +++ b/ocamltest/actions_helpers.ml @@ -68,7 +68,7 @@ let setup_symlinks test_source_directory build_directory files = let src = Filename.concat test_source_directory filename in let dst = Filename.concat build_directory filename in Sys.copy_file src dst in - let f = if Sys.os_type="Win32" then copy else symlink in + let f = if Sys.win32 then copy else symlink in Sys.make_directory build_directory; List.iter f files @@ -121,7 +121,7 @@ let run_cmd in let lst = List.concat (List.map String.words cmd) in let quoted_lst = - if Sys.os_type="Win32" + if Sys.win32 then List.map Filename.maybe_quote lst else lst in let cmd' = String.concat " " quoted_lst in diff --git a/ocamltest/filecompare.ml b/ocamltest/filecompare.ml index 2e87d0ce0..7bfdb20f6 100644 --- a/ocamltest/filecompare.ml +++ b/ocamltest/filecompare.ml @@ -138,11 +138,8 @@ let compare_files ?(tool = default_comparison_tool) files = files.reference_filename; files.output_filename ] in - let dev_null = match Sys.os_type with - | "Win32" -> "NUL" - | _ -> "/dev/null" in let settings = Run_command.settings_of_commandline - ~stdout_fname:dev_null ~stderr_fname:dev_null commandline in + ~stdout_fname:Filename.null ~stderr_fname:Filename.null commandline in let status = Run_command.run settings in result_of_exitcode commandline status | Internal ignore -> diff --git a/ocamltest/ocaml_actions.ml b/ocamltest/ocaml_actions.ml index dc363f297..a2de63bd5 100644 --- a/ocamltest/ocaml_actions.ml +++ b/ocamltest/ocaml_actions.ml @@ -852,16 +852,14 @@ let really_compare_programs backend comparison_tool log env = "flambda temporarily disables comparison of native programs" in (Result.pass_with_reason reason, env) end else - if backend = Ocaml_backends.Native && - (Sys.os_type="Win32" || Sys.os_type="Cygwin") + if backend = Ocaml_backends.Native && (Sys.win32 || Sys.cygwin) then begin let reason = "comparison of native programs temporarily disabled under Windows" in (Result.pass_with_reason reason, env) end else begin let comparison_tool = - if backend=Ocaml_backends.Native && - (Sys.os_type="Win32" || Sys.os_type="Cygwin") + if backend=Ocaml_backends.Native && (Sys.win32 || Sys.cygwin) then let bytes_to_ignore = 512 (* comparison_start_address program *) in Filecompare.(make_cmp_tool ~ignore:{bytes=bytes_to_ignore; lines=0}) diff --git a/ocamltest/ocaml_directories.ml b/ocamltest/ocaml_directories.ml index 8ec499349..9f1c84652 100644 --- a/ocamltest/ocaml_directories.ml +++ b/ocamltest/ocaml_directories.ml @@ -24,7 +24,7 @@ let stdlib = Filename.make_path [srcdir; "stdlib"] let libunix = - let subdir = if Sys.os_type="Win32" then "win32unix" else "unix" in + let subdir = if Sys.win32 then "win32unix" else "unix" in Filename.make_path [srcdir; "otherlibs"; subdir] let toplevel = diff --git a/ocamltest/ocaml_modifiers.ml b/ocamltest/ocaml_modifiers.ml index c310cf362..ae3ad8d33 100644 --- a/ocamltest/ocaml_modifiers.ml +++ b/ocamltest/ocaml_modifiers.ml @@ -79,7 +79,7 @@ let testing = make_library_modifier let tool_ocaml_lib = make_module_modifier "lib" (compiler_subdir ["testsuite"; "lib"]) -let unixlibdir = if Sys.os_type="Win32" then "win32unix" else "unix" +let unixlibdir = if Sys.win32 then "win32unix" else "unix" let unix = make_library_modifier "unix" (compiler_subdir ["otherlibs"; unixlibdir]) diff --git a/ocamltest/ocamltest_stdlib.ml b/ocamltest/ocamltest_stdlib.ml index 90ba02a54..3ee6d104e 100644 --- a/ocamltest/ocamltest_stdlib.ml +++ b/ocamltest/ocamltest_stdlib.ml @@ -28,7 +28,7 @@ end module Filename = struct include Filename - let path_sep = if Sys.os_type="Win32" then ";" else ":" + let path_sep = if Sys.win32 then ";" else ":" (* This function comes from otherlibs/win32unix/unix.ml *) let maybe_quote f = if String.contains f ' ' || @@ -43,7 +43,7 @@ module Filename = struct let make_path components = List.fold_left Filename.concat "" components let mkexe = - if Sys.os_type="Win32" + if Sys.win32 then fun name -> make_filename name "exe" else fun name -> name end diff --git a/ocamltest/run_command.ml b/ocamltest/run_command.ml index 1a1df6147..5819fa662 100644 --- a/ocamltest/run_command.ml +++ b/ocamltest/run_command.ml @@ -32,7 +32,7 @@ type settings = { let settings_of_commandline ?(stdout_fname="") ?(stderr_fname="") commandline = let words = String.words commandline in let quoted_words = - if Sys.os_type="Win32" + if Sys.win32 then List.map Filename.maybe_quote words else words in {