Skip to content

Bad interaction between '(mode promote-until-clean)' and tests ran with '-p <pkg>' #4401

@Gbury

Description

@Gbury

Expected Behavior

When using a file (let's say test) that is "promoted until clean" as a dep for a test defined for a specific package foo, dune build @runtest -p foo should succeed.

Actual Behavior

dune build @runtest -p foo fails with Error: No rule found for test.
The conjunction of (mode promote-until-clean) and -p <pkg> seems to make dune "forget" about how to build some targets. I don't know if that is expected and if so, what is the correct way to do things.

Reproduction

See https://gist.github.com/Gbury/598f0b6f751767e8a66fe9c508704976

dune file:

(rule
  (target test)
  (mode promote-until-clean) ; without this, everything runs fine 
                             ; but with it, dune complains about "No rule found for test"
  (action (with-stdout-to %{target} (run echo foobar)))
)

(rule
  (alias runtest)
  (package foo)
  (deps (:test test))
  (action (diff %{test} reference))
)
  1. dune build @runtest succeeds as can be expected
  2. dune build @runtest -p foo fails with "Error: No rule found for test" (make sure to dune clean between attempts, particularly after a successful run)
  3. If the (mode promote-until-clean) is commented out, dune build @runtest -p foo succeeds

Specifications

  • Version of dune (output of dune --version): 2.8.4
  • Version of ocaml (output of ocamlc --version): 4.11.1
  • Operating system (distribution and version): archlinux 5.11.9-arch1-1

Additional information

In practice, this happens to me in the dolmen project (see e.g. this dune file), where a rule is defined to generate an updated version of menhir's error message file (which is promoted-until-clean, since it is meant to be used as a reference when updating the error messages after changing the grammar), and another rule is defined to use that file to check that all error states have an error message written.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions