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
3 changes: 3 additions & 0 deletions .github/workflows/Coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ jobs:
uses: control-toolbox/CTActions/.github/workflows/coverage.yml@main
with:
use_ct_registry: true
# the default environments and the opt-in ModelingToolkit (its extension is covered
# only there); not GPU, which needs a device
test_args: "+ModelingToolkit"
secrets:
codecov-secret: ${{ secrets.CODECOV_TOKEN }}
SSH_KEY: ${{ secrets.SSH_KEY }}
4 changes: 3 additions & 1 deletion test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ test/
using Pkg
Pkg.test() # core and every environment
Pkg.test(; test_args=["JuMP"]) # core and one environment
Pkg.test(; test_args=["+ModelingToolkit"]) # every environment and an opt-in one
Pkg.test(; test_args=["core"]) # core only
Pkg.test(; test_args=["cron"]) # slow tests (cron/), every environment
Pkg.test(; test_args=["OptimalControl", "convergence"]) # suite and convergence report
Expand All @@ -49,7 +50,8 @@ Pkg.test(; test_args=["ModelingToolkit", "cron", "problem=beam,chain", "budget=3
`test_args` is a list of:

- environment names: run those only; none given runs every environment except the opt-in
ones (`OPT_IN` in `runtests.jl`);
ones (`OPT_IN` in `runtests.jl`); `+<name>` adds one to them (the coverage workflow runs
`+ModelingToolkit`, so that the ModelingToolkit extension is covered);
- `cron`: run `cron/<group>/test_*.jl` instead of `suite/<group>/test_*.jl` (what the
cron workflows run);
- `convergence`: run `suite/<group>/test_*.jl` and then `cron/<group>/test_*.jl`, that is the
Expand Down
12 changes: 10 additions & 2 deletions test/common/selection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,22 @@ Split the command-line `args` into the environments to run and the file patterns
Names of `available` environments (and `core`) are environment names; the rest are
patterns. With no environment name, every available environment except the `opt_in`
ones runs; naming only `core` runs no environment (`core` always runs in-process).
`+<name>` adds an available environment to the default ones: `+ModelingToolkit` is every
environment run by default and ModelingToolkit (the coverage, which names no other).
"""
function select_environments(args, available, opt_in; core::AbstractString="core")
added = String[chopprefix(a, "+") for a in args if startswith(a, "+")]
unknown = setdiff(added, available)
isempty(unknown) || throw(
ArgumentError("unknown environments $(join(("+" * u for u in unknown), ", "))")
)
args = filter(a -> !startswith(a, "+"), args)
named = filter(a -> a == core || a in available, args)
patterns = String[a for a in args if !(a in named)]
environments = if isempty(named)
String[e for e in available if !(e in opt_in)]
String[e for e in available if !(e in opt_in) || e in added]
else
String[e for e in named if e in available]
String[e for e in available if e in named || e in added]
end
return environments, patterns
end
Expand Down
3 changes: 2 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#
# julia --project -e 'using Pkg; Pkg.test()' # core + all environments
# julia --project -e 'using Pkg; Pkg.test(; test_args=["JuMP"])' # core + one environment
# julia --project -e 'using Pkg; Pkg.test(; test_args=["+ModelingToolkit"])' # + an opt-in one
# julia --project -e 'using Pkg; Pkg.test(; test_args=["cron"])' # slow tests (cron/ dirs)
# julia --project -e 'using Pkg; Pkg.test(; test_args=["convergence"])' # suite + cron/ dirs
# julia --project -e 'using Pkg; Pkg.test(; test_args=["robustness"])' # robustness/ dirs
Expand All @@ -23,7 +24,7 @@
# julia --project -e 'using Pkg; Pkg.test(; test_args=["ModelingToolkit", "cron", "problem=beam,chain", "budget=3600"])'
#
# `test_args` is a list of: environment names (none given: every environment except the
# opt-in ones below), the word `cron` (run `cron/<group>/test_*.jl` instead of
# opt-in ones below; `+<name>` adds one to them), the word `cron` (run `cron/<group>/test_*.jl` instead of
# `suite/<group>/test_*.jl`), the word `convergence` (run both: the convergence report,
# off by default, #360) or the word `robustness` (run `robustness/<group>/test_*.jl` only:
# the robustness report of the monthly cron, #378), and file patterns (`*` and `?` allowed, with or without
Expand Down
8 changes: 8 additions & 0 deletions test/suite/core/test_runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ function test_runner()
# `core` alone: no other environment (it always runs in-process)
Test.@test sel(["core"]) == (String[], String[])
Test.@test sel(["core", "JuMP"]) == (["JuMP"], String[])
# `+name`: the default environments and this one
Test.@test sel(["+ModelingToolkit"]) ==
(["JuMP", "ModelingToolkit", "OptimalControl"], String[])
Test.@test sel(["+ModelingToolkit", "*solve*"]) ==
(["JuMP", "ModelingToolkit", "OptimalControl"], ["*solve*"])
Test.@test sel(["JuMP", "+ModelingToolkit"]) ==
(["JuMP", "ModelingToolkit"], String[])
Test.@test_throws ArgumentError sel(["+Fortran"])
end

Test.@testset "mode" begin
Expand Down
Loading