Skip to content

Commit

Permalink
Add test for strange behavior from #4786
Browse files Browse the repository at this point in the history
Signed-off-by: Rudi Grinberg <[email protected]>
  • Loading branch information
rgrinberg committed Jul 26, 2021
1 parent a1ea3dd commit 1062aec
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/blackbox-tests/test-cases/optional-executable.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,38 @@ The following command should fail because the executable is not optional:
^^^^^^^^^^^^^^
Error: Library "does-not-exist" not found.
[1]

A strange behavior discovered in #4786. Dune would ignore an executable if any
of its dependencies were optional.

$ mkdir optional-binary
$ cd optional-binary
$ cat >dune-project <<EOF
> (lang dune 3.0)
> (package (name myfoo))
> EOF

$ mkdir exe
$ cat >exe/bar.ml <<EOF
> print_endline "hello world"
> EOF
$ cat >exe/dune <<EOF
> (executable (public_name dunetestbar) (name bar) (libraries foo))
> EOF

$ mkdir lib
$ cat >lib/dune <<EOF
> (library (name foo) (libraries xxx-does-not-exist) (optional) (modules ()))
> EOF

$ cat >dune <<EOF
> (rule
> (alias run-x)
> (action (echo %{exe:bar.exe})))
> EOF

$ dune build @run-x
Error: No rule found for bar.exe
-> required by %{exe:bar.exe} at dune:3
-> required by alias run-x in dune:1
[1]

0 comments on commit 1062aec

Please sign in to comment.