Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that a test stanza is disabled before generating the rules #6134

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
3.5.0 (unreleased)
------------------

- Check if a `tests` stanza is disabled before generating the rules (#6134,
fixes #6132, @voodoos)

- Shadow alias module `Foo__` when building a library `Foo` (#6126, @rgrinberg)

- Allow dune describe workspace to accept directories as arguments.
Expand Down
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
22 changes: 22 additions & 0 deletions test/blackbox-tests/test-cases/tests-stanza/github6132.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$ cat >dune-project <<EOF
voodoos marked this conversation as resolved.
Show resolved Hide resolved
> (lang dune 3.0)
> EOF

$ cat >dune <<EOF
> (test
> (name missing_test)
> (modules missing_test)
> (enabled_if false)
> (libraries lib_not))
>
> (library
> (name lib_not)
> (modules lib_not)
> (enabled_if false))
> EOF
$ touch missing_test.ml

The test [missing_test] depends on a library that is disabled, but that should
not trigger any error since the test itself is disabled in the same way as the
library it depends on.
$ dune build @all