Skip to content

Commit

Permalink
fix: respect (locks ..) in the (tests ..) stanza (ocaml#11081)
Browse files Browse the repository at this point in the history
For some reason, locks were ignored on (tests ..) unless they had output
to diff against

Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
  • Loading branch information
rgrinberg authored Nov 3, 2024
1 parent 45b4d22 commit 90fa237
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions doc/changes/11081.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Do not ignore the `(locks ..)` field in the `test` and `tests` stanza
(#11081, @rgrinberg)
10 changes: 5 additions & 5 deletions src/dune_rules/test_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ let rules (t : Tests.t) ~sctx ~dir ~scope ~expander ~dir_contents =
:: t.deps
| None -> t.deps
in
let add_alias ~loc ~action ~locks =
(* CR-rgrinberg: why are we going through the stanza api? *)
let add_alias ~loc ~action =
(* CR rgrinberg: why are we going through the stanza api? *)
let alias =
{ Alias_conf.name = runtest_alias
; locks
; locks = t.locks
; package = t.package
; deps
; action = Some (loc, action)
Expand All @@ -93,7 +93,7 @@ let rules (t : Tests.t) ~sctx ~dir ~scope ~expander ~dir_contents =
Simple_rules.alias sctx ~extra_bindings ~dir ~expander alias
in
match test_kind (loc, s, ext) with
| `Regular -> add_alias ~loc ~action:run_action ~locks:[]
| `Regular -> add_alias ~loc ~action:run_action
| `Expect diff ->
let rule =
{ Rule_conf.targets = Infer
Expand All @@ -110,7 +110,7 @@ let rules (t : Tests.t) ~sctx ~dir ~scope ~expander ~dir_contents =
; package = t.package
}
in
add_alias ~loc ~action:(Diff diff) ~locks:t.locks
add_alias ~loc ~action:(Diff diff)
>>> let+ (_ignored_targets : Targets.Validated.t option) =
Simple_rules.user_rule sctx rule ~extra_bindings ~dir ~expander
in
Expand Down

0 comments on commit 90fa237

Please sign in to comment.