@@ -15,6 +15,9 @@ include("buildkitetestjson.jl")
15
15
16
16
using . BuildkiteTestJSON
17
17
18
+ const longrunning_delay = parse (Int, get (ENV , " JULIA_TEST_LONGRUNNING_DELAY" , " 45" )) * 60 # minutes
19
+ const longrunning_interval = parse (Int, get (ENV , " JULIA_TEST_LONGRUNNING_INTERVAL" , " 15" )) * 60 # minutes
20
+
18
21
(; tests, net_on, exit_on_error, use_revise, seed) = choosetests (ARGS )
19
22
tests = unique (tests)
20
23
@@ -175,10 +178,10 @@ cd(@__DIR__) do
175
178
at = lpad (" ($wrkr )" , name_align - textwidth (name) + 1 , " " )
176
179
lock (print_lock)
177
180
try
178
- printstyled (name, at, " |" , " " ^ elapsed_align,
179
- " started at $(now ()) " ,
181
+ printstyled (name, at, " |" , " " ^ elapsed_align, color = :white )
182
+ printstyled ( " started at $(now ()) " ,
180
183
(pid > 0 ? " on pid $pid " : " " ),
181
- " \n " , color= :white )
184
+ " \n " , color= :light_black )
182
185
finally
183
186
unlock (print_lock)
184
187
end
@@ -215,6 +218,10 @@ cd(@__DIR__) do
215
218
# Monitor stdin and kill this task on ^C
216
219
# but don't do this on Windows, because it may deadlock in the kernel
217
220
running_tests = Dict {String, DateTime} ()
221
+
222
+ # Track timeout timers for each test
223
+ test_timers = Dict {String, Timer} ()
224
+
218
225
if ! Sys. iswindows () && isa (stdin , Base. TTY)
219
226
t = current_task ()
220
227
stdin_monitor = @async begin
@@ -249,6 +256,33 @@ cd(@__DIR__) do
249
256
test = popfirst! (tests)
250
257
running_tests[test] = now ()
251
258
wrkr = p
259
+
260
+ # Create a timer for this test to report long-running status
261
+ test_timers[test] = Timer (longrunning_delay, interval= longrunning_interval) do timer
262
+ if haskey (running_tests, test) # Check test is still running
263
+ start_time = running_tests[test]
264
+ elapsed = now () - start_time
265
+ elapsed_minutes = elapsed. value ÷ (1000 * 60 )
266
+
267
+ elapsed_str = if elapsed_minutes >= 60
268
+ hours, mins = divrem (elapsed_minutes, 60 )
269
+ " $(hours) h $(mins) m"
270
+ else
271
+ " $(elapsed_minutes) m"
272
+ end
273
+
274
+ @lock print_lock begin
275
+ print (test)
276
+ print (lpad (" ($(wrkr) )" , name_align - textwidth (test) + 1 , " " ), " | " )
277
+ # Calculate total width of data columns: "Time (s) | GC (s) | GC % | Alloc (MB) | RSS (MB)"
278
+ # This is: elapsed_align + 3 + gc_align + 3 + percent_align + 3 + alloc_align + 3 + rss_align
279
+ data_width = elapsed_align + gc_align + percent_align + alloc_align + rss_align + 12 # 12 = 4 * " | "
280
+ message = " has been running for $(elapsed_str) "
281
+ centered_message = lpad (rpad (message, (data_width + textwidth (message)) ÷ 2 ), data_width)
282
+ printstyled (centered_message, " \n " , color= :light_black )
283
+ end
284
+ end
285
+ end
252
286
before = time ()
253
287
resp, duration = try
254
288
r = remotecall_fetch (@Base . world (runtests, ∞), wrkr, test, test_path (test); seed= seed)
@@ -258,6 +292,10 @@ cd(@__DIR__) do
258
292
Any[CapturedException (e, catch_backtrace ())], time () - before
259
293
end
260
294
delete! (running_tests, test)
295
+ if haskey (test_timers, test)
296
+ close (test_timers[test])
297
+ delete! (test_timers, test)
298
+ end
261
299
push! (results, (test, resp, duration))
262
300
if length (resp) == 1
263
301
print_testworker_errored (test, wrkr, exit_on_error ? nothing : resp[1 ])
@@ -342,6 +380,9 @@ cd(@__DIR__) do
342
380
if @isdefined stdin_monitor
343
381
schedule (stdin_monitor, InterruptException (); error= true )
344
382
end
383
+ if @isdefined test_timers
384
+ foreach (close, values (test_timers))
385
+ end
345
386
end
346
387
347
388
#=
0 commit comments