-
-
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
Conversation
This is really nice. The test output is even nicer than the way you write the tests. |
I thought the reason we didn't use testset is because the output was a bit too verbose. Did something change regarding this? @tkelman |
@KristofferC the output doesn't have to be verbose if you nest your |
Yes, @kshyatt did a bunch of work to make the output look nice. |
Why would existing tests "not work"? (i.e dates/ranges.jl?) |
@quinnj Wrapping Specifically: @test length(a:Dates.Year(1):Dates.Date(2020,2,1)) == 8
@test length(a:Dates.Year(1):Dates.Date(2020,6,1)) == 8
@test length(a:Dates.Year(1):Dates.Date(2020,11,1)) == 8
@test length(a:Dates.Year(1):Dates.Date(2020,12,31)) == 8
@test length(a:Dates.Year(1):Dates.Date(2021,1,1)) == 9 Don't work. |
@kshyatt I get an error in @test (Date(2009,1,1):Week(1):Date(2009,1,21)) - (Date(2009,1,1):Day(1):Date(2009,1,3)) == [0d, 6d, 12d] with |
@ranjanan Me too, I'm fixing it now. |
It seems like the top-level testset per file could probably just be figured out from the filename automatically, either in |
This might be annoying for the subdirectories like |
OK I've updated the PR with some fixes. I'll cherry-pick @ranjanan's fixes as well in a bit. |
That would be a good reason to do the nice version in |
Let's keep it simple for now. We can refine the mechanisms later. |
I've updated this PR a bunch! @StefanKarpinski @tkelman @ranjanan thoughts? @carnaval is the gc info we are printing useful to you? |
The top-level modules in |
# Finally throw an error as we are the outermost test set | ||
if total != total_pass | ||
#print_test_results(ts) |
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.
Whats happening here now?
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.
I changed things so that now only the King of the Nodes outputs anything. Otherwise we were getting horrendous looking spam from each worker.
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.
So am I reading this right: if I'm just a general package, and I'm using Base.Test, there will be no output from test sets?
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.
You can dump it explicitly with Base.Test.print_test_results(Base.Test.get_testset())
but yeah, it would be silent unless things fail. There's a reason I put WIP on this. I wish I could put bold in titles: WIP. Ideally I think we'd have a verbose/quiet
flag you could pass depending if you want output or not. It would be good to just let packages use test/runtests.jl
themselves, rather than hacking their own weird fake parallel testing together like happens now.
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.
Ah I see. I was thinking that the solution for the Base testing setting would be making a different kind of test set, or as you say, maybe DefaultTestSet
can have an option.
@kshyatt I'll try sort out the docs tests later tonight or tomorrow if possible. They probably need a bit of reorganisation since there's several modules in there that definitely won't like being wrapped in |
@MichaelHatherly I don't think you should have to change anything. People should be able to write tests around custom modules! The problem is deserializing the module in the test file as it comes in from the remote worker. I need to figure out how to Since the |
OK, cool. That sounds much simpler. |
Things are currently erroring out because we (ironically) have too many tests. I'm going to set it to get the test counts before it sends the message, and only send the full |
|
Cool! If you want to make the output as pretty as possible, you could use the box-drawing character |
ede8440
to
ab2b48e
Compare
@@ -793,5 +793,4 @@ mktempdir() do dir | |||
end | |||
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
@@ -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 comment
The 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
@@ -366,3 +366,5 @@ end | |||
@test Dates.Date("Apr 01 2014", "uuu dd yyyy") == Dates.Date(2014,4,1) | |||
@test_throws ArgumentError Dates.Date("Apr 01 xx 2014", "uuu dd zz yyyy") | |||
@test_throws ArgumentError Dates.Date("Apr 01 xx 2014", "uuu dd yyyy") | |||
|
|||
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 was probably needed earlier to pass at intermediate commits
@@ -427,6 +427,7 @@ mktempdir() do dir | |||
finally | |||
finalize(repo) | |||
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.
probably needs to be added earlier
Make sure error-throwing works for top-level tests.
ab2b48e
to
27262ac
Compare
@@ -1788,6 +1788,8 @@ for op in (:.+, :.*, :.÷, :.%, :.<<, :.>>, :.-, :./, :.\, :.//, :.^) | |||
@eval @test typeof($(op)(A,A)) == Matrix{Foo} | |||
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 was mistakenly deleted in an earlier commit, in order for intermediate commits to pass the re-addition should be squashed into the same commit that deleted it
@@ -794,6 +799,5 @@ mktempdir() do dir | |||
end | |||
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.
I see what happened. You want to end the now-commented-out @testset "SSH" begin
also inside the block comment
I propose that we just squash and merge this now that it's passing CI. I don't think it's worth the additional pain and suffering just to get a series of commits out of this that realistically no one is ever going to care about. |
OK. Follow-up for later PR: printing of |
catch ex | ||
#redirect_stdout(OLD_STDOUT) | ||
#redirect_stderr(OLD_STDERR) | ||
#@show ex |
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.
leftover debugging comments? the following tests need to test ex
, not ts
edit: so this should output ex
in the catch too
The pretty version got merged. Let this PR be a graveyard of intermediate screencaps. edit by tkelman: that was #18738 |
@amitmurthy did that ever get fixed? |
Looking at the code, not yet. |
Should/can we open an issue to track that? |
Sure. I'll do it in a bit. |
Ref: #19620 |
We have all this great testing infrastructure we're not using. I changed
test/runtests.jl
to collect@testset
results from files and generate a nice report at the end, also using@timed
for more statistics (gc time!) instead of@elapsed
. But we have some problems:parallel{_exec}.jl
andboundscheck{_exec}.jl
- need to pass testset results along from theexec
files.test/test.jl
is broken because of changes I made!STDERR
which it seems to me we should have been doing all along. Need to print error backtraces still. Should we align the gc time/memory info I have?max_rss
as part of the tuple inruntests
I would really appreciate help with any/all of this. cc: @ranjanan