Skip to content

Commit

Permalink
Parallel inline_tests: Improve tests
Browse files Browse the repository at this point in the history
The fake inline_tests backend was not taking libname into account when
listing partitions. Which could result in listing too many partitions.

Signed-off-by: Hugo Heuzard <[email protected]>
  • Loading branch information
hhugo committed Oct 5, 2023
1 parent 5421aa7 commit 626704c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ let register ~libname ~partition name run =

let run () =
Arg.parse speclist anon_fun usage_msg;
if !libname = "" then failwith "Should specify libname";
if !list_partitions then
let partitions =
List.fold_left
(fun acc t -> StringSet.add t.partition acc)
(fun acc t -> if !libname = t.libname then StringSet.add t.partition acc else acc)
StringSet.empty !tests
in
StringSet.iter print_endline partitions
else if !libname = "" then failwith "Should specify libname";
StringSet.iter print_endline partitions;
List.iter
(fun t ->
if t.libname = !libname && t.partition = !partition then (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
let () =
Fake_backend_runner.register ~libname:"test_lib" ~partition:"p1" "first test"
Fake_backend_runner.register ~libname:"test_lib2" ~partition:"p1" "first test"
(fun () -> assert true)

let () =
Fake_backend_runner.register ~libname:"test_lib" ~partition:"p1" "second test"
Fake_backend_runner.register ~libname:"test_lib2" ~partition:"p1" "second test"
(fun () -> () )

let () =
Fake_backend_runner.register ~libname:"test_lib" ~partition:"p2" "first test"
Fake_backend_runner.register ~libname:"test_lib2" ~partition:"p2" "first test"
(fun () -> ())

let () =
Fake_backend_runner.register ~libname:"test_lib" ~partition:"p3" "first test"
Fake_backend_runner.register ~libname:"test_lib2" ~partition:"p3" "first test"
(fun () -> failwith "This failure is expected")

let () =
Fake_backend_runner.register ~libname:"other_lib" ~partition:"p1"
"second test" (fun () -> assert false)

let () =
Fake_backend_runner.register ~libname:"other_lib" ~partition:"pn"
"second test" (fun () -> assert false)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let () =
Fake_backend_runner.register ~libname:"other_lib" ~partition:"p1"
"second test" (fun () -> assert false)

0 comments on commit 626704c

Please sign in to comment.