1- using ReTestItems, NonlinearSolve, Hwloc, InteractiveUtils, Pkg
1+ using NonlinearSolve, Hwloc, InteractiveUtils, Pkg
2+ using SafeTestsets
3+ using ReTestItems
24
35@info sprint (InteractiveUtils. versioninfo)
46
57const GROUP = lowercase (get (ENV , " GROUP" , " All" ))
68
9+ function activate_trim_env! ()
10+ Pkg. activate (abspath (joinpath (dirname (@__FILE__ ), " trim" )))
11+ Pkg. develop (PackageSpec (path = dirname (@__DIR__ )))
12+ Pkg. instantiate ()
13+ return nothing
14+ end
15+
716const EXTRA_PKGS = Pkg. PackageSpec[]
817if GROUP == " all" || GROUP == " downstream"
918 push! (EXTRA_PKGS, Pkg. PackageSpec (" ModelingToolkit" ))
1221length (EXTRA_PKGS) ≥ 1 && Pkg. add (EXTRA_PKGS)
1322
1423const RETESTITEMS_NWORKERS = parse (
15- Int, get (ENV , " RETESTITEMS_NWORKERS" ,
24+ Int, get (
25+ ENV , " RETESTITEMS_NWORKERS" ,
1626 string (min (ifelse (Sys. iswindows (), 0 , Hwloc. num_physical_cores ()), 4 ))
1727 )
1828)
19- const RETESTITEMS_NWORKER_THREADS = parse (Int,
29+ const RETESTITEMS_NWORKER_THREADS = parse (
30+ Int,
2031 get (
2132 ENV , " RETESTITEMS_NWORKER_THREADS" ,
2233 string (max (Hwloc. num_virtual_cores () ÷ max (RETESTITEMS_NWORKERS, 1 ), 1 ))
@@ -25,8 +36,22 @@ const RETESTITEMS_NWORKER_THREADS = parse(Int,
2536
2637@info " Running tests for group: $(GROUP) with $(RETESTITEMS_NWORKERS) workers"
2738
28- ReTestItems. runtests (
29- NonlinearSolve; tags = (GROUP == " all" ? nothing : [Symbol (GROUP)]),
30- nworkers = RETESTITEMS_NWORKERS, nworker_threads = RETESTITEMS_NWORKER_THREADS,
31- testitem_timeout = 3600
32- )
39+ if GROUP != " trim"
40+ ReTestItems. runtests (
41+ NonlinearSolve; tags = (GROUP == " all" ? nothing : [Symbol (GROUP)]),
42+ nworkers = RETESTITEMS_NWORKERS, nworker_threads = RETESTITEMS_NWORKER_THREADS,
43+ testitem_timeout = 3600
44+ )
45+ elseif GROUP == " trim" && VERSION >= v " 1.12.0-rc1" # trimming has been introduced in julia 1.12
46+ activate_trim_env! ()
47+ @safetestset " Clean implementation (non-trimmable)" begin
48+ using SciMLBase: successful_retcode
49+ include (" trim/clean_optimization.jl" )
50+ @test successful_retcode (minimize (1.0 ). retcode)
51+ end
52+ @safetestset " Trimmable implementation" begin
53+ using SciMLBase: successful_retcode
54+ include (" trim/trimmable_optimization.jl" )
55+ @test successful_retcode (minimize (1.0 ). retcode)
56+ end
57+ end
0 commit comments