Skip to content

Commit 5b0ba79

Browse files
committed
Show stats for tests run on node 1
1 parent be23f4d commit 5b0ba79

File tree

1 file changed

+29
-17
lines changed

1 file changed

+29
-17
lines changed

test/runtests.jl

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@ cd(dirname(@__FILE__)) do
6464
print_with_color(:white, rpad("Test (Worker)",name_align," "), " | ")
6565
print_with_color(:white, "Time (s) | GC (s) | GC % | Alloc (MB) | RSS (MB)\n")
6666
results=[]
67+
print_lock = ReentrantLock()
68+
69+
function print_testworker_stats(test, wrkr, resp)
70+
lock(print_lock)
71+
try
72+
print_with_color(:white, rpad(test*" ($wrkr)", name_align, " "), " | ")
73+
time_str = @sprintf("%7.2f",resp[2])
74+
print_with_color(:white, rpad(time_str,elapsed_align," "), " | ")
75+
gc_str = @sprintf("%5.2f",resp[5].total_time/10^9)
76+
print_with_color(:white, rpad(gc_str,gc_align," "), " | ")
77+
78+
# since there may be quite a few digits in the percentage,
79+
# the left-padding here is less to make sure everything fits
80+
percent_str = @sprintf("%4.1f",100*resp[5].total_time/(10^9*resp[2]))
81+
print_with_color(:white, rpad(percent_str,percent_align," "), " | ")
82+
alloc_str = @sprintf("%5.2f",resp[3]/2^20)
83+
print_with_color(:white, rpad(alloc_str,alloc_align," "), " | ")
84+
rss_str = @sprintf("%5.2f",resp[6]/2^20)
85+
print_with_color(:white, rpad(rss_str,rss_align," "), "\n")
86+
finally
87+
unlock(print_lock)
88+
end
89+
end
90+
6791
@sync begin
6892
for p in workers()
6993
@async begin
@@ -91,22 +115,8 @@ cd(dirname(@__FILE__)) do
91115
error("Halting tests. Memory limit reached : $resp > $max_worker_rss")
92116
end
93117
end
94-
if !isa(resp[1], Exception)
95-
print_with_color(:white, rpad(test*" ($wrkr)", name_align, " "), " | ")
96-
time_str = @sprintf("%7.2f",resp[2])
97-
print_with_color(:white, rpad(time_str,elapsed_align," "), " | ")
98-
gc_str = @sprintf("%5.2f",resp[5].total_time/10^9)
99-
print_with_color(:white, rpad(gc_str,gc_align," "), " | ")
100-
101-
# since there may be quite a few digits in the percentage,
102-
# the left-padding here is less to make sure everything fits
103-
percent_str = @sprintf("%4.1f",100*resp[5].total_time/(10^9*resp[2]))
104-
print_with_color(:white, rpad(percent_str,percent_align," "), " | ")
105-
alloc_str = @sprintf("%5.2f",resp[3]/2^20)
106-
print_with_color(:white, rpad(alloc_str,alloc_align," "), " | ")
107-
rss_str = @sprintf("%5.2f",resp[6]/2^20)
108-
print_with_color(:white, rpad(rss_str,rss_align," "), "\n")
109-
end
118+
119+
!isa(resp[1], Exception) && print_testworker_stats(test, wrkr, resp)
110120
end
111121
if p != 1
112122
# Free up memory =)
@@ -115,18 +125,20 @@ cd(dirname(@__FILE__)) do
115125
end
116126
end
117127
end
128+
129+
n > 1 && length(node1_tests) > 1 && print("\nExecuting tests that run on node 1 only:\n")
118130
for t in node1_tests
119131
# As above, try to run each test
120132
# which must run on node 1. If
121133
# the test fails, catch the error,
122134
# and either way, append the results
123135
# to the overall aggregator
124-
n > 1 && print(" From worker 1:\t")
125136
isolate = true
126137
t == "SharedArrays" && (isolate = false)
127138
local resp
128139
try
129140
resp = eval(Expr(:call, () -> runtests(t, test_path(t), isolate, seed=seed))) # runtests is defined by the include above
141+
print_testworker_stats(t, 1, resp)
130142
catch e
131143
resp = [e]
132144
end

0 commit comments

Comments
 (0)