Skip to content

Commit

Permalink
Merge pull request #5723 from dra27/reftest-windows
Browse files Browse the repository at this point in the history
reftest engine tweaks for Windows
  • Loading branch information
rjbou committed Dec 7, 2023
2 parents bb1400b + e9c70b6 commit db79051
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 3 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ users)
### Tests

### Engine
* Set `SHELL` to `/bin/sh` in Windows to ensure `opam env` commands are consistent [#5723 @dra27]
* Substitution for `BASEDIR` and `OPAMTMP` now recognise the directory with either forward-slashes, back-slashes, or converted to Cygwin notation (i.e. C:\cygwin64\tmp\..., C:/cygwin64/tmp/..., or /tmp/...) [#5723 @dra27]

## Github Actions

Expand All @@ -117,3 +119,4 @@ users)
## opam-format

## opam-core
* `OpamSystem.apply_cygpath`: runs `cygpath` over the argument [#5723 @dra27 - function itself added in #3348]
5 changes: 5 additions & 0 deletions src/core/opamSystem.mli
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ val get_cygpath_function: command:string -> (string -> string) lazy_t
list, by giving the `--path` argument in the last case. *)
val get_cygpath_path_transform: (pathlist:bool -> string -> string) lazy_t

(** [apply_cygpath path] applies the `cygpath` command to [name] using
`cygpath -- name`. `cygpath` is resolved with default environment
in the function. *)
val apply_cygpath: string -> string

(** [command cmd] executes the command [cmd] in the correct OPAM
environment. *)
val command: ?verbose:bool -> ?env:string array -> ?name:string ->
Expand Down
11 changes: 8 additions & 3 deletions tests/reftests/run.ml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ let base_env =
propagate "TMPDIR" @
propagate "TMP" @
propagate "TEMP" @
(if Sys.win32 then ["SHELL", "/bin/sh"] else []) @
[
"OPAMKEEPBUILDDIR", "1";
"OPAMCOLOR", "never";
Expand Down Expand Up @@ -540,6 +541,11 @@ let parse_command = Parse.command
let common_filters ?opam dir =
let tmpdir = OpamSystem.real_path (Filename.get_temp_dir_name ()) in
let open Re in
let dir_to_regex dir =
if Sys.win32 then
[str dir; str (OpamSystem.back_to_forward dir); str (OpamSystem.apply_cygpath dir)]
else
[str dir] in
[
seq [ bol;
alt [ str "#=== ERROR";
Expand All @@ -553,11 +559,10 @@ let common_filters ?opam dir =
GrepV;
seq [bol; str cmd_prompt],
Sed "##% ";
alt [str dir; str (OpamSystem.back_to_forward dir)],
alt (dir_to_regex dir),
Sed "${BASEDIR}";
seq [
alt [str tmpdir;
str (OpamSystem.back_to_forward tmpdir)];
alt (dir_to_regex tmpdir);
rep (set "/\\");
str "opam-";
rep1 (alt [xdigit; char '-'])],
Expand Down

0 comments on commit db79051

Please sign in to comment.