@@ -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
@@ -243,7 +248,7 @@ function _print_test_errors(report_iob, ts::DefaultTestSet, worker_info)
243248 return nothing
244249end
245250
246- function print_state (io, state, ti, ntestitems; color= :default )
251+ function print_state (io:: IO , state:: String , ti:: TestItem , ntestitems; color= :default )
247252 interactive = parse (Bool, get (ENV , " RETESTITEMS_INTERACTIVE" , string (Base. isinteractive ())))
248253 print (io, format (now (), " HH:MM:SS | " ))
249254 ! interactive && print (io, _mem_watermark ())
@@ -256,6 +261,13 @@ function print_state(io, state, ti, ntestitems; color=:default)
256261 end
257262 print (io, " test item $(repr (ti. name)) " )
258263end
264+ function print_state (io:: IO , state:: String , ts:: TestSetup )
265+ interactive = parse (Bool, get (ENV , " RETESTITEMS_INTERACTIVE" , string (Base. isinteractive ())))
266+ print (io, format (now (), " HH:MM:SS | " ))
267+ ! interactive && print (io, _mem_watermark ())
268+ printstyled (io, rpad (uppercase (state), 5 ))
269+ print (io, " test setup $(ts. name) " )
270+ end
259271
260272function print_file_info (io, ti)
261273 print (io, " at " )
@@ -270,20 +282,33 @@ function log_testitem_skipped(ti::TestItem, ntestitems=0)
270282 write (DEFAULT_STDOUT[], take! (io. io))
271283end
272284
273- # Marks the start of each test item
274285function log_testitem_start (ti:: TestItem , ntestitems= 0 )
275286 io = IOContext (IOBuffer (), :color => get (DEFAULT_STDOUT[], :color , false ):: Bool )
276287 print_state (io, " START" , ti, ntestitems)
277288 print_file_info (io, ti)
278289 println (io)
279290 write (DEFAULT_STDOUT[], take! (io. io))
280291end
292+ function log_testsetup_start (ts:: TestSetup )
293+ io = IOContext (IOBuffer (), :color => get (DEFAULT_STDOUT[], :color , false ):: Bool )
294+ print_state (io, " START" , ts)
295+ print_file_info (io, ts)
296+ println (io)
297+ write (DEFAULT_STDOUT[], take! (io. io))
298+ end
281299
282300function log_testitem_done (ti:: TestItem , ntestitems= 0 )
283301 io = IOContext (IOBuffer (), :color => get (DEFAULT_STDOUT[], :color , false ):: Bool )
284302 print_state (io, " DONE" , ti, ntestitems)
285- x = last (ti. stats) # always print stats for most recent run
286- print_time (io; x. elapsedtime, x. bytes, x. gctime, x. allocs, x. compile_time, x. recompile_time)
303+ stats = last (ti. stats) # always print stats for most recent run
304+ print_time (io, stats)
305+ println (io)
306+ write (DEFAULT_STDOUT[], take! (io. io))
307+ end
308+ function log_testsetup_done (ts:: TestSetup , ntestitems= 0 )
309+ io = IOContext (IOBuffer (), :color => get (DEFAULT_STDOUT[], :color , false ):: Bool )
310+ print_state (io, " DONE" , ts)
311+ print_time (io, ts. stats[])
287312 println (io)
288313 write (DEFAULT_STDOUT[], take! (io. io))
289314end
0 commit comments