Skip to content
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 test/rulesets/Base/array.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "constructors" begin
@testset "Array constructors" begin

# We can't use test_rrule here (as it's currently implemented) because the elements of
# the array have arbitrary values. The only thing we can do is ensure that we're getting
Expand Down
2 changes: 1 addition & 1 deletion test/rulesets/Base/arraymath.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "arraymath" begin
@testset "arraymath.jl" begin
@testset "inv(::Matrix{$T})" for T in (Float64, ComplexF64)
B = generate_well_conditioned_matrix(T, 3)
test_frule(inv, B)
Expand Down
2 changes: 1 addition & 1 deletion test/rulesets/Base/base.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "base" begin
@testset "base.jl" begin
@testset "copysign" begin
# don't go too close to zero as the numerics may jump over it yielding wrong results
@testset "at $y" for y in (-1.1, 0.1, 100.0)
Expand Down
2 changes: 1 addition & 1 deletion test/rulesets/LinearAlgebra/dense.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testset "dense" begin
@testset "dense LinearAlgebra" begin
@testset "dot" begin
@testset "Vector{$T}" for T in (Float64, ComplexF64)
test_frule(dot, randn(T, 3), randn(T, 3))
Expand Down
2 changes: 1 addition & 1 deletion test/rulesets/Random/random.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct NormalDistribution
end
Random.rand(d::NormalDistribution) = d.μ + d.σ*randn()

@testset "random" begin
@testset "Random" begin
rng_types = [MersenneTwister]
isdefined(Random, :Xoshiro) && push!(rng_types, getfield(Random, :Xoshiro))

Expand Down
89 changes: 46 additions & 43 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,55 +22,58 @@ union!(JuliaInterpreter.compiled_modules, Any[Base, Base.Broadcast, Compat, Line

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

function include_test(path::String)
println("Testing $path:") # print so TravisCI doesn't timeout due to no output
@time Base.include(@__MODULE__(), path) do ex
Meta.isexpr(ex, :macrocall) && ex.args[1] == Symbol("@testset") || return ex
return :(@interpret (() -> $ex)()) # interpret testsets using JuliaInterpreter
function include_test(path)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

At this point i think this function could do with a docstring.

if isempty(ARGS) || any(occursin(a, path) for a in ARGS)
println("Testing $path:") # print so TravisCI doesn't timeout due to no output
@time Base.include(@__MODULE__(), path) do ex
Meta.isexpr(ex, :macrocall) && ex.args[1] == Symbol("@testset") || return ex
return :(@interpret (() -> $ex)()) # interpret testsets using JuliaInterpreter
end
else
# If you provide ARGS like so, then it runs only matching testsets:
# Pkg.test("ChainRules", test_args = ["index", "LinearAlgebra"])
println("(Not testing $path)")
end
end

println("Testing ChainRules.jl")
@testset "ChainRules" begin
include_test("test_helpers.jl")
if isempty(ARGS)
println("Testing ChainRules.jl")
else
println("Testing ChainRules.jl with test_args = ", ARGS)
end

@testset "ChainRules" begin # One overall @testset ensures it keeps going after failures
include("test_helpers.jl")
println()
@testset "rulesets" begin
@testset "Core" begin
include_test("rulesets/Core/core.jl")
end

@testset "Base" begin
include_test("rulesets/Base/base.jl")
include_test("rulesets/Base/fastmath_able.jl")
include_test("rulesets/Base/evalpoly.jl")
include_test("rulesets/Base/array.jl")
include_test("rulesets/Base/arraymath.jl")
include_test("rulesets/Base/indexing.jl")
include_test("rulesets/Base/mapreduce.jl")
include_test("rulesets/Base/sort.jl")
end
println()
# Each file puts all tests inside one or more @testset blocks
include_test("rulesets/Base/base.jl")
include_test("rulesets/Base/fastmath_able.jl")
include_test("rulesets/Base/evalpoly.jl")
include_test("rulesets/Base/array.jl")
include_test("rulesets/Base/arraymath.jl")
include_test("rulesets/Base/indexing.jl")
include_test("rulesets/Base/mapreduce.jl")
include_test("rulesets/Base/sort.jl")

@testset "Statistics" begin
include_test("rulesets/Statistics/statistics.jl")
end
println()
println()

@testset "LinearAlgebra" begin
include_test("rulesets/LinearAlgebra/dense.jl")
include_test("rulesets/LinearAlgebra/norm.jl")
include_test("rulesets/LinearAlgebra/matfun.jl")
include_test("rulesets/LinearAlgebra/structured.jl")
include_test("rulesets/LinearAlgebra/symmetric.jl")
include_test("rulesets/LinearAlgebra/factorization.jl")
include_test("rulesets/LinearAlgebra/blas.jl")
include_test("rulesets/LinearAlgebra/lapack.jl")
end
println()
include_test("rulesets/Statistics/statistics.jl")

@testset "Random" begin
include_test("rulesets/Random/random.jl")
end
println()
end
println()

include_test("rulesets/LinearAlgebra/dense.jl")
include_test("rulesets/LinearAlgebra/norm.jl")
include_test("rulesets/LinearAlgebra/matfun.jl")
include_test("rulesets/LinearAlgebra/structured.jl")
include_test("rulesets/LinearAlgebra/symmetric.jl")
include_test("rulesets/LinearAlgebra/factorization.jl")
include_test("rulesets/LinearAlgebra/blas.jl")
include_test("rulesets/LinearAlgebra/lapack.jl")

println()

include_test("rulesets/Random/random.jl")

println()
end