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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reftests: handle cygwin paths #5286

Closed
wants to merge 5 commits into from
Closed

Reftests: handle cygwin paths #5286

wants to merge 5 commits into from

Conversation

rjbou
Copy link
Collaborator

@rjbou rjbou commented Sep 15, 2022

Some windows paths were not prefixed with cygwin path, and then not catch by path regexp.
Also, for some tests we get PATH from environment that is in cygwin style while Sys.getcwd gives the windows style one. Add in BASEDIR regexp both style.

@rjbou rjbou added PR: QUEUED Pending pull request, waiting for other work to be merged or closed AREA:TEST labels Sep 15, 2022
@rjbou rjbou added this to the 2.2.0~alpha milestone Sep 15, 2022
@rjbou rjbou requested a review from dra27 September 15, 2022 20:07
@rjbou rjbou added this to PR in progress in Opam 2.2.0 via automation Sep 15, 2022
@rjbou rjbou added this to PR in Out of release : doc, test, install, etc. via automation Sep 15, 2022
@rjbou rjbou removed the PR: QUEUED Pending pull request, waiting for other work to be merged or closed label Sep 20, 2022
@rjbou rjbou moved this from PR in progress to PR to review in Opam 2.2.0 Sep 27, 2022
Copy link
Member

@dra27 dra27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the effect on the tests! Some possible tweaks to exactly what we do with the paths

tests/reftests/run.ml Outdated Show resolved Hide resolved
OpamSystem.read_command_output ([ "cygpath" ] @ args)
with
| x::_ when not (String.equal x "") && f x ->
Some OpamSystem.(back_to_forward x, forward_to_back x)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels slightly over-kill. cygpath -u will always return forward-slashes and cygpath -w will always return back-slashes.

(* Some outputs contain both Windows-like path C:\ and cygwin-like path /cygdrive/c *)
let cygwinpath =
match get_cygwinpath dir with
| Some (cwp_fwd, cwp_bck) -> [ str cwp_fwd ; str cwp_bck ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should further normalise Cygwin-paths containing backslashes (that feels like an error somewhere)

in
let winpath =
match get_winpath dir with
| Some (wp_fwd, wp_bck) -> [ str wp_fwd ; str wp_bck ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like us to get to the stage where we only see properly formatted Windows paths, but supporting all \ and all / but not mixed seems a little strange. How about this instead: we know that get_winpath will return only backslashes, so we can split the string on \ and then construct seq [ component1 (set "\\/") component2 (set "\\/") .. ]?

Co-authored-by: David Allsopp <david.allsopp@metastack.com>
@kit-ty-kate kit-ty-kate added this to PR in Progress in Opam 2.3 via automation Mar 14, 2023
@kit-ty-kate kit-ty-kate removed this from PR to review in Opam 2.2.0 Mar 14, 2023
@kit-ty-kate kit-ty-kate removed this from the 2.2.0~alpha milestone Mar 14, 2023
@rjbou
Copy link
Collaborator Author

rjbou commented Dec 12, 2023

supersede by #5723

@rjbou rjbou closed this Dec 12, 2023
Opam 2.3 automation moved this from PR in Progress to Done Dec 12, 2023
Out of release : doc, test, install, etc. automation moved this from PR to done Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants