diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 896e8c7..94e2a09 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 @@ -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: diff --git a/src/utils.jl b/src/utils.jl index 68206ec..4e6f61b 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -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") diff --git a/test/runtests.jl b/test/runtests.jl index 777fab0..f5a2dba 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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"])