How to define “sub-aliases” of runtest

I am trying to define tests specific to Wasm and others specific to Javascript. I have tried the following:

(rule
 (alias runtest-js)
 (action
  (run node %{dep:./link.bc.js})))

(rule
  (alias runtest-wasm)
  (action
    (run node %{dep:./link.bc.wasm.js})))

(alias
  (name runtest)
  (deps runtest-js runtest-wasm))

but Dune says:

$ dune build runtest
Error: No rule found for test/runtest-js
-> required by alias test/runtest in test/dune:31
Error: No rule found for test/runtest-wasm
-> required by alias test/runtest in test/dune:31

What am I missing?

Edit: I forgot to specify that the dune file I’m showing lives in the subdirectory test/.

1 Like

I would use the targets declaration instead of alias.

(deps (alias runtest-js) (alias runtest-wasm))

See Dependency Specification — Dune documentation for details.

Cheers,
Nicolas

This gives me an error:

$ dune build runtest
Error: Multiple rules generated for _build/default/test/runtest:
- test/dune:32
- test/dune:26

Dune does run the tests but still gives an error about multiple being generated for one file:

$ dune build @runtest
Error: Multiple rules generated for
_build/default/test/.test.inline-tests/partitions-js:
- test/dune:6
- test/dune:6
-> required by alias test/runtest in test/dune:8

where line 6 declares a library with inline tests. I’m not sure what to do here.