From 759b7dea565f1a31c4f23263e7dc072801e88588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 17 Sep 2026 12:58:14 +0200 Subject: [PATCH 1/2] Use ParallelTestRunner.jl to parallelize the tests Follows MathOptInterface (jump-dev/MathOptInterface#2932): test files are renamed to `test_*.jl` and discovered by `test/runtests.jl`, which hands them to `ParallelTestRunner.runtests`. Helper files (`Transformer.jl`, `OptimisersSolver.jl`) keep their names so they are not picked up as testsets, and the Julia v1.10 exclusions are kept. --- test/Project.toml | 2 ++ test/runtests.jl | 35 +++++++++++-------- test/{ArrayDiff.jl => test_ArrayDiff.jl} | 0 test/{JuMP.jl => test_JuMP.jl} | 0 test/{MathOptAI.jl => test_MathOptAI.jl} | 0 ...NLPModelsJuMP.jl => test_NLPModelsJuMP.jl} | 0 test/{NLopt.jl => test_NLopt.jl} | 0 test/{ONNXExt.jl => test_ONNXExt.jl} | 0 test/{Optimisers.jl => test_Optimisers.jl} | 0 test/{ReverseAD.jl => test_ReverseAD.jl} | 0 10 files changed, 23 insertions(+), 14 deletions(-) rename test/{ArrayDiff.jl => test_ArrayDiff.jl} (100%) rename test/{JuMP.jl => test_JuMP.jl} (100%) rename test/{MathOptAI.jl => test_MathOptAI.jl} (100%) rename test/{NLPModelsJuMP.jl => test_NLPModelsJuMP.jl} (100%) rename test/{NLopt.jl => test_NLopt.jl} (100%) rename test/{ONNXExt.jl => test_ONNXExt.jl} (100%) rename test/{Optimisers.jl => test_Optimisers.jl} (100%) rename test/{ReverseAD.jl => test_ReverseAD.jl} (100%) diff --git a/test/Project.toml b/test/Project.toml index 263d24f..9d5d3ee 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -16,6 +16,7 @@ NLopt = "76087f3c-5699-56af-9a33-bf431cd00edd" ONNX = "d0dd6a25-fac6-55c0-abf7-829e0c774d20" Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" +ParallelTestRunner = "d3525ed8-44d0-4b2c-a655-542cee43accc" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" SolverCore = "ff4d7338-4cf1-434d-91df-b86cb86fb843" @@ -30,3 +31,4 @@ NLopt = {rev = "bl/diff_backend", url = "https://github.com/jump-dev/NLopt.jl/"} [compat] NLPModels = "0.21.12" +ParallelTestRunner = "2.1" diff --git a/test/runtests.jl b/test/runtests.jl index 5cc99fa..48d6c0f 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,15 +1,22 @@ -include("ReverseAD.jl") -include("ArrayDiff.jl") -include("JuMP.jl") -include("MathOptAI.jl") -include("ONNXExt.jl") -if VERSION >= v"1.11" - # [sources] not supported on Julia v1.10 - # Needs https://github.com/jump-dev/NLopt.jl/pull/273 - include("NLopt.jl") - # Needs https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl/pull/229 - include("NLPModelsJuMP.jl") - include("Optimisers.jl") - #include("Optimisers_GPU.jl") +import ArrayDiff +import ParallelTestRunner + +is_test_file(f) = startswith(f, "test_") && endswith(f, ".jl") + +testsuite = Dict{String,Expr}() +for file in filter(is_test_file, readdir(@__DIR__)) + name = file[1:end-3] + if VERSION < v"1.11" && name in ( + # [sources] not supported on Julia v1.10 + # Needs https://github.com/jump-dev/NLopt.jl/pull/273 + "test_NLopt", + # Needs https://github.com/JuliaSmoothOptimizers/NLPModelsJuMP.jl/pull/229 + "test_NLPModelsJuMP", + "test_Optimisers", + ) + continue + end + testsuite[name] = :(include($(joinpath(@__DIR__, file)))) end -#include("eval_residual_gpu.jl") + +ParallelTestRunner.runtests(ArrayDiff, ARGS; testsuite) diff --git a/test/ArrayDiff.jl b/test/test_ArrayDiff.jl similarity index 100% rename from test/ArrayDiff.jl rename to test/test_ArrayDiff.jl diff --git a/test/JuMP.jl b/test/test_JuMP.jl similarity index 100% rename from test/JuMP.jl rename to test/test_JuMP.jl diff --git a/test/MathOptAI.jl b/test/test_MathOptAI.jl similarity index 100% rename from test/MathOptAI.jl rename to test/test_MathOptAI.jl diff --git a/test/NLPModelsJuMP.jl b/test/test_NLPModelsJuMP.jl similarity index 100% rename from test/NLPModelsJuMP.jl rename to test/test_NLPModelsJuMP.jl diff --git a/test/NLopt.jl b/test/test_NLopt.jl similarity index 100% rename from test/NLopt.jl rename to test/test_NLopt.jl diff --git a/test/ONNXExt.jl b/test/test_ONNXExt.jl similarity index 100% rename from test/ONNXExt.jl rename to test/test_ONNXExt.jl diff --git a/test/Optimisers.jl b/test/test_Optimisers.jl similarity index 100% rename from test/Optimisers.jl rename to test/test_Optimisers.jl diff --git a/test/ReverseAD.jl b/test/test_ReverseAD.jl similarity index 100% rename from test/ReverseAD.jl rename to test/test_ReverseAD.jl From b8e1764d4fe04ec61c9e0e265f2c5805aa9181c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Thu, 17 Sep 2026 14:13:38 +0200 Subject: [PATCH 2/2] Fix format --- test/runtests.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/runtests.jl b/test/runtests.jl index 48d6c0f..1199b0a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,7 +5,7 @@ is_test_file(f) = startswith(f, "test_") && endswith(f, ".jl") testsuite = Dict{String,Expr}() for file in filter(is_test_file, readdir(@__DIR__)) - name = file[1:end-3] + name = file[1:(end-3)] if VERSION < v"1.11" && name in ( # [sources] not supported on Julia v1.10 # Needs https://github.com/jump-dev/NLopt.jl/pull/273