Skip to content

Commit

Permalink
Parallel inline_tests: Fix when partition list is empty
Browse files Browse the repository at this point in the history
Signed-off-by: Hugo Heuzard <[email protected]>
  • Loading branch information
hhugo authored and rgrinberg committed Oct 5, 2023
1 parent de07380 commit 35d821c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 15 deletions.
1 change: 1 addition & 0 deletions doc/changes/8848.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Fix inline_tests when the partition list is empty (#8848, @hhugo)
21 changes: 12 additions & 9 deletions src/dune_rules/inline_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -347,15 +347,18 @@ include Sub_system.Register_end_point (struct
List.map partitions_flags ~f:(fun p -> action mode (flags p))
|> Action_builder.all
and+ () = Action_builder.paths source_files in
let run_tests = Action.concurrent actions in
let diffs =
List.map source_files ~f:(fun fn ->
Path.as_in_build_dir_exn fn
|> Path.Build.extend_basename ~suffix:".corrected"
|> Action.diff ~optional:true fn)
|> Action.concurrent
in
Action.Full.make ~sandbox @@ Action.progn [ run_tests; diffs ]))
match actions with
| [] -> Action.Full.empty
| _ :: _ ->
let run_tests = Action.concurrent actions in
let diffs =
List.map source_files ~f:(fun fn ->
Path.as_in_build_dir_exn fn
|> Path.Build.extend_basename ~suffix:".corrected"
|> Action.diff ~optional:true fn)
|> Action.concurrent
in
Action.Full.make ~sandbox @@ Action.progn [ run_tests; diffs ]))
;;

let gen_rules c ~(info : Info.t) ~backends =
Expand Down
6 changes: 0 additions & 6 deletions test/blackbox-tests/test-cases/inline_tests/parallel.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ See that we indeed have 3 partitions
ocamlopt test3/.test_lib3.inline-tests/.test_lib3.inline-tests.eobjs/native/dune__exe__Inline_test_runner_test_lib3.{cmx,o}
ocamlopt test3/.test_lib3.inline-tests/inline_test_runner_test_lib3.exe
inline_test_runner_test_lib3 test3/.test_lib3.inline-tests/partitions-best
File "test3/dune", line 4, characters 1-40:
4 | (inline_tests (backend fake_backend_2)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error: Rule dependencies are configured to require sandboxing, but the rule
has no actions that could potentially require sandboxing.
[1]

See that we have no partition.

Expand Down

0 comments on commit 35d821c

Please sign in to comment.