Skip to content

Commit 803ad62

Browse files
committed
fix tests on LTS version
1 parent 1b66629 commit 803ad62

3 files changed

Lines changed: 42 additions & 8 deletions

File tree

.github/workflows/tests.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,27 @@ jobs:
3030
version: ${{ matrix.julia-version }}
3131
arch: ${{ matrix.julia-arch }}
3232
- uses: julia-actions/cache@v2
33+
- name: Prepare LTS test environment
34+
if: matrix.julia-version == 'lts'
35+
shell: bash
36+
run: |
37+
julia --project=test -e '
38+
using Pkg
39+
Pkg.develop(path = pwd())
40+
for pkg in ("DSPOperators", "FFTWOperators", "NFFTOperators", "WaveletOperators")
41+
Pkg.develop(path = joinpath(pwd(), pkg))
42+
end
43+
Pkg.instantiate()
44+
Pkg.build()
45+
Pkg.precompile()
46+
'
3347
- uses: julia-actions/julia-buildpkg@v1
48+
if: matrix.julia-version != 'lts'
49+
- name: Run tests on LTS
50+
if: matrix.julia-version == 'lts'
51+
run: julia --project=test --check-bounds=yes --compiled-modules=yes --depwarn=yes --code-coverage=user test/runtests.jl
3452
- uses: julia-actions/julia-runtest@v1
53+
if: matrix.julia-version != 'lts'
3554
with:
3655
coverage: true
3756
- uses: julia-actions/julia-processcoverage@v1

src/utils.jl

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,29 @@ const thread_count_functions = Ref{Vector{Pair{Function, Function}}}(
88
]
99
)
1010

11+
# Non-inlined helpers so that the abstract Function dispatch is contained in
12+
# AbstractOperators and not inlined into the calling module (which would cause
13+
# JET @test_opt findings when target_modules excludes AbstractOperators).
14+
@noinline function _save_thread_counts()
15+
return [pair.first() for pair in thread_count_functions[]]
16+
end
17+
18+
@noinline function _apply_thread_counts(n::Int)
19+
for pair in thread_count_functions[]
20+
pair.second(n)
21+
end
22+
end
23+
24+
@noinline function _restore_thread_counts(prev::Vector)
25+
for (i, pair) in enumerate(thread_count_functions[])
26+
pair.second(prev[i])
27+
end
28+
end
29+
1130
function set_thread_counts_expr(thread_count_expr, body_expr)
1231
return quote
13-
local prev_thread_counts = [pair.first() for pair in AbstractOperators.thread_count_functions[]]
14-
for pair in AbstractOperators.thread_count_functions[]
15-
pair.second($thread_count_expr)
16-
end
32+
local prev_thread_counts = AbstractOperators._save_thread_counts()
33+
AbstractOperators._apply_thread_counts($thread_count_expr)
1734
local res
1835
try
1936
if $thread_count_expr == 1
@@ -26,9 +43,7 @@ function set_thread_counts_expr(thread_count_expr, body_expr)
2643
end
2744
finally
2845
# Restore previous thread counts
29-
for (i, pair) in enumerate(AbstractOperators.thread_count_functions[])
30-
pair.second(prev_thread_counts[i])
31-
end
46+
AbstractOperators._restore_thread_counts(prev_thread_counts)
3247
end
3348
res
3449
end

test/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Wavelets = "29a6e085-ba6d-5f35-a997-948ac2efa89a"
2929
Aqua = "0.8"
3030
BenchmarkTools = "1"
3131
Documenter = "1.8"
32-
JET = "0.10"
32+
JET = "0.8, 0.9, 0.10, 0.11"
3333
JLArrays = "0.2.0"
3434
LinearAlgebra = "1"
3535
LinearMaps = "3.11.4"

0 commit comments

Comments
 (0)