Skip to content

reftest: add '.install' exhaustive test for all fields - #6956

Merged
kit-ty-kate merged 2 commits into
ocaml:masterfrom
rjbou:reftest-dot-install
Jul 11, 2026
Merged

reftest: add '.install' exhaustive test for all fields#6956
kit-ty-kate merged 2 commits into
ocaml:masterfrom
rjbou:reftest-dot-install

Conversation

@rjbou

@rjbou rjbou commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

#6938 add new field to .install files, there was no exhaustive test.
The tests are 3 files:

  • a cross platform test for non executable fields
  • 2 per platform tests for executable fields (it differs from win to nux)
    Note: the windows test highlights some bugs, issues will be opened

@rjbou rjbou added this to the 2.6.0~alpha1 milestone Jun 5, 2026
@rjbou
rjbou requested a review from NathanReb June 5, 2026 17:16
### OPAMYES=1
### # we neeed the precise tracking to have a sha in changes file instead of timestamp
### OPAMPRECISETRACKING=1
### OPAMDEBUGSECTIONS="TRACK ACTION SYSTEM"

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.

I'm not sure if it worth having the SYSTEM logging

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.

I think that we can indeed make it so that the cat.ml script provides the information we need, that would make the whole test shorter and easier to understand!

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.

I've removed the SYSTEM log, we don't necessarily need to see all the system access

SYSTEM write ${BASEDIR}/OPAM/sw-misc/.opam-switch/build/pkg-misc.1/pkg-misc.install
[WARNING] Errors in ${BASEDIR}/OPAM/sw-misc/.opam-switch/build/pkg-misc.1/pkg-misc.install, some fields have been ignored:
- At ${BASEDIR}/OPAM/sw-misc/.opam-switch/build/pkg-misc.1/pkg-misc.install:1:8-1:20::
expected abs-filename

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.

Comment for issue : the error can be better here

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.

issue #6958

Comment on lines +3403 to +3404
[ERROR] In ${BASEDIR}/OPAM/sw-man/.opam-switch/build/pkg-man.1/pkg-man.install:
Not_found

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.

We should fail gracefully

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.

issue #6959

@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 current logging level makes it quite hard to read the test. Are we testing something that's only shown in the logs or are the resulting install and/or errors enough?

Can't some of those tests be merged? E.g. the basic case turned into a single pkg which successfully install a file for each field?

### OPAMPRECISETRACKING=1
### OPAMDEBUGSECTIONS="TRACK ACTION SYSTEM"
### # Printer of `changes` file and the installed file 'finstalled' in switch (or root)
### <cat.ml>

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.

Don't we have a way to write this small utility script separately and use it from the reftest? We could make it a dune executable and add an explicit dependency. That would make later modification or debug of the script easier. Would also ease the review/reading of the script itself.

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.

It might at least be worth a small comment for each function of the script!

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.

cat.ml is specific to this test, it can not be externalised. Some of its function could. Updated with comments

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.

I simplified cat.ml to avoid rewriting other utilities that we already have, like opam-cat

"lib|pkg-lib|finstalled" {"F:a611026bf7b99362c57473c4e1ef30a0"}
]
==> ${BASEDIR}/OPAM/sw-lib/lib/pkg-lib/finstalled
### OPAMDEBUG=-5 opam remove pkg-lib | grep -v LOCK

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.

Is this is just a post test clean up? If so how about disabling the logs in the output to avoid polluting the test?

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.

It is not cleanup, it checks that the installed files are well removed

### OPAMYES=1
### # we neeed the precise tracking to have a sha in changes file instead of timestamp
### OPAMPRECISETRACKING=1
### OPAMDEBUGSECTIONS="TRACK ACTION SYSTEM"

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.

I think that we can indeed make it so that the cat.ml script provides the information we need, that would make the whole test shorter and easier to understand!

@rjbou

rjbou commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

Can't some of those tests be merged? E.g. the basic case turned into a single pkg which successfully install a file for each field?

It was my first attempt, but special cases came quite quickly (for misc & man). Having a test case per field permit to see more specifically the changes if they are (on a given field), and helps on specific cases testing (imo).

@rjbou

rjbou commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

PR updated. There is a remaining issue with +x flag on windows i think

@rjbou
rjbou requested a review from NathanReb June 24, 2026 09:50
Comment thread tests/reftests/dot-install-all-fields.test Outdated
Comment thread tests/reftests/dot-install-all-fields.test Outdated
Comment thread tests/reftests/dot-install-all-fields.test Outdated
Comment thread tests/reftests/dot-install-non-exe-fields.test
Comment thread tests/reftests/dot-install-all-fields.test Outdated
@rjbou

rjbou commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Updated, main comment updated too

ACTION Removing the local metadata
Done.
### opam-cat OPAM/sw-bin/.opam-switch/install/pkg-bin.changes
# OPAM/sw-bin/.opam-switch/install/pkg-bin.changes not found

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.

On removal, the installed file is not removed. Issue #7021

TRACK before install: 1 elements scanned in 0.000s
ACTION Installing pkg-libexec.1.

ACTION creating ${BASEDIR}/OPAM/sw-libexec/lib/pkg-libexec

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.

There is also this failure on libexec field... issue #7022

@kit-ty-kate
kit-ty-kate force-pushed the reftest-dot-install branch from 6b34ec2 to 6a1eeeb Compare July 10, 2026 23:02
@kit-ty-kate
kit-ty-kate merged commit ec4489f into ocaml:master Jul 11, 2026
41 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