Skip to content

Commit

Permalink
Test Runner: Add Option to Control OUnit Parallelism (#19)
Browse files Browse the repository at this point in the history
Default to sequential, since this is potentially causing issues across all exercises that use UNIX sigalrm for timeouts (basically all exercises)
  • Loading branch information
just-max authored Jul 15, 2024
1 parent fd07126 commit fcec91f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/test-runner/std_task.ml
Original file line number Diff line number Diff line change
Expand Up @@ -287,27 +287,30 @@ let std_build cfg = group ~label:"build" @@ of_list [
Thus, first runs the given executable without any arguments, then runs it a
second time, with the given [output_junit_file] (interpreted relative to the
[test-reports/] directory) as the output JUnit file. *)
let std_exec_test cfg ?env ~output_junit_file what = group @@ of_list [
let std_exec_test cfg ?env ?(shards = Some 1) ~output_junit_file what = group @@ of_list [
(* Note: the 'probe' name here is unrelated to the partial signature
checking probe below, and refers to the top-level check *)
std_exec1 cfg ~phase:`Probe ?env what |> with_ ~label:"top_level";

(* run the test! *)
std_exec1 cfg ~phase:`Test ?env what
~args:[
"-output-junit-file";
Path_util.(std_test_report_dir / output_junit_file)
]
|> with_ ~label:"run";
let args =
(match shards with
| Some i -> ["-shards"; string_of_int i]
| None -> [])
@
[ "-output-junit-file";
Path_util.(std_test_report_dir / output_junit_file); ]
in
std_exec1 cfg ~phase:`Test ?env what ~args |> with_ ~label:"run";
]

let std_output_junit_file = "results.xml"
let std_grading_junit_file = "grading.xml"

(** As {!std_exec_test}, fixed to [test/test.exe]
with output to [test-reports/results.xml]. *)
let std_test cfg =
std_exec_test cfg "test/test.exe"
let std_test ?shards cfg =
std_exec_test cfg ?shards "test/test.exe"
~output_junit_file:std_output_junit_file
|> with_ ~label:"test"

Expand Down

0 comments on commit fcec91f

Please sign in to comment.