From 6487287d13af75fd805fac733ac9df0e794008ab Mon Sep 17 00:00:00 2001 From: schillic Date: Sun, 24 Nov 2024 22:54:10 +0100 Subject: [PATCH 1/2] run shorter tests in PkgEval mode --- test/algorithms/GLGM06.jl | 18 ++++---- test/algorithms/TMJets.jl | 4 +- test/hybrid/hybrid.jl | 2 +- test/reachsets/reachsets.jl | 2 +- test/runtests.jl | 83 ++++++++++++++++++++++--------------- 5 files changed, 64 insertions(+), 45 deletions(-) diff --git a/test/algorithms/GLGM06.jl b/test/algorithms/GLGM06.jl index 859dd93f40..a12b0c7d92 100644 --- a/test/algorithms/GLGM06.jl +++ b/test/algorithms/GLGM06.jl @@ -14,9 +14,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())) @@ -42,8 +44,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 diff --git a/test/algorithms/TMJets.jl b/test/algorithms/TMJets.jl index 17299be131..76910092e0 100644 --- a/test/algorithms/TMJets.jl +++ b/test/algorithms/TMJets.jl @@ -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 @@ -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) diff --git a/test/hybrid/hybrid.jl b/test/hybrid/hybrid.jl index 6a0c35b1b0..c24c75e5bc 100644 --- a/test/hybrid/hybrid.jl +++ b/test/hybrid/hybrid.jl @@ -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 diff --git a/test/reachsets/reachsets.jl b/test/reachsets/reachsets.jl index 412a5e1aa4..33d6b8e014 100644 --- a/test/reachsets/reachsets.jl +++ b/test/reachsets/reachsets.jl @@ -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) diff --git a/test/runtests.jl b/test/runtests.jl index e60a86329f..50b47450a0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,41 +1,56 @@ 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") + + 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") From 8ed51ecf11bddd13839ae062edd60e6873ee79cb Mon Sep 17 00:00:00 2001 From: Christian Schilling Date: Thu, 9 Jan 2025 18:27:01 +0100 Subject: [PATCH 2/2] Update test/runtests.jl Co-authored-by: Marcelo Forets --- test/runtests.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/test/runtests.jl b/test/runtests.jl index 50b47450a0..fdda9902ce 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,6 +4,7 @@ using Test, ReachabilityAnalysis 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