Skip to content

Commit afd0fe9

Browse files
ChrisRackauckas-ClaudeChrisRackauckasclaude
authored
Use SciMLTesting v1.2 run_tests (#58)
Convert test/runtests.jl to SciMLTesting v1.2. This repo needs the explicit-args form (not bare folder-discovery): the Enzyme/Mooncake test groups run only under "All" yet are not declared in test_groups.toml, and the BigFloat/UnionAll testsets must run under both Core and nopre. Folder-discovery cannot express either, so runtests.jl uses run_tests with explicit core/groups bodies and a curated all = ["Core", "Enzyme", "Mooncake"]. Layout: - Core = test/basictests.jl + test/shared/bigfloat_unionall_tests.jl - nopre = test/nopre/jet_tests.jl (sub-env) + the shared BigFloat/UnionAll file - Enzyme = test/Enzyme/enzyme_tests.jl (main env) - Mooncake = test/Mooncake/mooncake_tests.jl (main env) Behavior-preserving for every CI-reachable GROUP (verified locally on Julia 1.11 via Pkg.test): - Core -> basictests (48) + BigFloat/UnionAll (7) - nopre -> JET (7) + BigFloat/UnionAll (7) - All -> basictests (48) + BigFloat/UnionAll (7, once) + Enzyme (65) + Mooncake (13) Deps: add SciMLTesting + SafeTestsets to the root test target and the nopre sub-env; drop the now-unused Pkg test extra (the harness owns all Pkg ops). Removed the stale committed test/nopre/Manifest.toml (regenerated at run time by the harness's Pkg.develop + instantiate). test/test_groups.toml unchanged. Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8475c49 commit afd0fe9

7 files changed

Lines changed: 85 additions & 330 deletions

File tree

Project.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,18 @@ EnzymeCore = "0.8"
2323
FunctionWrappers = "1"
2424
Mooncake = "0.5"
2525
PrecompileTools = "1"
26+
SafeTestsets = "0.1, 1"
27+
SciMLTesting = "1"
2628
TruncatedStacktraces = "1"
2729
julia = "1.10"
2830

2931
[extras]
3032
Enzyme = "7da242da-08ed-463a-9acd-ee780be4f1d9"
3133
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
3234
Mooncake = "da2b9cff-9c12-43a0-ae48-6db2b0edb7d6"
33-
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
35+
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
36+
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
3437
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
3538

3639
[targets]
37-
test = ["Pkg", "Test", "Enzyme", "EnzymeCore", "Mooncake"]
40+
test = ["Test", "SafeTestsets", "SciMLTesting", "Enzyme", "EnzymeCore", "Mooncake"]

test/nopre/Manifest.toml

Lines changed: 0 additions & 261 deletions
This file was deleted.

test/nopre/Project.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
[deps]
22
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
33
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
4+
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
5+
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
46
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
7+
8+
[sources]
9+
FunctionWrappersWrappers = {path = "../.."}
10+
11+
[compat]
12+
SafeTestsets = "0.0.1, 0.1"
13+
SciMLTesting = "1"
14+
Test = "1"

test/runtests.jl

Lines changed: 29 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,29 @@
1-
using Test, Pkg
2-
3-
const GROUP = get(ENV, "GROUP", "All")
4-
5-
if GROUP == "All" || GROUP == "Core"
6-
@testset "FunctionWrappersWrappers.jl" begin
7-
include("basictests.jl")
8-
end
9-
end
10-
11-
if GROUP == "nopre"
12-
Pkg.activate("nopre")
13-
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
14-
Pkg.instantiate()
15-
include("nopre/jet_tests.jl")
16-
end
17-
18-
@testset "BigFloat support" begin
19-
fwplus_big = FunctionWrappersWrapper(
20-
+,
21-
(Tuple{BigFloat, BigFloat}, Tuple{Float64, Float64}),
22-
(BigFloat, Float64)
23-
)
24-
a = BigFloat("3.14159265358979323846264338327950288")
25-
b = BigFloat("2.71828182845904523536028747135266250")
26-
@test fwplus_big(a, b) isa BigFloat
27-
@test fwplus_big(a, b) == a + b
28-
@test fwplus_big(1.0, 2.0) === 3.0
29-
30-
fwsin_big = FunctionWrappersWrapper(
31-
sin,
32-
(Tuple{BigFloat}, Tuple{Float64}),
33-
(BigFloat, Float64)
34-
)
35-
@test fwsin_big(BigFloat("1.0")) isa BigFloat
36-
@test fwsin_big(1.0) === sin(1.0)
37-
end
38-
39-
@testset "UnionAll return types" begin
40-
# Test that UnionAll types (like AbstractArray{Float64}) work as return types
41-
function double_array(x::AbstractArray{Float64})
42-
return x .* 2
43-
end
44-
45-
fwdouble = FunctionWrappersWrapper(
46-
double_array,
47-
(Tuple{AbstractArray{Float64}},),
48-
(AbstractArray{Float64},)
49-
)
50-
51-
v = [1.0, 2.0, 3.0]
52-
result = fwdouble(v)
53-
@test result isa Vector{Float64}
54-
@test result == [2.0, 4.0, 6.0]
55-
end
56-
57-
if GROUP == "All" || GROUP == "Enzyme"
58-
@testset "Enzyme extension" begin
59-
include("enzyme_tests.jl")
60-
end
61-
end
62-
63-
if GROUP == "All" || GROUP == "Mooncake"
64-
@testset "Mooncake extension" begin
65-
include("mooncake_tests.jl")
66-
end
67-
end
1+
using SafeTestsets
2+
using SciMLTesting
3+
4+
run_tests(;
5+
core = function ()
6+
@safetestset "FunctionWrappersWrappers.jl" begin
7+
include(joinpath(@__DIR__, "basictests.jl"))
8+
end
9+
return @safetestset "BigFloat + UnionAll" begin
10+
include(joinpath(@__DIR__, "shared", "bigfloat_unionall_tests.jl"))
11+
end
12+
end,
13+
groups = Dict(
14+
"nopre" => (;
15+
env = joinpath(@__DIR__, "nopre"),
16+
body = function ()
17+
@safetestset "JET" begin
18+
include(joinpath(@__DIR__, "nopre", "jet_tests.jl"))
19+
end
20+
return @safetestset "BigFloat + UnionAll" begin
21+
include(joinpath(@__DIR__, "shared", "bigfloat_unionall_tests.jl"))
22+
end
23+
end,
24+
),
25+
"Enzyme" => joinpath(@__DIR__, "Enzyme", "enzyme_tests.jl"),
26+
"Mooncake" => joinpath(@__DIR__, "Mooncake", "mooncake_tests.jl"),
27+
),
28+
all = ["Core", "Enzyme", "Mooncake"],
29+
)

0 commit comments

Comments
 (0)