Skip to content

Commit 86d291b

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Use SciMLTesting v1.2 folder-based run_tests (#73)
Replace the hand-written GROUP dispatcher with SciMLTesting's run_tests. Core (core_tests.jl + explicit_imports_test.jl) runs in the main test env for All/Core; NoPre (JET + AllocCheck) runs in its own test/NoPre sub-env only for GROUP=NoPre. test_groups.toml is unchanged; the curated all=["Core"] keeps NoPre out of "All", preserving the original per-GROUP test set exactly. Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6433c71 commit 86d291b

6 files changed

Lines changed: 123 additions & 107 deletions

File tree

Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,18 @@ DiffEqBase = "6.62, 7"
1515
ExplicitImports = "1.14.0"
1616
GeometricIntegrators = "0.15.5, 0.16"
1717
Reexport = "0.2, 1"
18+
SafeTestsets = "0.0.1, 0.1"
1819
SciMLBase = "2, 3"
1920
SciMLLogging = "1.10.1, 2"
21+
SciMLTesting = "1"
2022
julia = "1.10"
2123

2224
[extras]
2325
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
2426
ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5"
25-
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
27+
SafeTestsets = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
28+
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
2629
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2730

2831
[targets]
29-
test = ["ExplicitImports", "ODEProblemLibrary", "Pkg", "Test"]
32+
test = ["ExplicitImports", "ODEProblemLibrary", "SafeTestsets", "SciMLTesting", "Test"]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a"
33
GeometricIntegratorsDiffEq = "5a33fad7-5ce4-5983-9f5d-5f26ceab5c96"
44
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
5+
SafeTestsets = "1e83bf80-4336-4d27-bf5d-d5a4f845583c"
6+
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
57
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
68

79
[compat]
810
AllocCheck = "0.1, 0.2"
911
JET = "0.9, 0.10, 0.11"
12+
SafeTestsets = "0.0.1, 0.1"
13+
SciMLTesting = "1"
File renamed without changes.

test/core_tests.jl

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
using GeometricIntegratorsDiffEq
2+
using GeometricIntegrators
3+
using DiffEqBase: solve, ReturnCode, SecondOrderODEProblem
4+
import ODEProblemLibrary: prob_ode_2Dlinear
5+
using Test
6+
7+
@testset "Standard ODE Problems" begin
8+
prob = prob_ode_2Dlinear
9+
10+
sol = solve(prob, GIEuler(), dt = 0.1)
11+
@test sol.retcode == ReturnCode.Success
12+
sol = solve(prob, GIMidpoint(), dt = 0.1)
13+
@test sol.retcode == ReturnCode.Success
14+
sol = solve(prob, GIHeun2(), dt = 0.1)
15+
@test sol.retcode == ReturnCode.Success
16+
sol = solve(prob, GIHeun3(), dt = 0.1)
17+
@test sol.retcode == ReturnCode.Success
18+
sol = solve(prob, GIRalston2(), dt = 0.1)
19+
@test sol.retcode == ReturnCode.Success
20+
sol = solve(prob, GIRalston3(), dt = 0.1)
21+
@test sol.retcode == ReturnCode.Success
22+
sol = solve(prob, GIRunge(), dt = 0.1)
23+
@test sol.retcode == ReturnCode.Success
24+
sol = solve(prob, GIKutta(), dt = 0.1)
25+
@test sol.retcode == ReturnCode.Success
26+
sol = solve(prob, GIRK416(), dt = 0.1)
27+
@test sol.retcode == ReturnCode.Success
28+
sol = solve(prob, GIRK438(), dt = 0.1)
29+
@test sol.retcode == ReturnCode.Success
30+
sol = solve(prob, GISSPRK3(), dt = 0.1)
31+
@test sol.retcode == ReturnCode.Success
32+
sol = solve(prob, GICrankNicolson(), dt = 0.1)
33+
@test sol.retcode == ReturnCode.Success
34+
sol = solve(prob, GIKraaijevangerSpijker(), dt = 0.1)
35+
@test sol.retcode == ReturnCode.Success
36+
sol = solve(prob, GIQinZhang(), dt = 0.1)
37+
@test sol.retcode == ReturnCode.Success
38+
sol = solve(prob, GICrouzeix(), dt = 0.1)
39+
@test sol.retcode == ReturnCode.Success
40+
sol = solve(prob, GIImplicitEuler(), dt = 0.1)
41+
@test sol.retcode == ReturnCode.Success
42+
sol = solve(prob, GIImplicitMidpoint(), dt = 0.1)
43+
@test sol.retcode == ReturnCode.Success
44+
sol = solve(prob, GISRK3(), dt = 0.1)
45+
@test sol.retcode == ReturnCode.Success
46+
sol = solve(prob, GIGLRK(2), dt = 0.1)
47+
@test sol.retcode == ReturnCode.Success
48+
sol = solve(prob, GIRadauIA(2), dt = 0.1)
49+
@test sol.retcode == ReturnCode.Success
50+
sol = solve(prob, GIRadauIIA(2), dt = 0.1)
51+
@test sol.retcode == ReturnCode.Success
52+
sol = solve(prob, GILobattoIIIA(2), dt = 0.1)
53+
@test sol.retcode == ReturnCode.Success
54+
sol = solve(prob, GILobattoIIIB(2), dt = 0.1)
55+
@test sol.retcode == ReturnCode.Success
56+
sol = solve(prob, GILobattoIIIC(2), dt = 0.1)
57+
@test sol.retcode == ReturnCode.Success
58+
sol = solve(prob, GILobattoIIIC̄(2), dt = 0.1)
59+
@test sol.retcode == ReturnCode.Success
60+
sol = solve(prob, GILobattoIIID(2), dt = 0.1)
61+
@test sol.retcode == ReturnCode.Success
62+
sol = solve(prob, GILobattoIIIE(2), dt = 0.1)
63+
@test sol.retcode == ReturnCode.Success
64+
sol = solve(prob, GILobattoIIIF(2), dt = 0.1)
65+
@test sol.retcode == ReturnCode.Success
66+
end
67+
68+
@testset "Second Order ODE Problems" begin
69+
# Second order ODE problem - use the new 5-argument convention with p parameter
70+
u0 = zeros(2)
71+
v0 = ones(2)
72+
f2 = function (dv, v, u, p, t)
73+
dv .= -u
74+
end
75+
prob = SecondOrderODEProblem{true}(f2, v0, u0, (0.0, 5.0))
76+
77+
sol = solve(prob, GISymplecticEulerA(), dt = 0.1)
78+
@test sol.retcode == ReturnCode.Success
79+
sol = solve(prob, GISymplecticEulerB(), dt = 0.1)
80+
@test sol.retcode == ReturnCode.Success
81+
sol = solve(prob, GILobattoIIIAIIIB(2), dt = 0.1)
82+
@test sol.retcode == ReturnCode.Success
83+
sol = solve(prob, GILobattoIIIBIIIA(2), dt = 0.1)
84+
@test sol.retcode == ReturnCode.Success
85+
end

test/runtests.jl

Lines changed: 29 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,33 @@
1-
using Pkg
1+
using SafeTestsets
22
using Test
3+
using SciMLTesting
34

4-
const GROUP = get(ENV, "GROUP", "All")
5-
6-
if GROUP == "All" || GROUP == "Core"
7-
using GeometricIntegratorsDiffEq
8-
using GeometricIntegrators
9-
using DiffEqBase: solve, ReturnCode, SecondOrderODEProblem
10-
import ODEProblemLibrary: prob_ode_2Dlinear
11-
12-
@testset "GeometricIntegratorsDiffEq" begin
13-
@testset "Standard ODE Problems" begin
14-
prob = prob_ode_2Dlinear
15-
16-
sol = solve(prob, GIEuler(), dt = 0.1)
17-
@test sol.retcode == ReturnCode.Success
18-
sol = solve(prob, GIMidpoint(), dt = 0.1)
19-
@test sol.retcode == ReturnCode.Success
20-
sol = solve(prob, GIHeun2(), dt = 0.1)
21-
@test sol.retcode == ReturnCode.Success
22-
sol = solve(prob, GIHeun3(), dt = 0.1)
23-
@test sol.retcode == ReturnCode.Success
24-
sol = solve(prob, GIRalston2(), dt = 0.1)
25-
@test sol.retcode == ReturnCode.Success
26-
sol = solve(prob, GIRalston3(), dt = 0.1)
27-
@test sol.retcode == ReturnCode.Success
28-
sol = solve(prob, GIRunge(), dt = 0.1)
29-
@test sol.retcode == ReturnCode.Success
30-
sol = solve(prob, GIKutta(), dt = 0.1)
31-
@test sol.retcode == ReturnCode.Success
32-
sol = solve(prob, GIRK416(), dt = 0.1)
33-
@test sol.retcode == ReturnCode.Success
34-
sol = solve(prob, GIRK438(), dt = 0.1)
35-
@test sol.retcode == ReturnCode.Success
36-
sol = solve(prob, GISSPRK3(), dt = 0.1)
37-
@test sol.retcode == ReturnCode.Success
38-
sol = solve(prob, GICrankNicolson(), dt = 0.1)
39-
@test sol.retcode == ReturnCode.Success
40-
sol = solve(prob, GIKraaijevangerSpijker(), dt = 0.1)
41-
@test sol.retcode == ReturnCode.Success
42-
sol = solve(prob, GIQinZhang(), dt = 0.1)
43-
@test sol.retcode == ReturnCode.Success
44-
sol = solve(prob, GICrouzeix(), dt = 0.1)
45-
@test sol.retcode == ReturnCode.Success
46-
sol = solve(prob, GIImplicitEuler(), dt = 0.1)
47-
@test sol.retcode == ReturnCode.Success
48-
sol = solve(prob, GIImplicitMidpoint(), dt = 0.1)
49-
@test sol.retcode == ReturnCode.Success
50-
sol = solve(prob, GISRK3(), dt = 0.1)
51-
@test sol.retcode == ReturnCode.Success
52-
sol = solve(prob, GIGLRK(2), dt = 0.1)
53-
@test sol.retcode == ReturnCode.Success
54-
sol = solve(prob, GIRadauIA(2), dt = 0.1)
55-
@test sol.retcode == ReturnCode.Success
56-
sol = solve(prob, GIRadauIIA(2), dt = 0.1)
57-
@test sol.retcode == ReturnCode.Success
58-
sol = solve(prob, GILobattoIIIA(2), dt = 0.1)
59-
@test sol.retcode == ReturnCode.Success
60-
sol = solve(prob, GILobattoIIIB(2), dt = 0.1)
61-
@test sol.retcode == ReturnCode.Success
62-
sol = solve(prob, GILobattoIIIC(2), dt = 0.1)
63-
@test sol.retcode == ReturnCode.Success
64-
sol = solve(prob, GILobattoIIIC̄(2), dt = 0.1)
65-
@test sol.retcode == ReturnCode.Success
66-
sol = solve(prob, GILobattoIIID(2), dt = 0.1)
67-
@test sol.retcode == ReturnCode.Success
68-
sol = solve(prob, GILobattoIIIE(2), dt = 0.1)
69-
@test sol.retcode == ReturnCode.Success
70-
sol = solve(prob, GILobattoIIIF(2), dt = 0.1)
71-
@test sol.retcode == ReturnCode.Success
5+
run_tests(;
6+
core = function ()
7+
@safetestset "GeometricIntegratorsDiffEq" begin
8+
include("core_tests.jl")
729
end
73-
74-
@testset "Second Order ODE Problems" begin
75-
# Second order ODE problem - use the new 5-argument convention with p parameter
76-
u0 = zeros(2)
77-
v0 = ones(2)
78-
f2 = function (dv, v, u, p, t)
79-
dv .= -u
80-
end
81-
prob = SecondOrderODEProblem{true}(f2, v0, u0, (0.0, 5.0))
82-
83-
sol = solve(prob, GISymplecticEulerA(), dt = 0.1)
84-
@test sol.retcode == ReturnCode.Success
85-
sol = solve(prob, GISymplecticEulerB(), dt = 0.1)
86-
@test sol.retcode == ReturnCode.Success
87-
sol = solve(prob, GILobattoIIIAIIIB(2), dt = 0.1)
88-
@test sol.retcode == ReturnCode.Success
89-
sol = solve(prob, GILobattoIIIBIIIA(2), dt = 0.1)
90-
@test sol.retcode == ReturnCode.Success
10+
return @safetestset "Explicit Imports" begin
11+
include("explicit_imports_test.jl")
9112
end
92-
end # testset GeometricIntegratorsDiffEq
93-
94-
# Run ExplicitImports tests
95-
include("explicit_imports_test.jl")
96-
end
97-
98-
# Run NoPre tests (JET and AllocCheck) in a separate environment
99-
if GROUP == "NoPre"
100-
Pkg.activate("nopre")
101-
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
102-
Pkg.instantiate()
103-
@time @testset "JET Tests" begin
104-
include("nopre/jet.jl")
105-
end
106-
@time @testset "AllocCheck Tests" begin
107-
include("nopre/alloc_tests.jl")
108-
end
109-
end
13+
end,
14+
groups = Dict(
15+
# NoPre runs the JET and AllocCheck tests in their own environment. The
16+
# original dispatcher ran these only for GROUP=="NoPre" (never as part of
17+
# "All"), so NoPre is an env-bearing group kept out of the curated `all`.
18+
"NoPre" => (;
19+
env = joinpath(@__DIR__, "NoPre"),
20+
body = function ()
21+
@time @safetestset "JET Tests" begin
22+
include(joinpath(@__DIR__, "NoPre", "jet.jl"))
23+
end
24+
return @time @safetestset "AllocCheck Tests" begin
25+
include(joinpath(@__DIR__, "NoPre", "alloc_tests.jl"))
26+
end
27+
end,
28+
),
29+
),
30+
# The original runtests.jl ran the Core body for GROUP=All and GROUP=Core, and
31+
# ran NoPre only for GROUP=NoPre (never under "All"). Curate "All" to Core only.
32+
all = ["Core"],
33+
)

0 commit comments

Comments
 (0)