Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Clean up the testing #144

Merged
merged 1 commit into from
May 17, 2024
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
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ env:
JULIA_PKG_SERVER: ""
RETESTITEMS_NWORKERS: 4
RETESTITEMS_NWORKER_THREADS: 2
SECRET_CODECOV_TOKEN: "HsC3X/h3CrsRhMR199BUbw9xmASfTTEtdT2JMJlbkW6nsMtZXDIWxKzBNOpn0123zn3K+VE30i7+aLpcqZjlux0BQDMVLx5O5KudjrJmBE2G8KMMv1pra+UHEOFdFP3TzjHXGcHzpUrjpG8if8cHbsWdyQCV0Hdx2qAPnhX5haGPyMuIlRfoaWQfdxJPl5fDLXs1xe0LnMcYMx8uUsvvJZ/hhFtMYWJU0WFtqnAkCR8h/pQd6yZOaGP2SXJkOR8+1xbx+M8m6agH9idp2BjDPpXMOo27V3O2Gkoy3R4b5ouLdqOMaZSIOemoYCv6oh+EkbKaFvZydvm0xCW5YBFPPw==;U2FsdGVkX19FT0yFV6EMY/NVSQslXE6byckN0qa/HVU5dd3d4swmOCWBkBPtemRPGvCMP669iXSPfDTlw7ZSvw=="
SECRET_CODECOV_TOKEN: "HsC3X/h3CrsRhMR199BUbw9xmASfTTEtdT2JMJlbkW6nsMtZXDIWxKzBNOpn0123zn3K+VE30i7+aLpcqZjlux0BQDMVLx5O5KudjrJmBE2G8KMMv1pra+UHEOFdFP3TzjHXGcHzpUrjpG8if8cHbsWdyQCV0Hdx2qAPnhX5haGPyMuIlRfoaWQfdxJPl5fDLXs1xe0LnMcYMx8uUsvvJZ/hhFtMYWJU0WFtqnAkCR8h/pQd6yZOaGP2SXJkOR8+1xbx+M8m6agH9idp2BjDPpXMOo27V3O2Gkoy3R4b5ouLdqOMaZSIOemoYCv6oh+EkbKaFvZydvm0xCW5YBFPPw==;U2FsdGVkX19FT0yFV6EMY/NVSQslXE6byckN0qa/HVU5dd3d4swmOCWBkBPtemRPGvCMP669iXSPfDTlw7ZSvw=="
43 changes: 5 additions & 38 deletions .github/workflows/FormatCheck.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,9 @@
name: format-check
name: Format suggestions

on:
push:
branches:
- 'main'
- 'release-'
tags: '*'
pull_request:
on: [pull_request]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
julia-version: [1]
julia-arch: [x86]
os: [ubuntu-latest]
code-style:
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@latest
with:
version: ${{ matrix.julia-version }}

- uses: actions/checkout@v4
- name: Install JuliaFormatter and format
# This will use the latest version by default but you can set the version like so:
#
# julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter", version="0.13.0"))'
run: |
julia -e 'using Pkg; Pkg.add(PackageSpec(name="JuliaFormatter"))'
julia -e 'using JuliaFormatter; format(".", verbose=true)'
- name: Format check
run: |
julia -e '
out = Cmd(`git diff --name-only`) |> read |> String
if out == ""
exit(0)
else
@error "Some files have not been formatted !!!"
write(stdout, out)
exit(1)
end'
- uses: julia-actions/julia-format@v2
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ SimpleNonlinearSolveTrackerExt = "Tracker"
SimpleNonlinearSolveZygoteExt = "Zygote"

[compat]
ADTypes = "1"
ADTypes = "1.2"
AllocCheck = "0.1.1"
Aqua = "0.8"
ArrayInterface = "7.8"
ArrayInterface = "7.9"
CUDA = "5.2"
ChainRulesCore = "1.22"
ConcreteStructs = "0.2.3"
Expand All @@ -49,7 +49,7 @@ FastClosures = "0.3.2"
FiniteDiff = "2.22"
ForwardDiff = "0.10.36"
LinearAlgebra = "1.10"
LinearSolve = "2.25"
LinearSolve = "2.30"
MaybeInplace = "0.1.1"
NonlinearProblemLibrary = "0.1.2"
Pkg = "1.10"
Expand All @@ -59,8 +59,8 @@ Random = "1.10"
ReTestItems = "1.23"
Reexport = "1.2"
ReverseDiff = "1.15"
SciMLBase = "2.28.0"
SciMLSensitivity = "7.56"
SciMLBase = "2.37.0"
SciMLSensitivity = "7.58"
StaticArrays = "1.9"
StaticArraysCore = "1.4.2"
Test = "1.10"
Expand Down
16 changes: 10 additions & 6 deletions test/core/23_test_problems_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ end
export problems, dicts, test_on_library
end

@testitem "SimpleNewtonRaphson" setup=[RobustnessTesting] begin
@testitem "SimpleNewtonRaphson" setup=[RobustnessTesting] tags=[:core] begin
alg_ops = (SimpleNewtonRaphson(),)

broken_tests = Dict(alg => Int[] for alg in alg_ops)
Expand All @@ -50,7 +50,7 @@ end
test_on_library(problems, dicts, alg_ops, broken_tests)
end

@testitem "SimpleTrustRegion" setup=[RobustnessTesting] begin
@testitem "SimpleTrustRegion" setup=[RobustnessTesting] tags=[:core] begin
alg_ops = (SimpleTrustRegion(),
SimpleTrustRegion(; nlsolve_update_rule = Val(true)))

Expand All @@ -61,16 +61,20 @@ end
test_on_library(problems, dicts, alg_ops, broken_tests)
end

@testitem "SimpleDFSane" setup=[RobustnessTesting] begin
@testitem "SimpleDFSane" setup=[RobustnessTesting] tags=[:core] begin
alg_ops = (SimpleDFSane(),)

broken_tests = Dict(alg => Int[] for alg in alg_ops)
broken_tests[alg_ops[1]] = [1, 2, 3, 4, 5, 6, 11, 21]
if Sys.isapple()
broken_tests[alg_ops[1]] = [1, 2, 3, 5, 6, 21]
else
broken_tests[alg_ops[1]] = [1, 2, 3, 4, 5, 6, 11, 21]
end

test_on_library(problems, dicts, alg_ops, broken_tests)
end

@testitem "SimpleBroyden" retries=5 setup=[RobustnessTesting] begin
@testitem "SimpleBroyden" retries=5 setup=[RobustnessTesting] tags=[:core] begin
alg_ops = (SimpleBroyden(),)

broken_tests = Dict(alg => Int[] for alg in alg_ops)
Expand All @@ -79,7 +83,7 @@ end
test_on_library(problems, dicts, alg_ops, broken_tests)
end

@testitem "SimpleKlement" setup=[RobustnessTesting] begin
@testitem "SimpleKlement" setup=[RobustnessTesting] tags=[:core] begin
alg_ops = (SimpleKlement(),)

broken_tests = Dict(alg => Int[] for alg in alg_ops)
Expand Down
2 changes: 1 addition & 1 deletion test/core/adjoint_tests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testitem "Simple Adjoint Test" begin
@testitem "Simple Adjoint Test" tags=[:core] begin
using ForwardDiff, ReverseDiff, SciMLSensitivity, Tracker, Zygote

ff(u, p) = u .^ 2 .- p
Expand Down
2 changes: 1 addition & 1 deletion test/core/aqua_tests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testitem "Aqua" begin
@testitem "Aqua" tags=[:core] begin
using Aqua

Aqua.test_all(SimpleNonlinearSolve; piracies = false, ambiguities = false)
Expand Down
4 changes: 2 additions & 2 deletions test/core/forward_ad_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ __compatible(::SimpleHalley, ::Val{:iip}) = false
export test_f, test_f!, jacobian_f, solve_with, __compatible
end

@testitem "ForwardDiff.jl Integration: Rootfinding" setup=[ForwardADRootfindingTesting] begin
@testitem "ForwardDiff.jl Integration: Rootfinding" setup=[ForwardADRootfindingTesting] tags=[:core] begin
@testset "$(nameof(typeof(alg)))" for alg in (SimpleNewtonRaphson(),
SimpleTrustRegion(), SimpleTrustRegion(; nlsolve_update_rule = Val(true)),
SimpleHalley(), SimpleBroyden(), SimpleKlement(), SimpleDFSane())
Expand Down Expand Up @@ -133,7 +133,7 @@ export loss_function, loss_function!, loss_function_jac, loss_function_vjp,
loss_function_jac!, loss_function_vjp!, θ_init, x, y_target
end

@testitem "ForwardDiff.jl Integration: NLLS" setup=[ForwardADNLLSTesting] begin
@testitem "ForwardDiff.jl Integration: NLLS" setup=[ForwardADNLLSTesting] tags=[:core] begin
@testset "$(nameof(typeof(alg)))" for alg in (
SimpleNewtonRaphson(), SimpleGaussNewton(),
SimpleNewtonRaphson(AutoFiniteDiff()), SimpleGaussNewton(AutoFiniteDiff()))
Expand Down
2 changes: 1 addition & 1 deletion test/core/least_squares_tests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testitem "Nonlinear Least Squares" begin
@testitem "Nonlinear Least Squares" tags=[:core] begin
using LinearAlgebra

true_function(x, θ) = @. θ[1] * exp(θ[2] * x) * cos(θ[3] * x + θ[4])
Expand Down
2 changes: 1 addition & 1 deletion test/core/matrix_resizing_tests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testitem "Matrix Resizing" begin
@testitem "Matrix Resizing" tags=[:core] begin
ff(u, p) = u .* u .- p
u0 = ones(2, 3)
p = 2.0
Expand Down
48 changes: 10 additions & 38 deletions test/core/rootfind_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export quadratic_f, quadratic_f!, quadratic_f2, newton_fails, TERMINATION_CONDIT

end

@testitem "First Order Methods" setup=[RootfindingTesting] begin
@testitem "First Order Methods" setup=[RootfindingTesting] tags=[:core] begin
@testset "$(alg)" for alg in (SimpleNewtonRaphson, SimpleTrustRegion,
(args...; kwargs...) -> SimpleTrustRegion(args...; nlsolve_update_rule = Val(true),
kwargs...))
Expand Down Expand Up @@ -70,7 +70,7 @@ end
end
end

@testitem "SimpleHalley" setup=[RootfindingTesting] begin
@testitem "SimpleHalley" setup=[RootfindingTesting] tags=[:core] begin
@testset "AutoDiff: $(nameof(typeof(autodiff)))" for autodiff in (AutoFiniteDiff(),
AutoForwardDiff())
@testset "[OOP] u0: $(nameof(typeof(u0)))" for u0 in ([1.0, 1.0],
Expand All @@ -89,7 +89,7 @@ end
end
end

@testitem "Derivative Free Metods" setup=[RootfindingTesting] begin
@testitem "Derivative Free Metods" setup=[RootfindingTesting] tags=[:core] begin
@testset "$(nameof(typeof(alg)))" for alg in [SimpleBroyden(), SimpleKlement(),
SimpleDFSane(), SimpleLimitedMemoryBroyden(),
SimpleBroyden(; linesearch = Val(true)),
Expand All @@ -115,7 +115,7 @@ end
end
end

@testitem "Newton Fails" setup=[RootfindingTesting] begin
@testitem "Newton Fails" setup=[RootfindingTesting] tags=[:core] begin
u0 = [-10.0, -1.0, 1.0, 2.0, 3.0, 4.0, 10.0]
p = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]

Expand All @@ -127,13 +127,13 @@ end
end
end

@testitem "Kwargs Propagation" setup=[RootfindingTesting] begin
@testitem "Kwargs Propagation" setup=[RootfindingTesting] tags=[:core] begin
prob = NonlinearProblem(quadratic_f, ones(4), 2.0; maxiters = 2)
sol = solve(prob, SimpleNewtonRaphson())
@test sol.retcode === ReturnCode.MaxIters
end

@testitem "Allocation Checks" setup=[RootfindingTesting] begin
@testitem "Allocation Checks" setup=[RootfindingTesting] tags=[:core] begin
if Sys.islinux() # Very slow on other OS
@testset "$(nameof(typeof(alg)))" for alg in (SimpleNewtonRaphson(),
SimpleHalley(), SimpleBroyden(), SimpleKlement(), SimpleLimitedMemoryBroyden(),
Expand Down Expand Up @@ -165,7 +165,7 @@ end
end
end

@testitem "Interval Nonlinear Problems" setup=[RootfindingTesting] begin
@testitem "Interval Nonlinear Problems" setup=[RootfindingTesting] tags=[:core] begin
@testset "$(nameof(typeof(alg)))" for alg in (Bisection(), Falsi(), Ridder(), Brent(),
ITP(), Alefeld())
tspan = (1.0, 20.0)
Expand Down Expand Up @@ -209,7 +209,7 @@ end
end
end

@testitem "Tolerance Tests Interval Methods" setup=[RootfindingTesting] begin
@testitem "Tolerance Tests Interval Methods" setup=[RootfindingTesting] tags=[:core] begin
@testset "$(nameof(typeof(alg)))" for alg in (Bisection(), Falsi(), ITP())
tspan = (1.0, 20.0)
probB = IntervalNonlinearProblem(quadratic_f, tspan, 2.0)
Expand All @@ -224,7 +224,7 @@ end
end
end

@testitem "Tolerance Tests Interval Methods 2" setup=[RootfindingTesting] begin
@testitem "Tolerance Tests Interval Methods 2" setup=[RootfindingTesting] tags=[:core] begin
@testset "$(nameof(typeof(alg)))" for alg in (Ridder(), Brent())
tspan = (1.0, 20.0)
probB = IntervalNonlinearProblem(quadratic_f, tspan, 2.0)
Expand All @@ -239,7 +239,7 @@ end
end
end

@testitem "Flipped Signs and Reversed Tspan" setup=[RootfindingTesting] begin
@testitem "Flipped Signs and Reversed Tspan" setup=[RootfindingTesting] tags=[:core] begin
@testset "$(nameof(typeof(alg)))" for alg in (Alefeld(), Bisection(), Falsi(), Brent(),
ITP(), Ridder())
f1(u, p) = u * u - p
Expand All @@ -257,31 +257,3 @@ end
end
end
end

# The following tests were included in the previos versions but these kwargs never did
# anything!
# # Garuntee Tests for Bisection
# f = function (u, p)
# if u < 2.0
# return u - 2.0
# elseif u > 3.0
# return u - 3.0
# else
# return 0.0
# end
# end
# probB = IntervalNonlinearProblem(f, (0.0, 4.0))

# sol = solve(probB, Bisection(; exact_left = true))
# @test f(sol.left, nothing) < 0.0
# @test f(nextfloat(sol.left), nothing) >= 0.0

# sol = solve(probB, Bisection(; exact_right = true))
# @test f(sol.right, nothing) >= 0.0
# @test f(prevfloat(sol.right), nothing) <= 0.0

# sol = solve(probB, Bisection(; exact_left = true, exact_right = true); immutable = false)
# @test f(sol.left, nothing) < 0.0
# @test f(nextfloat(sol.left), nothing) >= 0.0
# @test f(sol.right, nothing) >= 0.0
# @test f(prevfloat(sol.right), nothing) <= 0.0
4 changes: 2 additions & 2 deletions test/gpu/cuda_tests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@testitem "Solving on GPUs" begin
@testitem "Solving on GPUs" tags=[:cuda] begin
using StaticArrays, CUDA

CUDA.allowscalar(false)
Expand Down Expand Up @@ -36,7 +36,7 @@
end
end

@testitem "CUDA Kernel Launch Test" begin
@testitem "CUDA Kernel Launch Test" tags=[:cuda] begin
using StaticArrays, CUDA

CUDA.allowscalar(false)
Expand Down
15 changes: 7 additions & 8 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using ReTestItems
using ReTestItems, CUDA

const GROUP = get(ENV, "GROUP", "All")
const GROUP = get(ENV, "GROUP", CUDA.functional() ? "All" : "Core")

if GROUP == "All" || GROUP == "Core"
ReTestItems.runtests(joinpath(@__DIR__, "core/"))
end

if GROUP == "GPU"
ReTestItems.runtests(joinpath(@__DIR__, "gpu/"))
if GROUP == "All"
ReTestItems.runtests(@__DIR__)
else
tags = [Symbol(lowercase(GROUP))]
ReTestItems.runtests(@__DIR__; tags)
end