Skip to content

Commit

Permalink
fix: respect (locks ..) in the (tests ..) stanza
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 <[email protected]>

<!-- ps-id: 11ae9e61-6276-495e-891e-dfea0ddccdf0 -->
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Nov 3, 2024
1 parent 3296b16 commit c79e19f
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 c79e19f

Please sign in to comment.