@@ -840,47 +840,63 @@ end
840840 end
841841
842842 @testset " serial tests run before parallel (default)" begin
843+ serial_test_body = quote
844+ children = _count_child_pids ($ (getpid ()))
845+ # Make sure serial tests run alone.
846+ if children >= 0
847+ @test children == 1
848+ end
849+ end
843850 testsuite = Dict (
844- " serial_a" => :(),
845- " serial_b" => :(),
851+ " serial_1" => serial_test_body,
852+ " serial_2" => serial_test_body,
853+ " serial_3" => serial_test_body,
846854 " parallel_1" => :(),
847855 " parallel_2" => :(),
856+ " parallel_3" => :(),
848857 )
849858 io = IOBuffer ()
850859 jobs = 2
851860 old_id_counter = ParallelTestRunner. ID_COUNTER[]
852- runtests (ParallelTestRunner, [" --jobs=$(jobs) " , " --verbose" ];
853- testsuite, stdout = io, stderr = io,
854- serial= [" serial_a" , " serial_b" ])
861+ @show_if_error io runtests (ParallelTestRunner, [" --jobs=$(jobs) " , " --verbose" ];
862+ testsuite, stdout = io, stderr = io,
863+ init_code= :(include ($ (joinpath (@__DIR__ , " utils.jl" )))),
864+ serial= [" serial_1" , " serial_2" , " serial_3" ])
855865 str = String (take! (io))
856- @test contains (str, " 2 serial test(s) will run before" )
866+ @test contains (str, " Running 6 tests using 2 parallel jobs" )
867+ @test contains (str, " 3 serial test(s) will run before" )
857868 @test contains (str, " SUCCESS" )
858869 @test ParallelTestRunner. ID_COUNTER[] == old_id_counter + jobs
859870 end
860871
861872 @testset " serial tests run after parallel" begin
862- testsuite = Dict (
863- " serial_x" => quote
864- children = _count_child_pids ($ (getpid ()))
865- # Make sure serial tests run alone.
866- if children >= 0
867- @test children == 1
873+ serial_test_body = quote
874+ children = _count_child_pids ($ (getpid ()))
875+ # Make sure serial tests run alone.
876+ if children >= 0
877+ @test children == 1
868878 end
869- end ,
870- " parallel_y" => :(),
879+ end
880+ testsuite = Dict (
881+ " serial_1" => serial_test_body,
882+ " serial_2" => serial_test_body,
883+ " serial_3" => serial_test_body,
884+ " parallel_1" => :(),
885+ " parallel_2" => :(),
886+ " parallel_3" => :(),
871887 )
872888 io = IOBuffer ()
873889 ioc = IOContext (io, :color => true )
874890 old_id_counter = ParallelTestRunner. ID_COUNTER[]
875891 @show_if_error io runtests (ParallelTestRunner, [" --jobs=2" , " --verbose" ];
876892 testsuite, stdout = ioc, stderr = ioc,
877893 init_code= :(include ($ (joinpath (@__DIR__ , " utils.jl" )))),
878- serial= [" serial_x " ], serial_position= :after )
894+ serial= [" serial_1 " , " serial_2 " , " serial_3 " ], serial_position= :after )
879895 str = String (take! (io))
880- @test contains (str, " Running 2 tests using 1 parallel jobs" )
881- @test contains (str, " 1 serial test(s) will run after" )
896+ @test contains (str, " Running 6 tests using 2 parallel jobs" )
897+ @test contains (str, " 3 serial test(s) will run after" )
882898 @test contains (str, " SUCCESS" )
883- @test ParallelTestRunner. ID_COUNTER[] == old_id_counter + 1
899+ @test ParallelTestRunner. ID_COUNTER[] == old_id_counter + 2
884900 end
885901
886902 @testset " serial_position validation" begin
0 commit comments