Skip to content

Commit

Permalink
allow stdlibs to run their tests in parallel
Browse files Browse the repository at this point in the history
this is done by creating a file `tests` in the `test` folder
that lists the different files with tests (excluding ".jl").
If this file does not exist, we fall back to using the runtests.jl file
  • Loading branch information
KristofferC committed Jan 27, 2018
1 parent eea727c commit dd07d50
Show file tree
Hide file tree
Showing 9 changed files with 69 additions and 32 deletions.
25 changes: 3 additions & 22 deletions stdlib/LinearAlgebra/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,24 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

include("triangular.jl")
include("qr.jl")
include("dense.jl")
include("matmul.jl")
include("schur.jl")
include("special.jl")
include("eigen.jl")
include("bunchkaufman.jl")
include("svd.jl")
include("lapack.jl")
include("tridiag.jl")
include("bidiag.jl")
include("diagonal.jl")
include("cholesky.jl")
include("lu.jl")
include("symmetric.jl")
include("generic.jl")
include("uniformscaling.jl")
include("lq.jl")
include("hessenberg.jl")
include("blas.jl")
include("adjtrans.jl")
for file in readlines(joinpath(@__DIR__, "tests")
include(file * ".jl")
end
22 changes: 22 additions & 0 deletions stdlib/LinearAlgebra/test/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
triangular
qr
dense
matmul
schur
special
eigen
bunchkaufman
svd
lapack
tridiag
bidiag
diagonal
cholesky
lu
symmetric
generic
uniformscaling
lq
hessenberg
blas
adjtrans
7 changes: 7 additions & 0 deletions stdlib/SparseArrays/test/higherorderfns.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
# base/sparse/higherorderfns.jl, particularly map[!]/broadcast[!] for SparseVectors and
# SparseMatrixCSCs at present.

module HigherOrderFnsTests

using Test
using SparseArrays
using LinearAlgebra
using Random

@testset "map[!] implementation specialized for a single (input) sparse vector/matrix" begin
Expand Down Expand Up @@ -548,3 +553,5 @@ end
@test spzeros(1,2) .+ spzeros(0,1) == zeros(0,2)
@test spzeros(1,2) .* spzeros(0,1) == zeros(0,2)
end

end # module
9 changes: 3 additions & 6 deletions stdlib/SparseArrays/test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Test, SparseArrays
using LinearAlgebra

include("higherorderfns.jl")
include("sparse.jl")
include("sparsevector.jl")
for file in readlines(joinpath(@__DIR__, "tests")
include(file * ".jl")
end
10 changes: 8 additions & 2 deletions stdlib/SparseArrays/test/sparse.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using LinearAlgebra: mul!, ldiv!, rdiv!
module SparseTests

using Test
using SparseArrays
using LinearAlgebra
using Base.Printf: @printf
using Random

Expand Down Expand Up @@ -2208,4 +2212,6 @@ end
@testset "findnz on non-sparse arrays" begin
@test findnz([0 1; 0 2]) == ([1, 2], [2, 2], [1, 2])
@test findnz(BitArray([false true; false true])) == ([1, 2], [2, 2], trues(2))
end
end

end # module
6 changes: 6 additions & 0 deletions stdlib/SparseArrays/test/sparsevector.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

module SparseVectorTests

using Test
using SparseArrays
using LinearAlgebra
using Random

Expand Down Expand Up @@ -1264,3 +1268,5 @@ end
LinearAlgebra.lowrankupdate!(Matrix(1.0*I, n, n), fill(1.0, n), Ajview)
end
end

end # module
3 changes: 3 additions & 0 deletions stdlib/SparseArrays/test/tests
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
higherorderfns
sparse
sparsevector
14 changes: 14 additions & 0 deletions test/choosetests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ function choosetests(choices = [])
prepend!(tests, STDLIBS)
end

new_tests = String[]
for test in tests
if test in STDLIBS
testfile = joinpath(STDLIB_DIR, test, "test", "tests")
if isfile(testfile)
prepend!(new_tests, (test * "/") .* readlines(testfile))
else
push!(new_tests, test * "/runtests")
end
end
end
filter!(x -> (x != "stdlib" && !(x in STDLIBS)) , tests)
prepend!(tests, new_tests)

# do ambiguous first to avoid failing if ambiguities are introduced by other tests
if "ambiguous" in skip_tests
filter!(x -> x != "ambiguous", tests)
Expand Down
5 changes: 3 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ else
end

function test_path(test)
if test in STDLIBS
return joinpath(STDLIB_DIR, test, "test", "runtests")
t = split(test, '/')
if length(t) == 2 && t[1] in STDLIBS
return joinpath(STDLIB_DIR, t[1], "test", t[2])
else
return joinpath(@__DIR__, test)
end
Expand Down

0 comments on commit dd07d50

Please sign in to comment.