Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,5 @@ concurrency:

jobs:
tests:
name: "Tests"
strategy:
fail-fast: false
matrix:
version:
- "1"
- "lts"
uses: "SciML/.github/.github/workflows/tests.yml@v1"
with:
julia-version: "${{ matrix.version }}"
uses: "SciML/.github/.github/workflows/grouped-tests.yml@v1"
secrets: "inherit"
9 changes: 5 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ Reexport = "189a3867-3050-52da-a836-e630ba90ab69"

[compat]
DiffEqBase = "6.122, 7"
JET = "0.9, 0.10, 0.11"
MATLAB = "0.8, 0.9, 0.10"
ModelingToolkit = "8, 9, 10, 11"
ParameterizedFunctions = "5"
PrecompileTools = "1"
Reexport = "0.2, 1.0"
julia = "1.6"
Test = "<0.0.1, 1"
julia = "1.10"

[extras]
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
ParameterizedFunctions = "65888b18-ceab-5e60-b2b9-181511a3b968"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "ParameterizedFunctions", "JET"]
test = ["Test", "ParameterizedFunctions", "Pkg"]
34 changes: 5 additions & 29 deletions test/jet_tests.jl
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
# JET.jl static analysis tests for MATLABDiffEq
# These tests verify type stability and catch potential runtime errors
# They can run without MATLAB installed since they only test Julia code
# Static type-stability tests for MATLABDiffEq
# These tests verify type stability and catch potential runtime errors.
# They run without MATLAB installed since they only test Julia code.
# JET/Aqua static analysis of the package itself lives in the QA group
# (test/qa/qa.jl); this file holds the functional type-stability checks.

using Test
using DiffEqBase

# JET is an optional test dependency
const HAS_JET = try
@eval using JET
true
catch
false
end

# Import buildDEStats for testing - we need to access it from the module
# Since MATLABDiffEq requires MATLAB, we'll test the function pattern directly

Expand Down Expand Up @@ -65,14 +59,6 @@ end
result_partial = buildDEStats_test(partial_stats)
@test result_partial.nf == 42
@test result_partial.nreject == 0

# JET analysis - verify no obvious errors in the function
if HAS_JET
rep = JET.report_call(buildDEStats_test, (Dict{String, Any},))
# We expect some reports due to Dict{String, Any} type uncertainty
# but the function should still be valid
@test true # Function analyzed successfully
end
end

@testset "Algorithm struct definitions" begin
Expand Down Expand Up @@ -126,16 +112,6 @@ end
@test _is_matlab_compatible_eltype_test(BigFloat) === false
@test _is_matlab_compatible_eltype_test(BigInt) === false
@test _is_matlab_compatible_eltype_test(Float32) === false

# JET @test_opt analysis for type stability
if HAS_JET
@testset "JET @test_opt type stability" begin
# Test type stability of _is_matlab_compatible_eltype
@test_opt _is_matlab_compatible_eltype_test(Float64)
@test_opt _is_matlab_compatible_eltype_test(Int64)
@test_opt _is_matlab_compatible_eltype_test(BigFloat)
end
end
end

@testset "Return type inference" begin
Expand Down
14 changes: 14 additions & 0 deletions test/qa/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[deps]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
MATLABDiffEq = "e2752cbe-bcf4-5895-8727-84ebc14a76bd"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[sources]
MATLABDiffEq = {path = "../.."}

[compat]
Aqua = "0.8"
JET = "0.9, 0.10, 0.11"
Test = "<0.0.1, 1"
julia = "1.10"
11 changes: 11 additions & 0 deletions test/qa/qa.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using MATLABDiffEq, Aqua, JET
using Test

@testset "Aqua" begin
Aqua.test_all(MATLABDiffEq)
end

@testset "JET static analysis" begin
rep = JET.report_package(MATLABDiffEq; target_modules = (MATLABDiffEq,))
@test length(JET.get_reports(rep)) == 0
end
104 changes: 62 additions & 42 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,44 +1,64 @@
using DiffEqBase, MATLABDiffEq, ParameterizedFunctions, Test

# Interface tests - these test type validation without needing MATLAB runtime
include("interface_tests.jl")

# JET static analysis tests - these also run without MATLAB
include("jet_tests.jl")

# The following tests require MATLAB runtime to be available
# They test the actual ODE solving functionality

f = @ode_def_bare LotkaVolterra begin
dx = a * x - b * x * y
dy = -c * y + d * x * y
end a b c d
p = [1.5, 1, 3, 1]
tspan = (0.0, 10.0)
u0 = [1.0, 1.0]
prob = ODEProblem(f, u0, tspan, p)
sol = solve(prob, MATLABDiffEq.ode45())

function lorenz(du, u, p, t)
du[1] = 10.0(u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
return du[3] = u[1] * u[2] - (8 / 3) * u[3]
using Pkg
using Test
using DiffEqBase, MATLABDiffEq, ParameterizedFunctions

const GROUP = get(ENV, "GROUP", "Core")

# QA (Aqua + JET) runs in an isolated environment (test/qa) so its tooling deps
# never enter the main test target's resolve. On Julia < 1.11 the [sources] table
# is ignored, so develop the package by path to test the PR branch code.
function activate_qa_env()
Pkg.activate(joinpath(@__DIR__, "qa"))
Pkg.develop(PackageSpec(path = dirname(@__DIR__)))
return Pkg.instantiate()
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz, u0, tspan)
sol = solve(prob, MATLABDiffEq.ode45())

algs = [
MATLABDiffEq.ode23
MATLABDiffEq.ode45
MATLABDiffEq.ode113
MATLABDiffEq.ode23s
MATLABDiffEq.ode23t
MATLABDiffEq.ode23tb
MATLABDiffEq.ode15s
]

for alg in algs
sol = solve(prob, alg())

if GROUP == "Core" || GROUP == "All"
# Interface tests - these test type validation without needing MATLAB runtime
include("interface_tests.jl")

# Static type-stability tests - these also run without MATLAB
include("jet_tests.jl")

# The following tests require MATLAB runtime to be available
# They test the actual ODE solving functionality

f = @ode_def_bare LotkaVolterra begin
dx = a * x - b * x * y
dy = -c * y + d * x * y
end a b c d
p = [1.5, 1, 3, 1]
tspan = (0.0, 10.0)
u0 = [1.0, 1.0]
prob = ODEProblem(f, u0, tspan, p)
sol = solve(prob, MATLABDiffEq.ode45())

function lorenz(du, u, p, t)
du[1] = 10.0(u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
return du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
u0 = [1.0; 0.0; 0.0]
tspan = (0.0, 100.0)
prob = ODEProblem(lorenz, u0, tspan)
sol = solve(prob, MATLABDiffEq.ode45())

algs = [
MATLABDiffEq.ode23
MATLABDiffEq.ode45
MATLABDiffEq.ode113
MATLABDiffEq.ode23s
MATLABDiffEq.ode23t
MATLABDiffEq.ode23tb
MATLABDiffEq.ode15s
]

for alg in algs
sol = solve(prob, alg())
end
end

if GROUP == "QA"
activate_qa_env()
include("qa/qa.jl")
end
13 changes: 13 additions & 0 deletions test/test_groups.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Root MATLABDiffEq.jl test-group matrix, consumed by the reusable
# grouped-tests.yml@v1 caller (.github/workflows/Tests.yml) via
# scripts/compute_affected_sublibraries.jl --root-matrix. Each group runs on
# every Julia version it lists; runtests.jl dispatches on GROUP.
#
# Core reproduces the old Tests.yml matrix (the whole suite on "lts" and "1").
# QA is newly split out: Aqua + JET run in the isolated test/qa environment.

[Core]
versions = ["lts", "1"]

[QA]
versions = ["lts", "1"]
Loading