Skip to content

Commit

Permalink
Merge pull request #882 from JuliaReach/schillic/pkgeval
Browse files Browse the repository at this point in the history
Run shorter tests in PkgEval mode
  • Loading branch information
schillic authored Jan 9, 2025
2 parents 5cb940d + 8ed51ec commit 0e4056f
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 45 deletions.
18 changes: 11 additions & 7 deletions test/algorithms/GLGM06.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@
@test dim(sol) == 5

# static option
sol = solve(prob; T=5.0, alg=GLGM06(; δ=0.01, static=true))
ZS = Zonotope{Float64,SVector{5,Float64},SMatrix{5,16,Float64,80}}
@test setrep(sol) == ZS
@ts begin
sol = solve(prob; T=5.0, alg=GLGM06(; δ=0.01, static=true))
ZS = Zonotope{Float64,SVector{5,Float64},SMatrix{5,16,Float64,80}}
@test setrep(sol) == ZS
end

# use approx model for "discrete-time" reachability
sol = solve(prob; T=5.0, alg=GLGM06(; δ=0.01, approx_model=NoBloating()))
Expand All @@ -49,8 +51,10 @@ end
@test rsetrep(sol) == RT

# static case
alg = GLGM06(; δ=1e-2, static=true, dim=8, max_order=1, ngens=8)
sol = solve(prob; T=20.0, alg=alg)
RT = ReachSet{Float64,Zonotope{Float64,SVector{8,Float64},SMatrix{8,8,Float64,64}}}
@test rsetrep(sol) == RT
@ts begin
alg = GLGM06(; δ=1e-2, static=true, dim=8, max_order=1, ngens=8)
sol = solve(prob; T=20.0, alg=alg)
RT = ReachSet{Float64,Zonotope{Float64,SVector{8,Float64},SMatrix{8,8,Float64,64}}}
@test rsetrep(sol) == RT
end
end
4 changes: 2 additions & 2 deletions test/algorithms/TMJets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@test flowpipe(sols) isa MixedFlowpipe
end

@testset "TMJets algorithm (TMJets21b): linear IVPs" begin
@ts @testset "TMJets algorithm (TMJets21b): linear IVPs" begin
prob, dt = exponential_1d()
sol = solve(prob; tspan=dt, alg=TMJets())
@test sol.alg isa TMJets
Expand Down Expand Up @@ -87,7 +87,7 @@ end
@test [0.3] overapproximate(sol[m + 1], Zonotope)
end

@testset "1D Burgers equation (TMJets21b)" begin
@ts @testset "1D Burgers equation (TMJets21b)" begin
L0 = 1.0 # domain length
U0 = 1.0 # Re = 20.
x = range(-0.5 * L0, 0.5 * L0; length=4)
Expand Down
2 changes: 1 addition & 1 deletion test/hybrid/hybrid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ end
# tested in test/algorithms/ASB07.jl
end

@testset "Thermostat simulations" begin
@ts @testset "Thermostat simulations" begin
S = thermostat()
T = 5.0

Expand Down
2 changes: 1 addition & 1 deletion test/reachsets/reachsets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end
@test all(x -> isequivalent(Bt, overapproximate(set(x), Hyperrectangle)), [p1, p2, p3, p4])
end

@testset "Conversion of Taylor model reach-sets" begin
@ts @testset "Conversion of Taylor model reach-sets" begin
H = Hyperrectangle(ones(2), [0.2, 0.4])
a = overapproximate(H, TaylorModelReachSet)
b = convert(TaylorModelReachSet, H)
Expand Down
84 changes: 50 additions & 34 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,41 +1,57 @@
using Test, ReachabilityAnalysis

TEST_MODELS = ["models/harmonic_oscillator.jl",
"models/forced_oscillator.jl",
"models/exponential1D.jl",
"models/motor.jl",
"models/linear5D.jl",
"models/generated/VanDerPol.jl",
"models/EMBrake.jl",
"models/bouncing_ball.jl",
"models/burgers.jl",
"models/generated/Brusselator.jl",
"models/hybrid/thermostat.jl"]

TEST_FILES = ["continuous/solve.jl",
"continuous/symbolics.jl",
"continuous/traces.jl",
"discretization/exponentiation.jl",
"flowpipes/flowpipes.jl",
"flowpipes/setops.jl",
"reachsets/reachsets.jl",
"hybrid/hybrid.jl"]

TEST_ALGORITHMS = ["algorithms/INT.jl",
"algorithms/BOX.jl",
"algorithms/CARLIN.jl",
"algorithms/GLGM06.jl",
"algorithms/LGG09.jl",
"algorithms/ASB07.jl",
"algorithms/BFFPSV18.jl",
"algorithms/TMJets.jl",
"algorithms/ORBIT.jl",
"algorithms/QINT.jl",
"algorithms/VREP.jl",
"algorithms/FLOWSTAR.jl"]
# auxiliary code to skip expensive tests
begin
__test_short = haskey(ENV, "JULIA_PKGEVAL")

"Use the macro `ts` for tests which are deemed too slow and make the pipeline fail when running PkgEval."
macro ts(arg)
if !__test_short
quote
$(esc(arg))
end
end
end

fn(vec) = [e for e in vec if !isnothing(e)]
end

TEST_MODELS = fn(["models/harmonic_oscillator.jl",
"models/forced_oscillator.jl",
"models/exponential1D.jl",
"models/motor.jl",
"models/linear5D.jl",
"models/generated/VanDerPol.jl",
"models/EMBrake.jl",
"models/bouncing_ball.jl",
@ts("models/burgers.jl"),
@ts("models/generated/Brusselator.jl"),
@ts("models/hybrid/thermostat.jl")])

TEST_FILES = fn(["continuous/solve.jl",
@ts("continuous/symbolics.jl"),
@ts("continuous/traces.jl"),
@ts("discretization/exponentiation.jl"),
"flowpipes/flowpipes.jl",
@ts("flowpipes/setops.jl"),
"reachsets/reachsets.jl",
"hybrid/hybrid.jl"])

TEST_ALGORITHMS = fn(["algorithms/INT.jl",
"algorithms/BOX.jl",
@ts("algorithms/CARLIN.jl"),
"algorithms/GLGM06.jl",
"algorithms/LGG09.jl",
@ts("algorithms/ASB07.jl"),
"algorithms/BFFPSV18.jl",
"algorithms/TMJets.jl",
"algorithms/ORBIT.jl",
"algorithms/QINT.jl",
@ts("algorithms/VREP.jl"),
@ts("algorithms/FLOWSTAR.jl")])

foreach(include, TEST_MODELS)
foreach(include, TEST_FILES)
foreach(include, TEST_ALGORITHMS)

include("Aqua.jl")
@ts include("Aqua.jl")

0 comments on commit 0e4056f

Please sign in to comment.