# Dune aliasing one executable over another

**URL:** <https://discuss.ocaml.org/t/dune-aliasing-one-executable-over-another/6046>\
**Category:** Learning\
**Tags:** dune\
**Created:** [July 1, 2020, 2:41pm UTC](https://discuss.ocaml.org/t/dune-aliasing-one-executable-over-another/6046 "2020-07-01T14:41:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cjen1](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/cjen1/32/1731_2.png) [@Cjen1](https://discuss.ocaml.org/u/Cjen1)\
**Post date:** [July 1, 2020, 2:41pm UTC](https://discuss.ocaml.org/t/dune-aliasing-one-executable-over-another/6046/1 "2020-07-01T14:41:13Z")

</div>

I’m working on testing within [https://github.com/Cjen1/OcamlPaxos/tree/paxos\_core](https://github.com/Cjen1/OcamlPaxos/tree/paxos_core).

The issue is that for that version if I run `dune exec test/paxos_core.exe` it actually runs `test/log.ml`.

Investigating further if I remove all the tests from `test/paxos_core.ml` (but not `Alcotest_lwt.run`) this effect disappears, additionally if I remove the `Alcotest_lwt.run` from `test/log.ml` it also disappears.

This is being built on `dune 2.6.0` and `ocaml 4.10.0`.

To build the repo clone/pin [github.com/cjen1/master](http://github.com/cjen1/master), the rest should be git submodules.

---

<div class="post-metadata">

**Author:** ![CraigFe](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/craigfe/32/1989_2.png) [@CraigFe](https://discuss.ocaml.org/u/CraigFe)\
**Post date:** [July 1, 2020, 5:26pm UTC](https://discuss.ocaml.org/t/dune-aliasing-one-executable-over-another/6046/2 "2020-07-01T17:26:13Z")

</div>

> [@Cjen1](#):
>
> Investigating further if I remove all the tests from `test/paxos_core.ml` (but not `Alcotest_lwt.run` ) this effect disappears, additionally if I remove the `Alcotest_lwt.run` from `test/log.ml` it also disappears.

By default, Alcotest runs `exit` at the end of a test suite. That’s possibly part of what’s going on here.

You may want to try passing `~and_exit:false` to both instances of `run` to see if this behaviour changes.

---

<div class="post-metadata">

**Author:** ![Cjen1](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/cjen1/32/1731_2.png) [@Cjen1](https://discuss.ocaml.org/u/Cjen1)\
**Post date:** [July 1, 2020, 6:16pm UTC](https://discuss.ocaml.org/t/dune-aliasing-one-executable-over-another/6046/3 "2020-07-01T18:16:19Z")

</div>

Thanks! That revealed the problem - it was executing both tests!

One of the test modules is named `Log` and one of the library modules was also called `Log`. By removing an `open Ocamlpaxos` at the top and then qualifying all the `Log`'s that has fixed it.

I think that dune was pulling in any named modules to the executable and hence it had not only the `test/paxos_core.ml` module but also the `test/log.ml` module.

I’m not sure if this is expected behavior though? (though I can also imagine it being impossible to fix…)
