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

Make testname selection into a callable function #10214

Merged
merged 2 commits into from
Feb 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Add new code to Julia's base libraries as follows:

3. Add any necessary export symbols in `exports.jl`.

4. Include your tests in `test/Makefile` and `test/runtests.jl`.
4. Include your tests in `test/Makefile` and `test/choosetests.jl`.

Build as usual, and do `make clean testall` to test your contribution. If your contribution includes changes to Makefiles or external dependencies, make sure you can build Julia from a clean tree using `git clean -fdx` or equivalent (be careful – this command will delete any files lying around that aren't checked into git).

Expand Down
62 changes: 62 additions & 0 deletions test/choosetests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
@doc """

`tests, net_on = choosetests(choices)` selects a set of tests to be
run. `choices` should be a vector of test names; if empty or set to
`["all"]`, all tests are selected.

This function also supports "test collections": specifically, "linalg"
refers to collections of tests in the correspondingly-named
directories.

Upon return, `tests` is a vector of fully-expanded test names, and
`net_on` is true if networking is available (required for some tests).
""" ->
function choosetests(choices = [])
testnames = [
"linalg", "core", "keywordargs", "numbers", "strings",
"dates", "dict", "hashing", "remote", "iobuffer", "staged",
"arrayops", "subarray", "reduce", "reducedim", "random",
"intfuncs", "simdloop", "blas", "fft", "dsp", "sparse",
"bitarray", "copy", "math", "fastmath", "functional",
"bigint", "sorting", "statistics", "spawn", "backtrace",
"priorityqueue", "arpack", "file", "version", "resolve",
"pollfd", "mpfr", "broadcast", "complex", "socket",
"floatapprox", "readdlm", "reflection", "regex", "float16",
"combinatorics", "sysinfo", "rounding", "ranges", "mod2pi",
"euler", "show", "lineedit", "replcompletions", "repl",
"replutil", "sets", "test", "goto", "llvmcall", "grisu",
"nullable", "meta", "profile", "libgit2", "docs", "markdown",
"base64", "parser", "serialize", "functors", "char", "misc"
]

if isdir(joinpath(JULIA_HOME, Base.DOCDIR, "examples"))
push!(testnames, "examples")
end
@unix_only push!(testnames, "unicode")

# parallel tests depend on other workers - do them last
push!(testnames, "parallel")

tests = (ARGS==["all"] || isempty(ARGS)) ? testnames : ARGS

if "linalg" in tests
# specifically selected case
filter!(x -> x != "linalg", tests)
prepend!(tests, ["linalg1", "linalg2", "linalg3", "linalg4", "linalg/lapack", "linalg/triangular", "linalg/tridiag", "linalg/pinv", "linalg/givens", "linalg/cholesky", "linalg/lu"])
end

net_required_for = ["socket", "parallel"]
net_on = true
try
getipaddr()
catch
warn("Networking unavailable: Skipping tests [" * join(net_required_for, ", ") * "]")
net_on = false
end

if !net_on
filter!(x -> !(x in net_required_for), tests)
end

tests, net_on
end
45 changes: 2 additions & 43 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,53 +1,12 @@
# linalg tests take the longest - start them off first
testnames = [
"linalg", "core", "keywordargs", "numbers", "strings", "dates",
"dict", "hashing", "remote", "iobuffer", "staged", "arrayops",
"subarray", "reduce", "reducedim", "random", "intfuncs",
"simdloop", "blas", "fft", "dsp", "sparse", "bitarray", "copy", "math",
"fastmath", "functional", "bigint", "sorting", "statistics", "spawn",
"backtrace", "priorityqueue", "arpack", "file", "version",
"resolve", "pollfd", "mpfr", "broadcast", "complex", "socket",
"floatapprox", "readdlm", "reflection", "regex", "float16", "combinatorics",
"sysinfo", "rounding", "ranges", "mod2pi", "euler", "show",
"lineedit", "replcompletions", "repl", "replutil", "sets", "test", "goto",
"llvmcall", "grisu", "nullable", "meta", "profile",
"libgit2", "docs", "markdown", "base64", "parser", "serialize", "functors",
"char", "misc"
]

if isdir(joinpath(JULIA_HOME, Base.DOCDIR, "examples"))
push!(testnames, "examples")
end
@unix_only push!(testnames, "unicode")

# parallel tests depend on other workers - do them last
push!(testnames, "parallel")

tests = (ARGS==["all"] || isempty(ARGS)) ? testnames : ARGS

if "linalg" in tests
# specifically selected case
filter!(x -> x != "linalg", tests)
prepend!(tests, ["linalg1", "linalg2", "linalg3", "linalg4", "linalg/lapack", "linalg/triangular", "linalg/tridiag", "linalg/pinv", "linalg/givens", "linalg/cholesky", "linalg/lu"])
end

net_required_for = ["socket", "parallel"]
net_on = true
try
getipaddr()
catch
warn("Networking unavailable: Skipping tests [" * join(net_required_for, ", ") * "]")
net_on = false
end
include("choosetests.jl")
tests, net_on = choosetests(ARGS)

cd(dirname(@__FILE__)) do
n = 1
if net_on
n = min(8, CPU_CORES, length(tests))
n > 1 && addprocs(n; exeflags=`--check-bounds=yes`)
blas_set_num_threads(1)
else
filter!(x -> !(x in net_required_for), tests)
end

@everywhere include("testdefs.jl")
Expand Down