From d7efeefd848d695e2c811c5169911277d2dcacb8 Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sun, 14 Jun 2026 08:58:52 -0400 Subject: [PATCH] Use SciMLTesting v1.2 folder-based run_tests 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: Chris Rackauckas Co-Authored-By: Claude Opus 4.8 (1M context) --- Project.toml | 7 +- test/{nopre => NoPre}/Project.toml | 4 + test/{nopre => NoPre}/alloc_tests.jl | 0 test/{nopre => NoPre}/jet.jl | 0 test/core_tests.jl | 85 +++++++++++++++++ test/runtests.jl | 134 ++++++--------------------- 6 files changed, 123 insertions(+), 107 deletions(-) rename test/{nopre => NoPre}/Project.toml (64%) rename test/{nopre => NoPre}/alloc_tests.jl (100%) rename test/{nopre => NoPre}/jet.jl (100%) create mode 100644 test/core_tests.jl diff --git a/Project.toml b/Project.toml index 44dfafb..63a753d 100644 --- a/Project.toml +++ b/Project.toml @@ -15,15 +15,18 @@ DiffEqBase = "6.62, 7" ExplicitImports = "1.14.0" GeometricIntegrators = "0.15.5, 0.16" Reexport = "0.2, 1" +SafeTestsets = "0.0.1, 0.1" SciMLBase = "2, 3" SciMLLogging = "1.10.1, 2" +SciMLTesting = "1" julia = "1.10" [extras] ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7" ODEProblemLibrary = "fdc4e326-1af4-4b90-96e7-779fcce2daa5" -Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" +SafeTestsets = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["ExplicitImports", "ODEProblemLibrary", "Pkg", "Test"] +test = ["ExplicitImports", "ODEProblemLibrary", "SafeTestsets", "SciMLTesting", "Test"] diff --git a/test/nopre/Project.toml b/test/NoPre/Project.toml similarity index 64% rename from test/nopre/Project.toml rename to test/NoPre/Project.toml index 3f36bca..8d53d9d 100644 --- a/test/nopre/Project.toml +++ b/test/NoPre/Project.toml @@ -2,8 +2,12 @@ AllocCheck = "9b6a8646-10ed-4001-bbdc-1d2f46dfbb1a" GeometricIntegratorsDiffEq = "5a33fad7-5ce4-5983-9f5d-5f26ceab5c96" JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b" +SafeTestsets = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" +SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] AllocCheck = "0.1, 0.2" JET = "0.9, 0.10, 0.11" +SafeTestsets = "0.0.1, 0.1" +SciMLTesting = "1" diff --git a/test/nopre/alloc_tests.jl b/test/NoPre/alloc_tests.jl similarity index 100% rename from test/nopre/alloc_tests.jl rename to test/NoPre/alloc_tests.jl diff --git a/test/nopre/jet.jl b/test/NoPre/jet.jl similarity index 100% rename from test/nopre/jet.jl rename to test/NoPre/jet.jl diff --git a/test/core_tests.jl b/test/core_tests.jl new file mode 100644 index 0000000..3f56537 --- /dev/null +++ b/test/core_tests.jl @@ -0,0 +1,85 @@ +using GeometricIntegratorsDiffEq +using GeometricIntegrators +using DiffEqBase: solve, ReturnCode, SecondOrderODEProblem +import ODEProblemLibrary: prob_ode_2Dlinear +using Test + +@testset "Standard ODE Problems" begin + prob = prob_ode_2Dlinear + + sol = solve(prob, GIEuler(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIMidpoint(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIHeun2(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIHeun3(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIRalston2(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIRalston3(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIRunge(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIKutta(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIRK416(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIRK438(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GISSPRK3(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GICrankNicolson(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIKraaijevangerSpijker(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIQinZhang(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GICrouzeix(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIImplicitEuler(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIImplicitMidpoint(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GISRK3(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIGLRK(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIRadauIA(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GIRadauIIA(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIIA(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIIB(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIIC(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIIC̄(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIID(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIIE(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIIF(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success +end + +@testset "Second Order ODE Problems" begin + # Second order ODE problem - use the new 5-argument convention with p parameter + u0 = zeros(2) + v0 = ones(2) + f2 = function (dv, v, u, p, t) + dv .= -u + end + prob = SecondOrderODEProblem{true}(f2, v0, u0, (0.0, 5.0)) + + sol = solve(prob, GISymplecticEulerA(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GISymplecticEulerB(), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIIAIIIB(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success + sol = solve(prob, GILobattoIIIBIIIA(2), dt = 0.1) + @test sol.retcode == ReturnCode.Success +end diff --git a/test/runtests.jl b/test/runtests.jl index 1500b98..81b4385 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,109 +1,33 @@ -using Pkg +using SafeTestsets using Test +using SciMLTesting -const GROUP = get(ENV, "GROUP", "All") - -if GROUP == "All" || GROUP == "Core" - using GeometricIntegratorsDiffEq - using GeometricIntegrators - using DiffEqBase: solve, ReturnCode, SecondOrderODEProblem - import ODEProblemLibrary: prob_ode_2Dlinear - - @testset "GeometricIntegratorsDiffEq" begin - @testset "Standard ODE Problems" begin - prob = prob_ode_2Dlinear - - sol = solve(prob, GIEuler(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIMidpoint(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIHeun2(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIHeun3(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIRalston2(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIRalston3(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIRunge(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIKutta(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIRK416(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIRK438(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GISSPRK3(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GICrankNicolson(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIKraaijevangerSpijker(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIQinZhang(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GICrouzeix(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIImplicitEuler(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIImplicitMidpoint(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GISRK3(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIGLRK(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIRadauIA(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GIRadauIIA(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIIA(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIIB(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIIC(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIIC̄(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIID(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIIE(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIIF(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success +run_tests(; + core = function () + @safetestset "GeometricIntegratorsDiffEq" begin + include("core_tests.jl") end - - @testset "Second Order ODE Problems" begin - # Second order ODE problem - use the new 5-argument convention with p parameter - u0 = zeros(2) - v0 = ones(2) - f2 = function (dv, v, u, p, t) - dv .= -u - end - prob = SecondOrderODEProblem{true}(f2, v0, u0, (0.0, 5.0)) - - sol = solve(prob, GISymplecticEulerA(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GISymplecticEulerB(), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIIAIIIB(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success - sol = solve(prob, GILobattoIIIBIIIA(2), dt = 0.1) - @test sol.retcode == ReturnCode.Success + return @safetestset "Explicit Imports" begin + include("explicit_imports_test.jl") end - end # testset GeometricIntegratorsDiffEq - - # Run ExplicitImports tests - include("explicit_imports_test.jl") -end - -# Run NoPre tests (JET and AllocCheck) in a separate environment -if GROUP == "NoPre" - Pkg.activate("nopre") - Pkg.develop(PackageSpec(path = dirname(@__DIR__))) - Pkg.instantiate() - @time @testset "JET Tests" begin - include("nopre/jet.jl") - end - @time @testset "AllocCheck Tests" begin - include("nopre/alloc_tests.jl") - end -end + end, + groups = Dict( + # NoPre runs the JET and AllocCheck tests in their own environment. The + # original dispatcher ran these only for GROUP=="NoPre" (never as part of + # "All"), so NoPre is an env-bearing group kept out of the curated `all`. + "NoPre" => (; + env = joinpath(@__DIR__, "NoPre"), + body = function () + @time @safetestset "JET Tests" begin + include(joinpath(@__DIR__, "NoPre", "jet.jl")) + end + return @time @safetestset "AllocCheck Tests" begin + include(joinpath(@__DIR__, "NoPre", "alloc_tests.jl")) + end + end, + ), + ), + # The original runtests.jl ran the Core body for GROUP=All and GROUP=Core, and + # ran NoPre only for GROUP=NoPre (never under "All"). Curate "All" to Core only. + all = ["Core"], +)