Skip to content
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

hook up stdlib to the standard test running system #24701

Merged
merged 2 commits into from
Nov 23, 2017

Conversation

KristofferC
Copy link
Sponsor Member

@KristofferC KristofferC commented Nov 22, 2017

This makes it so the standard library tests run together with the other tests in the parallel test runner.

You can now also chose what stdlib test you want to run with e.g. make test-Profile. All stdlib tests can still be run with make test-stdlib but they will now run in parallel and have the nice output

Test (Worker)      | Time (s) | GC (s) | GC % | Alloc (MB) | RSS (MB)
Base64 (8)         |    1.67  |  0.02  |  1.1 | 23.41      | 161.97
CRC32c (7)         |    2.25  |  0.02  |  0.8 | 28.36      | 163.09
Profile (3)        |    6.37  |  0.03  |  0.5 | 106.00     | 190.81
Mmap (4)           |    7.05  |  1.60  | 22.7 | 85.51      | 181.50

Fixes #24191.

@KristofferC KristofferC added the testsystem The unit testing framework and Test stdlib label Nov 22, 2017
Copy link
Member

@rfourquet rfourquet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thanks! Only the makefile I didn't review.

dir = readdir(stdlib_dir)
test_file = joinpath(stdlib_dir, stdlib, "test", "runtests")
if isfile(test_file * ".jl")
unshift!(tests, test_file)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big problem, but it seems that this algorithms will reverse the order of the stdlib tests (this cries for a replace! standard algorithm a la #22324 ;-) )

@@ -176,6 +178,33 @@ function choosetests(choices = [])
filter!(x -> !(x in net_required_for), tests)
end

if "stdlib" in skip_tests
filter!(x -> x != "stdlib", tests)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not skip also all test names in stdlibs, like other test groups do?

test/runtests.jl Outdated
@@ -13,15 +13,29 @@ else
typemax(Csize_t)
end


test_names = copy(tests)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems it would be cleaner to maintain only one array tests instead of two in parallel, and when the name is needed, call a function test_name on it which implements the transormation below. Or would it make things more complicated somewhere? (or the other way around, maintaining only test_names and have a function test_path or something, cf. my next comment below).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe an array of pairs name => path or a Dict of that.

if "stdlib" in skip_tests
filter!(x -> x != "stdlib", tests)
elseif "stdlib" in tests
filter!(x -> x != "stdlib", tests)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly here, filter out individual stdlib tests?

test/runtests.jl Outdated
if contains(test, "stdlib") && endswith(test, "runtests")
test_names[i] = split(test, "/")[end-2]
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit funny to transorm test names to "runtest.jl" files (in "choosetest.jl"), and then back here to a name. Maybe infering the test file name could be implemented only here in this file?

@KristofferC
Copy link
Sponsor Member Author

Thanks for your comments @rfourquet. I felt the same way when I implemented it that the two array style was pretty ugly. I think I have a better design coming up.

@KristofferC
Copy link
Sponsor Member Author

New version up, @rfourquet

test/runtests.jl Outdated
catch e
resp = [e]
end
push!(results, (test, resp))
if resp[1] isa Exception
if exit_on_error
skipped = length(tests)
empty!(tests)
skipped = length(test_data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to change back test_data to tests?

if test in STDLIBS
test_file = joinpath(STDLIB_DIR, test, "test", "runtests")
if !isfile(test_file * ".jl")
error("Standard library $test did not provide a `test/runtests.jl` file")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be beyond the scope of this PR, but given #24628, there may or may not be a nicer way to report the error? (I didn't investigate more this question, and definitely non-blocking).

@@ -2,7 +2,7 @@

using Test

function runtests(name, isolate=true; seed=nothing)
function runtests(name, path, isolate=true; seed=nothing)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this file is include'd, doesn't this function know about test_path ? (to avoid passing the path argument here)

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I prefer to keep it explicit like this to potentially ease the use of this file in other contexts.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok no problem. But maybe then as in most of the cases the name is equal to the path, there could be a default, or even better a keyword path=name. But also I find it tricky that the path is still not the real path, as ".jl" has to be added. I guess this logic comes from the use of name before, but I see no reason now that path should not contain the .jl extension. Then the default value for path would be name * ".jl".

@KristofferC
Copy link
Sponsor Member Author

KristofferC commented Nov 22, 2017

	From worker 1:		From worker 1:		From worker 1:	Distributed: Error During Test at nothing:1
  Test threw an exception of type ErrorException
  Expression: Distributed
  Standard library Distributed did not provide a `test/runtests.jl` file

Anyone know why Distributed gets put with the other stdlib packages in the share dir? Do I need an explicit stdlib list?

@iblislin
Copy link
Member

iblislin commented Nov 22, 2017

hmm I think it's the side effect from #24443 on my worker.

Seems there are some leftovers not control by git...

[venv] % pwd
/usr/home/julia/julia-fbsd-buildbot/worker/11rel-amd64/build/stdlib
[venv] % find Distributed/
Distributed/
Distributed/src
Distributed/src/remotecall.jl.86100.cov
Distributed/src/remotecall.jl.86101.cov
Distributed/src/remotecall.jl.mem

I can add some rm instructions to my worker
Any better way to clean up them?

@KristofferC KristofferC reopened this Nov 22, 2017
@vtjnash
Copy link
Sponsor Member

vtjnash commented Nov 22, 2017

Might make sense to run git clean -fd (Without -x, so it leaves behind ignored files)?

@KristofferC
Copy link
Sponsor Member Author

I was so confused because #24443 wasn't merged yet. Your explanation makes a lot of sense. Some cleanup seems to be needed but I am not sure what the best way to do it is.

@iblislin
Copy link
Member

Might make sense to run git clean -fd (Without -x, so it leaves behind ignored files)?

well, I just found that *.cov and *.mem is listed in .gitignore
so... git clean -fd will not work.

@iblislin
Copy link
Member

I'm going to rm stdlib manually, since stdlib is changing quite rapidly.

@iblislin
Copy link
Member

config changed... let's wait for the queue.

@KristofferC
Copy link
Sponsor Member Author

KristofferC commented Nov 22, 2017

The problem are not the cov fiels but the Delimited directory.

Also, these files exist in julia/usr/share/site/ not stdlib.

@iblislin
Copy link
Member

The problem are not the cov fiels but the Delimited directory.

You mean the Distrbuted dir, right?

Actually, I configured buildbot with git clean -d -f -f after checkout. It will keep ignored file, so our deps will be cached. But in the case of Distrubuted, it generated some files which ignored by git, so the dir isn't clean and cannot be removed. So I consider the cov file is the root cause.

@KristofferC
Copy link
Sponsor Member Author

Oh, I see (and yes I meant Distributed).

@iblislin
Copy link
Member

Also, these files exist in julia/usr/share/site/ not stdlib.

Okay, I should do rm usr/share/site/ for each build?

@KristofferC
Copy link
Sponsor Member Author

I would think so yes, but I am not really knowledgeable how the files are copied when building...

@iblislin
Copy link
Member

Oh, I saw that usr/share/julia/site/v0.7 just a soft link, so rm stdlib should be enough.

@iblislin
Copy link
Member

/me going to 💤 , 🙏 it works as expected :p

the build queue is quite long now(https://julia.iblis.cnmc.tw/#/builders/1)...

@KristofferC
Copy link
Sponsor Member Author

@iblis17 Looks like what you did worked great. This should be good to go from my pov.

@kshyatt kshyatt added the stdlib Julia's standard library label Nov 22, 2017
@KristofferC KristofferC merged commit fb2ba43 into master Nov 23, 2017
KristofferC added a commit that referenced this pull request Nov 23, 2017
* hook up stdlib to the standard test running system

* fixups from review
@StefanKarpinski StefanKarpinski deleted the kc/run_stdlib_parallel branch November 23, 2017 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Julia's standard library testsystem The unit testing framework and Test stdlib
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants