@@ -55,6 +55,11 @@ function _print_scaled_one_dec(io, value, scale, label="")
5555 end
5656 print (io, label)
5757end
58+ function print_time (io:: IO , s:: PerfStats )
59+ return print_time (
60+ io; s. elapsedtime, s. bytes, s. gctime, s. allocs, s. compile_time, s. recompile_time
61+ )
62+ end
5863function print_time (io; elapsedtime, bytes= 0 , gctime= 0 , allocs= 0 , compile_time= 0 , recompile_time= 0 )
5964 _print_scaled_one_dec (io, elapsedtime, 1e9 , " secs" )
6065 if gctime > 0 || compile_time > 0
@@ -241,7 +246,7 @@ function _print_test_errors(report_iob, ts::DefaultTestSet, worker_info)
241246 return nothing
242247end
243248
244- function print_state (io, state, ti, ntestitems; color= :default )
249+ function print_state (io:: IO , state:: String , ti:: TestItem , ntestitems; color= :default )
245250 interactive = parse (Bool, get (ENV , " RETESTITEMS_INTERACTIVE" , string (Base. isinteractive ())))
246251 print (io, format (now (), " HH:MM:SS | " ))
247252 ! interactive && print (io, _mem_watermark ())
@@ -254,6 +259,13 @@ function print_state(io, state, ti, ntestitems; color=:default)
254259 end
255260 print (io, " test item $(repr (ti. name)) " )
256261end
262+ function print_state (io:: IO , state:: String , ts:: TestSetup )
263+ interactive = parse (Bool, get (ENV , " RETESTITEMS_INTERACTIVE" , string (Base. isinteractive ())))
264+ print (io, format (now (), " HH:MM:SS | " ))
265+ ! interactive && print (io, _mem_watermark ())
266+ printstyled (io, rpad (uppercase (state), 5 ))
267+ print (io, " test setup $(ts. name) " )
268+ end
257269
258270function print_file_info (io, ti)
259271 print (io, " at " )
@@ -268,20 +280,33 @@ function log_testitem_skipped(ti::TestItem, ntestitems=0)
268280 write (DEFAULT_STDOUT[], take! (io. io))
269281end
270282
271- # Marks the start of each test item
272283function log_testitem_start (ti:: TestItem , ntestitems= 0 )
273284 io = IOContext (IOBuffer (), :color => get (DEFAULT_STDOUT[], :color , false ):: Bool )
274285 print_state (io, " START" , ti, ntestitems)
275286 print_file_info (io, ti)
276287 println (io)
277288 write (DEFAULT_STDOUT[], take! (io. io))
278289end
290+ function log_testsetup_start (ts:: TestSetup )
291+ io = IOContext (IOBuffer (), :color => get (DEFAULT_STDOUT[], :color , false ):: Bool )
292+ print_state (io, " START" , ts)
293+ print_file_info (io, ts)
294+ println (io)
295+ write (DEFAULT_STDOUT[], take! (io. io))
296+ end
279297
280298function log_testitem_done (ti:: TestItem , ntestitems= 0 )
281299 io = IOContext (IOBuffer (), :color => get (DEFAULT_STDOUT[], :color , false ):: Bool )
282300 print_state (io, " DONE" , ti, ntestitems)
283- x = last (ti. stats) # always print stats for most recent run
284- print_time (io; x. elapsedtime, x. bytes, x. gctime, x. allocs, x. compile_time, x. recompile_time)
301+ stats = last (ti. stats) # always print stats for most recent run
302+ print_time (io, stats)
303+ println (io)
304+ write (DEFAULT_STDOUT[], take! (io. io))
305+ end
306+ function log_testsetup_done (ts:: TestSetup , ntestitems= 0 )
307+ io = IOContext (IOBuffer (), :color => get (DEFAULT_STDOUT[], :color , false ):: Bool )
308+ print_state (io, " DONE" , ts)
309+ print_time (io, ts. stats[])
285310 println (io)
286311 write (DEFAULT_STDOUT[], take! (io. io))
287312end
0 commit comments