Skip to content

Commit cc6d147

Browse files
authored
Run CI with assertion enabled (#47)
1 parent 331f9d3 commit cc6d147

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.github/workflows/test.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ jobs:
1414
matrix:
1515
julia-version: ['~1.7.0-beta4', 'nightly']
1616
nthreads: ['1', '2']
17+
assertion: ['false']
18+
include:
19+
- julia-version: '~1.7.0-beta4'
20+
nthreads: '2'
21+
assertion: 'true'
1722
fail-fast: false
18-
name: Test Julia ${{ matrix.julia-version }} nthreads=${{ matrix.nthreads }}
23+
name: Test Julia ${{ matrix.julia-version }} nthreads=${{ matrix.nthreads }} assertion=${{ matrix.assertion }}
1924
steps:
2025
- uses: actions/checkout@v2
2126
- name: Setup julia
@@ -27,6 +32,7 @@ jobs:
2732
- uses: julia-actions/julia-runtest@v1
2833
env:
2934
JULIA_NUM_THREADS: ${{ matrix.nthreads }}
35+
CONCURRENTCOLLECTIONS_JL_ASSERTION: ${{ matrix.assertion }}
3036
- uses: julia-actions/julia-processcoverage@v1
3137
- uses: codecov/codecov-action@v1
3238
with:

src/utils.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
assertion_enabled() = false
55
# assertion_enabled() = true
66

7+
function enable_assertion()
8+
prev = assertion_enabled()
9+
@eval assertion_enabled() = true
10+
return prev
11+
end
12+
713
@noinline unreachable() = error("unreachable reached")
814

915
@noinline unexpected(x) = error("unexpected value: $x")

test/runtests.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1+
if lowercase(get(ENV, "CONCURRENTCOLLECTIONS_JL_ASSERTION", "false")) == "true"
2+
import ConcurrentCollections
3+
ConcurrentCollections.Implementations.enable_assertion()
4+
@assert ConcurrentCollections.Implementations.assertion_enabled()
5+
@info "ConcurrentCollections: Assertion enabled"
6+
else
7+
@info "ConcurrentCollections: Assertion disenabled (default)"
8+
end
9+
110
using TestFunctionRunner
211
TestFunctionRunner.@run(paths = ["../benchmark/ConcurrentCollectionsBenchmarks"])

0 commit comments

Comments
 (0)