Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

reftest engine tweaks for Windows #5723

Merged
merged 3 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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