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
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,13 @@ jobs:
matrix:
julia-version: ['~1.7.0-beta4', 'nightly']
nthreads: ['1', '2']
assertion: ['false']
include:
- julia-version: '~1.7.0-beta4'
nthreads: '2'
assertion: 'true'
fail-fast: false
name: Test Julia ${{ matrix.julia-version }} nthreads=${{ matrix.nthreads }}
name: Test Julia ${{ matrix.julia-version }} nthreads=${{ matrix.nthreads }} assertion=${{ matrix.assertion }}
steps:
- uses: actions/checkout@v2
- name: Setup julia
Expand All @@ -27,6 +32,7 @@ jobs:
- uses: julia-actions/julia-runtest@v1
env:
JULIA_NUM_THREADS: ${{ matrix.nthreads }}
CONCURRENTCOLLECTIONS_JL_ASSERTION: ${{ matrix.assertion }}
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v1
with:
Expand Down
6 changes: 6 additions & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
assertion_enabled() = false
# assertion_enabled() = true

function enable_assertion()
prev = assertion_enabled()
@eval assertion_enabled() = true
return prev
end

@noinline unreachable() = error("unreachable reached")

@noinline unexpected(x) = error("unexpected value: $x")
Expand Down
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
if lowercase(get(ENV, "CONCURRENTCOLLECTIONS_JL_ASSERTION", "false")) == "true"
import ConcurrentCollections
ConcurrentCollections.Implementations.enable_assertion()
@assert ConcurrentCollections.Implementations.assertion_enabled()
@info "ConcurrentCollections: Assertion enabled"
else
@info "ConcurrentCollections: Assertion disenabled (default)"
end

using TestFunctionRunner
TestFunctionRunner.@run(paths = ["../benchmark/ConcurrentCollectionsBenchmarks"])