Skip to content

test: Surprising behaviour on anonymous actions with multiple aliases - #15590

Merged
rgrinberg merged 2 commits into
ocaml:mainfrom
NatKarmios:anon-action-multi-alias-test
Jul 24, 2026
Merged

test: Surprising behaviour on anonymous actions with multiple aliases#15590
rgrinberg merged 2 commits into
ocaml:mainfrom
NatKarmios:anon-action-multi-alias-test

Conversation

@NatKarmios

Copy link
Copy Markdown
Contributor

Related to #15576 & #15581

Adds 3 tests for anonymous actions with multiple aliases, specifically:

  • Building one of an action's aliases can pull in another alias
  • Duplicating or re-ordering aliases in a rule does not cause a re-run

Note that all these tests currently fail, but are fixed by #15581:

Test results
File "test/blackbox-tests/test-cases/alias/alias-multiple.t", line 1, characters 0-0:
------ test/blackbox-tests/test-cases/alias/alias-multiple.t
++++++ test/blackbox-tests/test-cases/alias/alias-multiple.t.corrected
File "test/blackbox-tests/test-cases/alias/alias-multiple.t", line 139, characters 0-1:
 |
 |A rule attached to several aliases must not make one alias pull in unrelated
 |contributions to another alias. Here alias [a] also receives an unrelated
 |action; building [b] must run only the shared action.
 |  $ cat > dune << EOF
 |  > (rule
 |  >  (aliases a b)
 |  >  (action (echo "I have run\n")))
 |  > (rule
 |  >  (alias a)
 |  >  (action (echo "unrelated\n")))
 |  > EOF
 |
 |  $ dune clean
 |  $ dune build @b
 |  I have run
+|  unrelated
 |
 |Building [a] still runs both the shared action and the action attached only
 |to [a].
 |  $ dune clean
 |  $ dune build @a
 |  I have run
 |  unrelated
 |
 |The set of aliases determines the action's identity: neither duplicating an
 |alias nor reordering the aliases should re-run the action.
 |
 |Duplicating an alias does not re-run the action:
 |  $ cat > dune << EOF
 |  > (rule
 |  >  (aliases a)
 |  >  (action (echo "I have run\n")))
 |  > EOF
 |  $ dune clean
 |  $ dune build @a
 |  I have run
 |  $ cat > dune << EOF
 |  > (rule
 |  >  (aliases a a)
 |  >  (action (echo "I have run\n")))
 |  > EOF
 |  $ dune build @a
+|  Error: Dependency cycle between:
+|     alias a in dune:1
+|  [1]
 |
 |Reordering the aliases does not re-run the action:
 |  $ cat > dune << EOF
 |  > (rule
 |  >  (aliases a b)
 |  >  (action (echo "I have run\n")))
 |  > EOF
 |  $ dune clean
 |  $ dune build @a @b
 |  I have run
 |  $ cat > dune << EOF
 |  > (rule
 |  >  (aliases b a)
 |  >  (action (echo "I have run\n")))
 |  > EOF
 |  $ dune build @a @b
+|  I have run

Signed-off-by: Nat Karmios <nat@karmios.com>
@Alizter

Alizter commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Can you promote the failing output so that they still "succeed" in the CI? The goal of cram tests should always be snapshotting the current behaviour of dune, you can use cram test prose to comment on it and point out if it should be different and why.

@Alizter
Alizter requested a review from rgrinberg July 23, 2026 07:33
Signed-off-by: Nat Karmios <nat@karmios.com>
@NatKarmios
NatKarmios force-pushed the anon-action-multi-alias-test branch from 2edabd2 to 090a5b0 Compare July 23, 2026 10:18
@NatKarmios

Copy link
Copy Markdown
Contributor Author

Can you promote the failing output so that they still "succeed" in the CI? The goal of cram tests should always be snapshotting the current behaviour of dune, you can use cram test prose to comment on it and point out if it should be different and why.

Sure, done.

@rgrinberg
rgrinberg merged commit 1bdc60d into ocaml:main Jul 24, 2026
35 of 36 checks passed
@Alizter Alizter added this to the 3.25.0 milestone Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants