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

Fix opamroot-versions.test glitch #5007

Merged
merged 2 commits into from
May 18, 2022
Merged

Fix opamroot-versions.test glitch #5007

merged 2 commits into from
May 18, 2022

Conversation

AltGr
Copy link
Member

@AltGr AltGr commented Jan 19, 2022

I had to use [)] to escape rather than \\), because backslashes interfere
with the windows-path rewrite rules...

@kit-ty-kate
Copy link
Member

Can’t we simply have a special rules that says "if we have a variable inside the regexp part, then take it as a static string and not as a regexp" ?

@AltGr
Copy link
Member Author

AltGr commented Jan 19, 2022

yes, that would be better, but more tedious to implement

@@ -938,12 +938,12 @@ opam-version: "2.0"
roots: ["i-am-package.2" "i-am-sys-compiler.2"]
### :V:1:e: reinit from 2.0
### ocaml generate.ml 2.0
### opam init --reinit --bypass-checks --no-setup | "(${OPAMROOTVERSION})" -> "current"
### opam init --reinit --bypass-checks --no-setup | "[ (]${OPAMROOTVERSION}($|[ ,)])" -> " current"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
### opam init --reinit --bypass-checks --no-setup | "[ (]${OPAMROOTVERSION}($|[ ,)])" -> " current"
### opam init --reinit --bypass-checks --no-setup

Why not simply remove theme all together? We can simply update the tests when we bump the opam-root-version

Copy link
Collaborator

Choose a reason for hiding this comment

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

the idea of c41b8da in #4913 is to not have to bump the test at each opam-root-version bump

Copy link
Collaborator

Choose a reason for hiding this comment

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

well, to make the update minimal, here is a example of update for bump

Copy link
Member

Choose a reason for hiding this comment

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

i think it would be fine. It’s just one dune runtest --auto-promote away so I don’t see any downsides removing these. I only see downsides keeping them in

Copy link
Collaborator

Choose a reason for hiding this comment

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

The new output is not just taken as is, it need to be checked, updated, etc. ; and by reduced the diffs, it's simpler.
I'm missing the downsides of keeping them ? the regexp issue is fixed by #5009

Copy link
Member

Choose a reason for hiding this comment

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

Keeping it you have to maintain them (e.g. what this PR is trying to do) and it makes it harder for us to read the reftests (e.g. you can’t tell if "current" comes from the sed or from whatever in opam) Also sometimes you might want something to not change for whatever reason and making it not change makes it harder to check that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

For the name of the replacement, we can use another word that is not used and not meant to be used in opam, like current-opamroot-version-for-test that is human readable and should appear in opam messages (or if we are all in a hurry at that moment, but there will be more serious concerns than this test in that case :D).
For maintenance, reftests evolve, reftests engine evolves too. Something was merged with a buggy behaviour that nobody saw. My thought on keeping it is to try to have both world: fixed bug & enhanced reftest (ideally stable).
I agree with the no change that hide issues, It went into rabbit hole when debugging rec pin on windows with reftest because I didn't take into account path rewriting on reftest output. Maybe mistakenly, but here I assume that hiding is not so bug prone as it is consistent with the defined opam root version (the variable is set using opam output), and if something is broken in this test it's not just the version that will be changed, other lines will be highlighted in the diff.

Copy link
Member Author

Choose a reason for hiding this comment

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

We're all overthinking this :D
Not certain it's worth it, but now that it's done let's merge, we keep our hands free to simplify in case of problems in the future.

@kit-ty-kate kit-ty-kate added the PR: WIP Not for merge at this stage label Jan 20, 2022
@dra27 dra27 added this to PR in progress in Opam 2.2.0 via automation May 17, 2022
@dra27 dra27 removed the PR: WIP Not for merge at this stage label May 17, 2022
AltGr and others added 2 commits May 18, 2022 12:09
I had to use `[)]` to escape rather than `\\)`, because backslashes interfere
with the windows-path rewrite rules...
@rjbou rjbou moved this from PR in progress to PR finalised (merge with CI) in Opam 2.2.0 May 18, 2022
@rjbou rjbou merged commit d633e59 into ocaml:master May 18, 2022
Opam 2.2.0 automation moved this from PR finalised (merge with CI) to Done May 18, 2022
@rjbou rjbou added this to the 2.2.0~alpha milestone Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Opam 2.2.0
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants