Skip to content

Commit 557d7fd

Browse files
committed
Add a lock to protect pushes to results
1 parent 9e48ebf commit 557d7fd

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/ParallelTestRunner.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,7 @@ function runtests(mod::Module, args::ParsedArgs;
834834
results = []
835835
running_tests = Dict{String, Float64}() # test => start_time
836836
test_lock = ReentrantLock() # to protect crucial access to tests and running_tests
837+
results_lock = ReentrantLock() # to protect concurrent access to results
837838

838839
worker_tasks = Task[]
839840

@@ -1063,8 +1064,8 @@ function runtests(mod::Module, args::ParsedArgs;
10631064
ex
10641065
end
10651066
test_t1 = time()
1066-
output = @lock wrkr.io_lock String(take!(wrkr.io))
1067-
push!(results, (test, result, output, test_t0, test_t1))
1067+
output = Base.@lock wrkr.io_lock String(take!(wrkr.io))
1068+
Base.@lock results_lock push!(results, (test, result, output, test_t0, test_t1))
10681069

10691070
# act on the results
10701071
if result isa AbstractTestRecord

0 commit comments

Comments
 (0)