Skip to content

Reftests add repository layout test - #6941

Merged
kit-ty-kate merged 3 commits into
ocaml:masterfrom
rjbou:reftests-repository-formats
Jul 3, 2026
Merged

Reftests add repository layout test#6941
kit-ty-kate merged 3 commits into
ocaml:masterfrom
rjbou:reftests-repository-formats

Conversation

@rjbou

@rjbou rjbou commented May 20, 2026

Copy link
Copy Markdown
Collaborator

Add a test that shows the handled paths for opam packages, how and if they are read or processed by opam client (update & admin commands).

This mechanism was reworked by #6614 that introduced incremental loading (from diff instead of reading again the whole repository).

It highlights and permit to follow some errors that were unseen during #6614 and that are resolved by #6871 & #6924 (previous handled paths are seen in first commit[1]).

This PR adds the test, that is good to have before #6625 rewriting, to ensure non change on behaviour (even if erroneous).
However, in this PR we change a little bit the behaviour: first by adding a new logging to differentiate load from dir & load from diff calls ; and we sort the files read from disk during loading from dir to ensure an cross system reftest output (especially with ---strict that error at the first error encountered).

It also fixes a bug, a different behaviour between Unix & Windows. Stdlib open_in functions opens directories on Unix but error on Windows. Now, OpamSystem.open_in* error on all platforms if the filename is a directory.

[1] The first commit is here for my personal use. It will be removed from the final version., it higlights the output of the test before before incremental loading merge (at commit f370351). It will be removed on merge. The commit that contains the result of the reftest before incremental loading is in on top of the branch rjbou/bef-load-from-diff-reftests-repository-layout

In the story of #6625
Queued on #6995

@rjbou
rjbou requested a review from NathanReb May 20, 2026 18:04

@NathanReb NathanReb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The test is quite large and I wonder if a slightly different structure could improve its readability and eventually even eliminate some duplication, potentially reducing the overall size.

Currently, if we leave out section IV, the test is roughly organised by setting up a repo with every layout under test (e.g. packages/good/good.1/opam or packages/direct-root.1/opam) and then run commands that will show the behaviour on each individual layout at once.

I'd like to suggest trying the opposite, i.e. for each layout run all the commands we want, describing how it should behave for said layout and then showing how it actually behaves in the commands output.
That would allow to reduce the size of the commands output (especially with the debug logs, its hard to keep track of everything) and keep everything closer to the documentation/comments that are relevant to this particular test.

That would also allow to describe what the layout actually are which could clear out some cases that may look like unintentional typos such as packages/i/n/e/r/very-inned-n-nv/very-inner-n-nv.1 where very-inned-n-nv VS very-inner-n-nv.1 could either be a typo or part of the test.

I suspect that trying out such a structure might show that some layouts actually exhibit the same behaviour because they go through the same code path in certain situations.

What do you think?

Comment thread tests/reftests/repository-layout.test Outdated
Comment thread src/state/opamRepositoryState.ml Outdated
Comment thread tests/reftests/repository-layout.test Outdated
Comment thread tests/reftests/repository-layout.test Outdated
Comment thread tests/reftests/repository-layout.test Outdated
Comment thread tests/reftests/repository-layout.test Outdated
Comment thread tests/reftests/repository-layout.test Outdated
Comment thread tests/reftests/repository-layout.test Outdated
Comment thread tests/reftests/repository-layout.test Outdated
@rjbou

rjbou commented May 21, 2026

Copy link
Copy Markdown
Collaborator Author

I like the idea!

Comment thread src/state/opamRepositoryState.ml Outdated
@rjbou

rjbou commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

Updated with the new structure.
The first commit is still to remove before merge

@rjbou
rjbou force-pushed the reftests-repository-formats branch from 558aebf to dba840b Compare June 23, 2026 15:09
@rjbou
rjbou requested a review from NathanReb June 23, 2026 15:09
@rjbou
rjbou force-pushed the reftests-repository-formats branch from dba840b to 44ff6c8 Compare June 24, 2026 08:24
Comment thread tests/reftests/repository-layout.test
Comment thread tests/reftests/repository-layout.test Outdated
@rjbou
rjbou force-pushed the reftests-repository-formats branch from 44ff6c8 to 148177f Compare July 2, 2026 14:58
@rjbou
rjbou requested a review from kit-ty-kate July 2, 2026 15:10
@rjbou

rjbou commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator Author

Updated, and updated the main comment

@rjbou
rjbou force-pushed the reftests-repository-formats branch from 148177f to 0b57219 Compare July 2, 2026 15:33
@kit-ty-kate
kit-ty-kate force-pushed the reftests-repository-formats branch from 0b57219 to bf1e1d4 Compare July 2, 2026 16:22
@kit-ty-kate kit-ty-kate added PR: QUEUED Pending pull request, waiting for other work to be merged or closed AREA: TEST labels Jul 2, 2026
@kit-ty-kate kit-ty-kate added this to the 2.6.0~alpha1 milestone Jul 2, 2026
Comment thread tests/reftests/repository-layout.test Outdated
### # we add change in opam.xxx
### sh -c "echo >> REPO/packages/wrong-opamf-updated/wrong-opamf-updated.1/opam.xxx"
### :C:1: Update of repositories
### OPAMDEBUGSECTIONS="FILE(opam) opam-file RSTATE UPDATE" OPAMDEBUG=-3 opam update default-strict --strict | unordered

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

are the | unordered still useful after the addition of the Array.sort?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

nop

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

i've removed them. Let's see if it's indeed the case everywhere

@kit-ty-kate
kit-ty-kate force-pushed the reftests-repository-formats branch from bf1e1d4 to b2b8534 Compare July 3, 2026 11:40
@kit-ty-kate kit-ty-kate removed the PR: QUEUED Pending pull request, waiting for other work to be merged or closed label Jul 3, 2026
@kit-ty-kate

Copy link
Copy Markdown
Member

Ignoring ocaml-benchmarks

@kit-ty-kate
kit-ty-kate merged commit cafa61b into ocaml:master Jul 3, 2026
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants