Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/ParallelTestRunner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,7 @@ function runtests(mod::Module, args::ParsedArgs;
results = []
running_tests = Dict{String, Float64}() # test => start_time
test_lock = ReentrantLock() # to protect crucial access to tests and running_tests
results_lock = ReentrantLock() # to protect concurrent access to results

worker_tasks = Task[]

Expand Down Expand Up @@ -888,7 +889,7 @@ function runtests(mod::Module, args::ParsedArgs;
function update_status()
# only draw if we have something to show
isempty(running_tests) && return
completed = length(results)
completed = Base.@lock results_lock length(results)
total = completed + length(tests) + length(running_tests)

# line 1: empty line
Expand All @@ -910,7 +911,7 @@ function runtests(mod::Module, args::ParsedArgs;
line3 = "Progress: $completed/$total tests completed"
if completed > 0
# estimate per-test time (slightly pessimistic)
durations_done = [end_time - start_time for (_, _,_, start_time, end_time) in results]
durations_done = Base.@lock results_lock [end_time - start_time for (_, _,_, start_time, end_time) in results]
μ = mean(durations_done)
σ = length(durations_done) > 1 ? std(durations_done) : 0.0
est_per_test = μ + 0.5σ
Expand Down Expand Up @@ -1063,8 +1064,8 @@ function runtests(mod::Module, args::ParsedArgs;
ex
end
test_t1 = time()
output = @lock wrkr.io_lock String(take!(wrkr.io))
push!(results, (test, result, output, test_t0, test_t1))
output = Base.@lock wrkr.io_lock String(take!(wrkr.io))
Base.@lock results_lock push!(results, (test, result, output, test_t0, test_t1))

# act on the results
if result isa AbstractTestRecord
Expand Down
Loading