diff --git a/test/blackbox-tests/dune.inc b/test/blackbox-tests/dune.inc index f131272e0e1e..23f95e4f8cc8 100644 --- a/test/blackbox-tests/dune.inc +++ b/test/blackbox-tests/dune.inc @@ -1763,6 +1763,14 @@ test-cases/windows-diff (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) +(alias + (name with-exit-codes) + (deps (package dune) (source_tree test-cases/with-exit-codes)) + (action + (chdir + test-cases/with-exit-codes + (progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected))))) + (alias (name with-stdin-from) (deps (package dune) (source_tree test-cases/with-stdin-from)) @@ -2015,6 +2023,7 @@ (alias vlib-default-impl) (alias vlib-wrong-default-impl) (alias windows-diff) + (alias with-exit-codes) (alias with-stdin-from) (alias workspace-paths) (alias workspaces) @@ -2209,6 +2218,7 @@ (alias vlib-default-impl) (alias vlib-wrong-default-impl) (alias windows-diff) + (alias with-exit-codes) (alias with-stdin-from) (alias workspace-paths) (alias workspaces) diff --git a/test/blackbox-tests/test-cases/with-exit-codes/run.t b/test/blackbox-tests/test-cases/with-exit-codes/run.t new file mode 100644 index 000000000000..0e1f24c850ea --- /dev/null +++ b/test/blackbox-tests/test-cases/with-exit-codes/run.t @@ -0,0 +1,48 @@ + $ cat > dune-project < (lang dune 2.0) + > EOF + + $ cat > dune < (alias + > (name a) + > (action (with-exit-codes 0 (run false)))) + > EOF + + $ dune build --display=short --root . @a + false alias a (exit 1) + (cd _build/default && /usr/bin/false) + [1] + + $ cat >> dune < (alias + > (name b) + > (action (with-exit-codes (not 0) (run false)))) + > EOF + + $ dune build --display=short --root . @b + false alias b + + $ cat >> dune < (executable + > (name exit) + > (modules exit)) + > (rule (with-stdout-to exit.ml (echo "let () = exit (int_of_string Sys.argv.(1))"))) + > (alias + > (name c) + > (action (with-exit-codes (or 1 2 3) (run ./exit.exe 2)))) + > (alias + > (name d) + > (action (with-exit-codes (or 4 5 6) (run ./exit.exe 7)))) + > EOF + + $ dune build --display=short --root . @c + ocamldep .exit.eobjs/exit.ml.d + ocamlc .exit.eobjs/byte/dune__exe__Exit.{cmi,cmo,cmt} + ocamlopt .exit.eobjs/native/dune__exe__Exit.{cmx,o} + ocamlopt exit.exe + exit alias c + + $ dune build --display=short --root . @d + exit alias d (exit 7) + (cd _build/default && ./exit.exe 7) + [1]