43
43
44
44
tests, _, exit_on_error, seed = choosetests (ARGS )
45
45
46
+ function spin_up_worker ()
47
+ p = addprocs (1 )[1 ]
48
+ remotecall_wait (include, p, " utils.jl" )
49
+ remotecall_wait (configure_test, p)
50
+ return p
51
+ end
52
+
46
53
function spin_up_workers (n)
47
54
procs = addprocs (n)
48
55
@sync begin
@@ -71,27 +78,35 @@ move_to_node1("Distributed")
71
78
@testset " Julia tests" begin
72
79
nworkers = min (Sys. CPU_THREADS, length (tests))
73
80
println (" Using $nworkers workers" )
74
- procs = spin_up_workers (nworkers)
75
81
results = Dict {String,Any} ()
76
82
tests0 = copy (tests)
77
- all_tasks = Task[]
83
+ all_tasks = Union{ Task,Nothing} []
78
84
try
79
85
@sync begin
80
- for p in procs
86
+ for i = 1 : nworkers
81
87
@async begin
82
88
push! (all_tasks, current_task ())
83
89
while length (tests) > 0
90
+ nleft = length (tests)
84
91
test = popfirst! (tests)
92
+ println (nleft, " remaining, starting " , test, " on task " , i)
85
93
local resp
86
94
fullpath = test_path (test) * " .jl"
87
95
try
88
- resp = remotecall_fetch (run_test_by_eval, p, test, fullpath, nstmts)
96
+ resp = disable_sigint () do
97
+ p = spin_up_worker ()
98
+ result = remotecall_fetch (run_test_by_eval, p, test, fullpath, nstmts)
99
+ rmprocs (p; waitfor= 5 )
100
+ result
101
+ end
89
102
catch e
90
- isa (e, InterruptException) && return
103
+ if isa (e, InterruptException)
104
+ println (" interrupting " , test)
105
+ break # rethrow(e)
106
+ end
91
107
resp = e
92
108
if isa (e, ProcessExitedException)
93
109
println (" exited on " , test)
94
- p = spin_up_workers (1 )[1 ]
95
110
end
96
111
end
97
112
results[test] = resp
@@ -100,14 +115,24 @@ move_to_node1("Distributed")
100
115
empty! (tests)
101
116
end
102
117
end
118
+ println (" Task " , i, " complete" )
119
+ all_tasks[i] = nothing
103
120
end
104
121
end
105
122
end
106
123
catch err
107
- isa (err, InterruptException) || rethrow (err)
124
+ isa (err, InterruptException) || rethrow (err)
108
125
# If the test suite was merely interrupted, still print the
109
126
# summary, which can be useful to diagnose what's going on
110
- foreach (task-> try ; schedule (task, InterruptException (); error= true ); catch ; end , all_tasks)
127
+ foreach (all_tasks) do task
128
+ try
129
+ if isa (task, Task)
130
+ println (" trying to interrupt " , task)
131
+ schedule (task, InterruptException (); error= true )
132
+ end
133
+ catch
134
+ end
135
+ end
111
136
foreach (wait, all_tasks)
112
137
end
113
138
@@ -120,8 +145,7 @@ move_to_node1("Distributed")
120
145
println (io, " | Test file | Passes | Fails | Errors | Broken | Aborted blocks |" )
121
146
println (io, " | --------- | ------:| -----:| ------:| ------:| --------------:|" )
122
147
for test in tests0
123
- haskey (results, test) || (@warn " missing $test " ; continue )
124
- result = results[test]
148
+ result = get (results, test, " " )
125
149
if isa (result, Tuple{Test. AbstractTestSet, Vector})
126
150
ts, aborts = result
127
151
passes, fails, errors, broken, c_passes, c_fails, c_errors, c_broken = Test. get_test_counts (ts)
0 commit comments