Stream: Dune devs & users

Topic: Executable only used for testing


view this post on Zulip Karl Palmskog (Jun 16 2020 at 21:16):

So I have an executable only used for testing that uses extracted code. This makes an otherwise pure-OCaml project suddenly depend on a Coq library. Is there an obvious way to make sure the executable is only built when doing dune -p myproj runtests? I don't want everyone to have to install the Coq library just to install the OCaml project, unless they actually want to run the tests.

view this post on Zulip Rudi Grinberg (Jun 16 2020 at 22:07):

Karl Palmskog said:

So I have an executable only used for testing that uses extracted code. This makes an otherwise pure-OCaml project suddenly depend on a Coq library. Is there an obvious way to make sure the executable is only built when doing dune -p myproj runtests? I don't want everyone to have to install the Coq library just to install the OCaml project, unless they actually want to run the tests.

What about just excluding the test from your OCaml package? If the tests aren't part of @install, then dune -p would not build them

view this post on Zulip Karl Palmskog (Jun 16 2020 at 22:20):

ah, I see, so basically one doesn't expose the test externally at all, I guess this is indeed an option, thanks.


Last updated: Oct 16 2021 at 07:02 UTC