Skip to content

Commit 360da41

Browse files
committed
refactor: main runtests.jl file
1 parent 7462b07 commit 360da41

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

test/runtests.jl

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,42 @@
1-
using ReTestItems, NonlinearSolve, Hwloc, InteractiveUtils, Pkg
1+
using ReTestItems, Hwloc, InteractiveUtils, Pkg
22

33
@info sprint(InteractiveUtils.versioninfo)
44

55
const GROUP = lowercase(get(ENV, "GROUP", "All"))
66

7-
function activate_trim_env!()
8-
Pkg.activate(abspath(joinpath(dirname(@__FILE__), "trim")))
9-
Pkg.instantiate()
10-
return nothing
11-
end
7+
if GROUP != "trim"
8+
using NonlinearSolve # trimming uses a NonlinearSolve from a custom environment
129

13-
const EXTRA_PKGS = Pkg.PackageSpec[]
14-
if GROUP == "all" || GROUP == "downstream"
15-
push!(EXTRA_PKGS, Pkg.PackageSpec("ModelingToolkit"))
16-
push!(EXTRA_PKGS, Pkg.PackageSpec("SymbolicIndexingInterface"))
17-
end
18-
length(EXTRA_PKGS) 1 && Pkg.add(EXTRA_PKGS)
10+
const EXTRA_PKGS = Pkg.PackageSpec[]
11+
if GROUP == "all" || GROUP == "downstream"
12+
push!(EXTRA_PKGS, Pkg.PackageSpec("ModelingToolkit"))
13+
push!(EXTRA_PKGS, Pkg.PackageSpec("SymbolicIndexingInterface"))
14+
end
15+
length(EXTRA_PKGS) 1 && Pkg.add(EXTRA_PKGS)
1916

20-
const RETESTITEMS_NWORKERS = parse(
21-
Int, get(
22-
ENV, "RETESTITEMS_NWORKERS",
23-
string(min(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 4))
17+
const RETESTITEMS_NWORKERS = parse(
18+
Int, get(
19+
ENV, "RETESTITEMS_NWORKERS",
20+
string(min(ifelse(Sys.iswindows(), 0, Hwloc.num_physical_cores()), 4))
21+
)
2422
)
25-
)
26-
const RETESTITEMS_NWORKER_THREADS = parse(
27-
Int,
28-
get(
29-
ENV, "RETESTITEMS_NWORKER_THREADS",
30-
string(max(Hwloc.num_virtual_cores() ÷ max(RETESTITEMS_NWORKERS, 1), 1))
23+
const RETESTITEMS_NWORKER_THREADS = parse(
24+
Int,
25+
get(
26+
ENV, "RETESTITEMS_NWORKER_THREADS",
27+
string(max(Hwloc.num_virtual_cores() ÷ max(RETESTITEMS_NWORKERS, 1), 1))
28+
)
3129
)
32-
)
3330

34-
@info "Running tests for group: $(GROUP) with $(RETESTITEMS_NWORKERS) workers"
31+
@info "Running tests for group: $(GROUP) with $(RETESTITEMS_NWORKERS) workers"
3532

36-
if GROUP != "trim"
3733
ReTestItems.runtests(
3834
NonlinearSolve; tags = (GROUP == "all" ? nothing : [Symbol(GROUP)]),
3935
nworkers = RETESTITEMS_NWORKERS, nworker_threads = RETESTITEMS_NWORKER_THREADS,
4036
testitem_timeout = 3600
4137
)
4238
elseif GROUP == "trim" && VERSION >= v"1.12.0-rc1" # trimming has been introduced in julia 1.12
43-
activate_trim_env!()
39+
Pkg.activate(joinpath(dirname(@__FILE__), "trim"))
40+
Pkg.instantiate()
4441
include("trim/runtests.jl")
4542
end

0 commit comments

Comments
 (0)