Skip to content

Commit 2cd186b

Browse files
authored
Update to ParallelTestRunner v2 (#2690)
* Update to ParallelTestRunner v2 * [CI] Run macOS tests with 2 jobs instead of only one
1 parent b02a7b5 commit 2cd186b

File tree

4 files changed

+41
-21
lines changed

4 files changed

+41
-21
lines changed

.github/workflows/CI.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,25 @@ jobs:
127127
id: buildpkg
128128
env:
129129
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
130+
- name: "Set test arguments"
131+
shell: bash
132+
run: |
133+
# Run tests in verbose mode
134+
TEST_ARGS=(--verbose)
135+
if [[ ${{ runner.os }} == "macOS" ]]; then
136+
# Encourage ParallelTestRunner to use two jobs on macOS, rather
137+
# than the single one it'd use by default.
138+
TEST_ARGS+=(--jobs=2)
139+
fi
140+
echo "runtest_test_args=${TEST_ARGS[@]}" >> "${GITHUB_ENV}"
130141
- uses: julia-actions/julia-runtest@v1
131142
if: matrix.version != 'nightly' || steps.buildpkg.outcome == 'success'
132143
continue-on-error: ${{ matrix.version == 'nightly' }}
133144
id: run_tests
134145
# TODO restore coverage post https://github.com/JuliaGPU/GPUCompiler.jl/pull/711
135146
with:
136147
coverage: ${{ matrix.version != '1.11' || !matrix.assertions }}
148+
test_args: ${{ env.runtest_test_args }}
137149
env:
138150
JULIA_PKG_SERVER_REGISTRY_PREFERENCE: eager
139151
- uses: julia-actions/julia-processcoverage@v1
@@ -144,6 +156,7 @@ jobs:
144156
files: lcov.info
145157
token: ${{ secrets.CODECOV_TOKEN }}
146158
fail_ci_if_error: false # or true if you want CI to fail when Codecov fails
159+
147160
enzymetestutils:
148161
timeout-minutes: 60
149162
name: EnzymeTestUtils - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.libEnzyme }} libEnzyme - ${{ github.event_name }}
@@ -198,6 +211,7 @@ jobs:
198211
files: lcov.info
199212
token: ${{ secrets.CODECOV_TOKEN }}
200213
fail_ci_if_error: false # or true if you want CI to fail when Codecov fails
214+
201215
enzymecore:
202216
timeout-minutes: 20
203217
name: EnzymeCore - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ matrix.libEnzyme }} libEnzyme - ${{ github.event_name }}

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ EnzymeTestUtils = {path = "../lib/EnzymeTestUtils"}
3030

3131
[compat]
3232
EnzymeTestUtils = "0.2.1"
33-
ParallelTestRunner = "1.0.1"
33+
ParallelTestRunner = "2.0.1"

test/multi-threads.jl

Lines changed: 0 additions & 8 deletions
This file was deleted.

test/runtests.jl

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,33 @@
11
import Enzyme
22
import Enzyme_jll
3-
using ParallelTestRunner: runtests
3+
using ParallelTestRunner: addworker, filter_tests!, find_tests, parse_args, runtests
44

5-
function test_filter(test)
6-
if test ("metal", "cuda", "amdgpu")
7-
return false
8-
end
9-
if Sys.iswindows() && test == "ext/specialfunctions"
10-
return false
5+
# Start with autodiscovered tests
6+
testsuite = find_tests(@__DIR__)
7+
# Add threads tests to be run with multiple Julia threads (will be configured in
8+
# `test_worker`).
9+
testsuite["threads/2"] = :(include($(joinpath(@__DIR__, "threads.jl"))))
10+
11+
# Parse arguments
12+
args = parse_args(ARGS)
13+
14+
if filter_tests!(testsuite, args)
15+
# Skip GPU-specific tests by default.
16+
delete!(testsuite, "metal")
17+
delete!(testsuite, "cuda")
18+
delete!(testsuite, "amdgpu")
19+
20+
# Skipped until https://github.com/EnzymeAD/Enzyme.jl/issues/2620 is fixed.
21+
if Sys.iswindows()
22+
delete!(testsuite, "ext/specialfunctions")
1123
end
12-
if test == "threads"
13-
# We run the "threads" tests via the "multi-threads" driver.
14-
return false
24+
end
25+
26+
function test_worker(name)
27+
if name == "threads/2"
28+
# Run the `threads/2` testset, with multiple threads.
29+
return addworker(; exeflags = ["--threads=2"])
1530
end
16-
return true
1731
end
1832

1933
const init_code = quote
@@ -55,4 +69,4 @@ const init_code = quote
5569
end
5670

5771
@info "Testing against" Enzyme_jll.libEnzyme
58-
runtests(Enzyme, ARGS; test_filter, init_code)
72+
runtests(Enzyme, args; testsuite, init_code, test_worker)

0 commit comments

Comments
 (0)