Skip to content

Commit

Permalink
Check tests stanza 's enabled status first
Browse files Browse the repository at this point in the history
This is what is done for executables: no rule is generated if the enabled_if field evaluates to false.
  • Loading branch information
voodoos committed Sep 7, 2022
1 parent 5037267 commit d9e2a44
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
21 changes: 12 additions & 9 deletions src/dune_rules/gen_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,18 @@ end = struct
| Alias alias ->
let+ () = Simple_rules.alias sctx alias ~dir ~expander in
empty_none
| Tests tests ->
let+ cctx, merlin =
Test_rules.rules tests ~sctx ~dir ~scope ~expander ~dir_contents
in
{ merlin = Some merlin
; cctx = Some (tests.exes.buildable.loc, cctx)
; js = None
; source_dirs = None
}
| Tests tests -> (
Expander.eval_blang expander tests.enabled_if >>= function
| false -> Memo.return empty_none
| true ->
let+ cctx, merlin =
Test_rules.rules tests ~sctx ~dir ~scope ~expander ~dir_contents
in
{ merlin = Some merlin
; cctx = Some (tests.exes.buildable.loc, cctx)
; js = None
; source_dirs = None
})
| Copy_files { files = glob; _ } ->
let* source_dirs =
let loc = String_with_vars.loc glob in
Expand Down
7 changes: 0 additions & 7 deletions test/blackbox-tests/test-cases/tests-stanza/github6132.t
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,4 @@
> EOF
$ touch missing_test.ml

FIXME: both the missing_test and lib_not are disabled so this error could be
ignored.
$ dune build @all
File "dune", line 9, characters 10-17:
9 | (modules lib_not)
^^^^^^^
Error: Module Lib_not doesn't exist.
[1]

0 comments on commit d9e2a44

Please sign in to comment.