Skip to content

Commit

Permalink
Merge pull request JuliaLang#7846 from tkelman/test-defaults
Browse files Browse the repository at this point in the history
RFC: make running the test suite slightly easier
  • Loading branch information
staticfloat committed Aug 10, 2014
2 parents bc704e1 + cc0ac96 commit 6c7f35b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
10 changes: 10 additions & 0 deletions base/interactiveutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -346,3 +346,13 @@ function workspace()
empty!(package_locks)
nothing
end

function runtests(tests = ["all"], numcores = iceil(CPU_CORES/2))
if isa(tests,String)
tests = split(tests)
end
ENV2 = copy(ENV)
ENV2["JULIA_CPU_CORES"] = "$numcores"
run(setenv(`$JULIA_HOME/julia $(joinpath(JULIA_HOME,"..","share","julia",
"test","runtests.jl")) $tests`, ENV2))
end
28 changes: 15 additions & 13 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ testnames = [
# parallel tests depend on other workers - do them last
push!(testnames, "parallel")

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

if "linalg" in tests
# specifically selected case
Expand All @@ -32,18 +32,20 @@ catch
net_on = false
end

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
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")
@everywhere include("testdefs.jl")

reduce(propagate_errors, nothing, pmap(runtests, tests; err_retry=false, err_stop=true))
reduce(propagate_errors, nothing, pmap(runtests, tests; err_retry=false, err_stop=true))

@unix_only n > 1 && rmprocs(workers(), waitfor=5.0)
println(" \033[32;1mSUCCESS\033[0m")
@unix_only n > 1 && rmprocs(workers(), waitfor=5.0)
println(" \033[32;1mSUCCESS\033[0m")
end

0 comments on commit 6c7f35b

Please sign in to comment.