Skip to content

opam file generation and test selection  #3792

@Ninjapouet

Description

@Ninjapouet

Hi,

I have the following situation and I wonder if I missed something or if it needs some feature request. In a repository with the following layout:

  • a lib package definition (A-lib)
  • a binary package definition (A-bin) depending on (A-lib)
  • Tests definitions for the lib using .expected stuff and cram test for the binary package.
    Alas, I've never figured out how to tell dune that @runtest should run the corresponding package test suite.

Using the (deps (package A-bin)) in (cram) doesn't work for a clean opam install A-lib -t complains about missing A-bin. I tried to add (depends (A-bin :with-test)) in A-lib package definition, thinking that running test may be postponed after package installation, but dune complains with a circular dependency A-lib -> A-bin -> A-lib.

I tried to play with the (enable_if) of the (cram) stanza but it seems to be not expressive enough to specify the target package (or i don't understand how at least).

I see that I can write some .opam.template overriding the with-test build command to run specific runtest command on some sub directories to split the tests properly but I feel uncomfortable to write .opam files manually with a build system that can generate them...

Of course, I can split the repository in two but again, i feel that's not very clever as the two packages share stuff.

Do you have any clean solution to this issue or does it need some feature request ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions