-
Notifications
You must be signed in to change notification settings - Fork 11
Add sanitizer support using GCC toolchain features #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
db54e85
f88cb86
1ba5d7e
ce8a6f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # ******************************************************************************* | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this is seperate workflow ? isnt it something that shall run in coverage and user shall jsut have ability to enable it ? At the end, its running tests
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's not a good idea to combine coverage instrumentation with sanitizer instrumentation as they can affect each other in gcc: we may get incorrect coverage data, and maybe even get false positives in sanitizers. |
||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| name: Sanitizers | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
| merge_group: | ||
| types: [checks_requested] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| sanitizer-tests: | ||
| name: Bazel Tests (${{ matrix.sanitizer_config }}) | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| sanitizer_config: [asan_ubsan_lsan] | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4.2.2 | ||
| with: | ||
| ref: ${{ github.head_ref || github.event.pull_request.head.ref || github.ref }} | ||
| repository: ${{ github.event.pull_request.head.repo.full_name || github.repository }} | ||
|
|
||
| - name: Setup Bazel with shared caching | ||
| uses: bazel-contrib/setup-bazel@0.18.0 | ||
| with: | ||
| bazelisk-version: 1.26.0 | ||
| disk-cache: true | ||
| repository-cache: true | ||
| bazelisk-cache: true | ||
| cache-save: ${{ github.event_name == 'push' }} | ||
|
|
||
| - name: Run sanitizer tests via Bazel | ||
| run: | | ||
| set -euo pipefail | ||
| echo "Running: bazel test --config=${{ matrix.sanitizer_config }} //score/..." | ||
| # Note: Scoped to C/C++ targets only. Rust targets require Rust-specific | ||
| # sanitizer handling and are excluded via tag filters. | ||
| bazel test \ | ||
| --config=${{ matrix.sanitizer_config }} \ | ||
| //score/... \ | ||
| --build_tag_filters=-rust \ | ||
| --test_tag_filters=-rust \ | ||
| --verbose_failures | ||
|
|
||
| - name: Upload Bazel test logs (always) | ||
| if: always() | ||
| uses: actions/upload-artifact@v6 | ||
| with: | ||
| name: bazel-testlogs-${{ matrix.sanitizer_config }} | ||
| path: bazel-testlogs/**/test.log | ||
| if-no-files-found: warn | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| # ASan + UBSan + LSan | ||
| test:asan_ubsan_lsan --config=x86_64-linux | ||
| test:asan_ubsan_lsan --compilation_mode=dbg | ||
| test:asan_ubsan_lsan --features=asan | ||
| test:asan_ubsan_lsan --features=ubsan | ||
| test:asan_ubsan_lsan --features=lsan | ||
| test:asan_ubsan_lsan --platform_suffix=asan_ubsan_lsan | ||
| test:asan_ubsan_lsan --test_env=ASAN_OPTIONS=exitcode=55:allow_addr2line=1:verbosity=1:detect_leaks=1:halt_on_error=1:allocator_may_return_null=1 | ||
| test:asan_ubsan_lsan --test_env=UBSAN_OPTIONS=exitcode=55:allow_addr2line=1:verbosity=1:print_stacktrace=1:halt_on_error=1 | ||
|
|
||
| # TSan | ||
| test:tsan --config=x86_64-linux | ||
| test:tsan --compilation_mode=dbg | ||
| test:tsan --features=tsan | ||
| test:tsan --platform_suffix=tsan | ||
| test:tsan --test_env=TSAN_OPTIONS=exitcode=55:allow_addr2line=1:verbosity=1:halt_on_error=1:detect_deadlocks=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would keep it into bazelrc for now.