-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Help wanted: switch Base.Test to use testsets everywhere #17165
Changes from 1 commit
3510df9
5da10b5
7d38fb9
17637fc
41bba34
22fd4ae
c08ca0e
27262ac
f8413b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -793,5 +793,4 @@ mktempdir() do dir | |
end | ||
end | ||
=# | ||
end | ||
end | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,11 @@ cd(dirname(@__FILE__)) do | |
# Free up memory =) | ||
n > 1 && rmprocs(workers(), waitfor=5.0) | ||
for t in node1_tests | ||
# As above, try to run each test | ||
# which must run on node 1. If | ||
# the test fails, catch the error, | ||
# and either way, append the results | ||
# to the overall aggregator | ||
n > 1 && print("\tFrom worker 1:\t") | ||
local resp | ||
try | ||
|
@@ -71,6 +76,22 @@ cd(dirname(@__FILE__)) do | |
end | ||
push!(results, (t, resp)) | ||
end | ||
#= | ||
` Construct a testset on the master node which will hold results from all the | ||
test files run on workers and on node1. The loop goes through the results, | ||
inserting them as children of the overall testset if they are testsets, | ||
handling errors otherwise. | ||
|
||
Since the workers don't return information about passing/broken tests, only | ||
errors or failures, those Result types get passed `nothing` for their test | ||
expressions (and expected/received result in the case of Broken). | ||
|
||
If a test failed, returning a `RemoteException`, the error is displayed and | ||
the overall testset has a child testset inserted, with the (empty) Passes | ||
and Brokens from the worker and the full information about all errors and | ||
failures encountered running the tests. This information will be displayed | ||
as a summary at the end of the test run. | ||
=# | ||
o_ts = Base.Test.DefaultTestSet("Overall") | ||
Base.Test.push_testset(o_ts) | ||
for res in results | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this new code could use some comments explaining what's going on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comments please |
||
|
@@ -80,8 +101,12 @@ cd(dirname(@__FILE__)) do | |
Base.Test.pop_testset() | ||
elseif isa(res[2][1], Tuple{Int,Int}) | ||
fake = Base.Test.DefaultTestSet(res[1]) | ||
[Base.Test.record(fake, Base.Test.Pass(:test, nothing, nothing, nothing)) for i in 1:res[2][1][1]] | ||
[Base.Test.record(fake, Base.Test.Broken(:test, nothing)) for i in 1:res[2][1][2]] | ||
for i in 1:res[2][1][1] | ||
Base.Test.record(fake, Base.Test.Pass(:test, nothing, nothing, nothing)) | ||
end | ||
for i in 1:res[2][1][2] | ||
Base.Test.record(fake, Base.Test.Broken(:test, nothing)) | ||
end | ||
Base.Test.push_testset(fake) | ||
Base.Test.record(o_ts, fake) | ||
Base.Test.pop_testset() | ||
|
@@ -91,8 +116,12 @@ cd(dirname(@__FILE__)) do | |
o_ts.anynonpass = true | ||
if isa(res[2][1].captured.ex, Base.Test.TestSetException) | ||
fake = Base.Test.DefaultTestSet(res[1]) | ||
[Base.Test.record(fake, Base.Test.Pass(:test, nothing, nothing, nothing)) for i in 1:res[2][1].captured.ex.pass] | ||
[Base.Test.record(fake, Base.Test.Broken(:test, nothing)) for i in 1:res[2][1].captured.ex.broken] | ||
for i in 1:res[2][1].captured.ex.pass | ||
Base.Test.record(fake, Base.Test.Pass(:test, nothing, nothing, nothing)) | ||
end | ||
for i in 1:res[2][1].captured.ex.broken | ||
Base.Test.record(fake, Base.Test.Broken(:test, nothing)) | ||
end | ||
for t in res[2][1].captured.ex.errors_and_fails | ||
Base.Test.record(fake, t) | ||
end | ||
|
@@ -104,14 +133,28 @@ cd(dirname(@__FILE__)) do | |
end | ||
println() | ||
Base.Test.print_test_results(o_ts,1) | ||
#pretty print the information about gc and mem usage | ||
name_align = maximum(map(x -> length(x[1]), results)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note for later, should also consider the length of the "Test:" header line here |
||
elapsed_align = length("Total time (s):") | ||
gc_align = length("GC time (s):") | ||
percent_align = length("Percent in gc:") | ||
alloc_align = length("Allocated (MB):") | ||
rss_align = length("RSS (MB):") | ||
print_with_color(:white, rpad("Test:",name_align," "), " | ") | ||
print_with_color(:white, "Total time (s): | GC time (s): | Percent in gc: | Allocated (MB): | RSS (MB):\n") | ||
for res in results | ||
if !isa(res[2][1], RemoteException) | ||
rss_str = @sprintf("%7.2f",res[2][6]/2^20) | ||
time_str = @sprintf("%7f",res[2][2]) | ||
gc_str = @sprintf("%7f",res[2][5].total_time/10^9) | ||
print_with_color(:white, rpad("$(res[1])",name_align," "), " | ") | ||
time_str = @sprintf("%7.2f",res[2][2]) | ||
print_with_color(:white, rpad(time_str,elapsed_align," "), " | ") | ||
gc_str = @sprintf("%7.2f",res[2][5].total_time/10^9) | ||
print_with_color(:white, rpad(gc_str,gc_align," "), " | ") | ||
percent_str = @sprintf("%7.2f",100*res[2][5].total_time/(10^9*res[2][2])) | ||
print_with_color(:white, rpad(percent_str,percent_align," "), " | ") | ||
alloc_str = @sprintf("%7.2f",res[2][3]/2^20) | ||
println("Tests for $(res[1]):\n\ttook $time_str seconds, of which $gc_str were spent in gc ($percent_str % ),\n\tallocated $alloc_str MB,\n\twith rss $rss_str MB") | ||
print_with_color(:white, rpad(alloc_str,alloc_align," "), " | ") | ||
rss_str = @sprintf("%7.2f",res[2][6]/2^20) | ||
print_with_color(:white, rpad(rss_str,rss_align," "), "\n") | ||
end | ||
end | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will probably be a syntax error and not bisect, should be squashed into whichever commit added it