Skip to content

Commit 0b89326

Browse files
committed
Fix another race condition.
1 parent abf77ec commit 0b89326

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/ParallelTestRunner.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -637,14 +637,15 @@ function runtests(ARGS; testfilter = Returns(true), RecordType = TestRecord,
637637
worker_tasks = Task[]
638638
for p in workers()
639639
push!(worker_tasks, @async begin
640-
while length(tests) > 0 && !done
640+
while !done
641641
# if a worker failed, spawn a new one
642642
if p === nothing
643643
p = addworker()
644644
end
645645

646646
# get a test to run
647647
test, wrkr, test_t0 = Base.@lock test_lock begin
648+
isempty(tests) && break
648649
test = popfirst!(tests)
649650
wrkr = something(test_worker(test), p)
650651

@@ -663,7 +664,7 @@ function runtests(ARGS; testfilter = Returns(true), RecordType = TestRecord,
663664
if isa(ex, InterruptException)
664665
# the worker got interrupted, signal other tasks to stop
665666
stop_work()
666-
return
667+
break
667668
end
668669

669670
# return any other exception as the result

0 commit comments

Comments
 (0)