Skip to content

Commit 5854e38

Browse files
committed
use test_args
1 parent 649bfbb commit 5854e38

File tree

1 file changed

+27
-22
lines changed

1 file changed

+27
-22
lines changed

test/runtests.jl

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,29 @@ union!(JuliaInterpreter.compiled_modules, Any[Base, Base.Broadcast, Compat, Line
2222

2323
Random.seed!(1) # Set seed that all testsets should reset to.
2424

25-
function include_test(path::String)
26-
println("Testing $path:") # print so TravisCI doesn't timeout due to no output
27-
@time Base.include(@__MODULE__(), path) do ex
28-
Meta.isexpr(ex, :macrocall) && ex.args[1] == Symbol("@testset") || return ex
29-
return :(@interpret (() -> $ex)()) # interpret testsets using JuliaInterpreter
25+
function include_test(path)
26+
if isempty(ARGS) || any(occursin(a, w) for w in split(path, '/'), a in ARGS)
27+
println("Testing $path:") # print so TravisCI doesn't timeout due to no output
28+
@time include(path) # show basic timing, (this will print a newline at end)
29+
else
30+
# If you provide ARGS like so, then it runs only matching testsets:
31+
# Pkg.test("ChainRules", test_args = ["index", "LinearAlgebra"])
32+
println("(Not testing $path)")
3033
end
3134
end
3235

33-
println("Testing ChainRules.jl")
34-
@testset "ChainRules" begin
35-
include_test("test_helpers.jl")
36-
println()
37-
@testset "rulesets" begin
38-
@testset "Core" begin
39-
include_test("rulesets/Core/core.jl")
40-
end
36+
if isempty(ARGS)
37+
println("Testing ChainRules.jl")
38+
else
39+
println("Testing ChainRules.jl with test_args = ", ARGS)
40+
end
4141

42-
@testset "Base" begin
42+
@testset "ChainRules" begin # one overall @testset ensures it keeps going after failures
43+
include("test_helpers.jl")
44+
println()
45+
# @testset "rulesets" begin
46+
# @testset "Base" begin
47+
# Each file puts all tests inside one or more @testset blocks
4348
include_test("rulesets/Base/base.jl")
4449
include_test("rulesets/Base/fastmath_able.jl")
4550
include_test("rulesets/Base/evalpoly.jl")
@@ -48,15 +53,15 @@ println("Testing ChainRules.jl")
4853
include_test("rulesets/Base/indexing.jl")
4954
include_test("rulesets/Base/mapreduce.jl")
5055
include_test("rulesets/Base/sort.jl")
51-
end
56+
# end
5257
println()
5358

54-
@testset "Statistics" begin
59+
# @testset "Statistics" begin
5560
include_test("rulesets/Statistics/statistics.jl")
56-
end
61+
# end
5762
println()
5863

59-
@testset "LinearAlgebra" begin
64+
# @testset "LinearAlgebra" begin
6065
include_test("rulesets/LinearAlgebra/dense.jl")
6166
include_test("rulesets/LinearAlgebra/norm.jl")
6267
include_test("rulesets/LinearAlgebra/matfun.jl")
@@ -65,12 +70,12 @@ println("Testing ChainRules.jl")
6570
include_test("rulesets/LinearAlgebra/factorization.jl")
6671
include_test("rulesets/LinearAlgebra/blas.jl")
6772
include_test("rulesets/LinearAlgebra/lapack.jl")
68-
end
73+
# end
6974
println()
7075

71-
@testset "Random" begin
76+
# @testset "Random" begin
7277
include_test("rulesets/Random/random.jl")
73-
end
78+
# end
7479
println()
75-
end
80+
# end
7681
end

0 commit comments

Comments
 (0)