-
Notifications
You must be signed in to change notification settings - Fork 11
ci: add C++ ASan+TSan gate on every PR; document test strategy #539
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
Merged
Merged
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
546531a
fix(build): fix ASan/TSan runtime linking for clang
jbachorik 374f3dd
test: make C++ unit tests TSan-compatible
jbachorik a6a5972
ci: add C++ ASan+TSan gate via GitLab
jbachorik 56186c9
docs: add testing strategy guide
jbachorik 51fadfe
ci(sanitizer): move to build stage, drop prepare:start dependency
jbachorik 142caef
docs: update TestingGuide for GitLab migration of C++ sanitizer tests
jbachorik b81d027
ci: gate build-artifact on sanitizer tests
jbachorik c377d5f
ci: dedicated sanitizer stage before build
jbachorik 3dbfe9c
ci(sanitizer): start immediately with needs: []
jbachorik 29de934
ci(sanitizer): add Gradle cache and sysctl vm.mmap_rnd_bits
jbachorik 7299fbf
build: remove log_path from ASAN_OPTIONS and UBSAN_OPTIONS
jbachorik 30642e4
ci(sanitizer): use push+pull Gradle cache
jbachorik d2dff8b
build: route gtest output to stdout; increase Gradle download retries
jbachorik 8dc54dd
build: write gtest output to /dev/stdout and /dev/stderr
jbachorik cbfd226
build: explain Gradle output discard; flush /dev/std* streams after run
jbachorik 238458e
ci(sanitizer): use setarch -R instead of sysctl for ASLR
jbachorik 9772ffc
build: add buildGtest{Config} task for compile+link without run
jbachorik 815616a
ci(sanitizer): build via Gradle, run binaries directly from shell
jbachorik 91cf178
ci(sanitizer): fix Gradle cache miss — set GRADLE_USER_HOME=.gradle
jbachorik 473f4fc
ci(sanitizer): remove setarch from Gradle build step
jbachorik e403da6
ci(sanitizer): add --parallel --build-cache to Gradle build step
jbachorik 5aeeaf4
build: compile gtest library sources once per config (shared objects)
jbachorik debe31f
build(gtest): simplify review fixes
jbachorik 5c58f58
ci(sanitizer): restore TSan with allow_failure; add llvm-symbolizer
jbachorik ee0ef26
ci(tsan): run inside docker --privileged to allow sysctl
jbachorik 9c6e4b5
ci(tsan): revert to setarch fallback; document infra requirement
jbachorik 1d77b32
ci(tsan): use docker-in-docker tags for proper runner access
jbachorik 64e8eac
ci(tsan): set GTEST_DEATH_TEST_STYLE=threadsafe for TSan runs
jbachorik cdfd71b
ci(tsan-amd64): use one-shot privileged container for sysctl only
jbachorik c5faa51
ci(tsan-amd64): use BUILD_IMAGE_X64 for sysctl, not alpine
jbachorik 6e8a874
ci(tsan-amd64): use direct sysctl on kata-qemu micro VM
jbachorik d35025b
ci(tsan): fix amd64 sysctl path; add arm64 diagnostics
jbachorik 17550f8
ci(tsan-amd64): add diagnostics — clang version, kernel, TSan probe
jbachorik 158c0df
ci(tsan-amd64): install LLVM 18 — LLVM 11 crashes on kernel 6.8
jbachorik 02d4e09
ci(tsan): fix arm64 regression; simplify amd64
jbachorik 46394bb
Merge origin/main and resolve gtest build-logic conflicts
Copilot 23470e7
Merge branch 'main' into jb/ci-sanitizer-split
jbachorik fe0d85d
Temporarily allow asan jobs failing
jbachorik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| # C++ unit tests under ASan and TSan. | ||
| # | ||
| # These run on every branch push (not MR pipelines — GitHub Actions handles those). | ||
| # | ||
| # Strategy: use Gradle only for compile+link (buildGtest{Config}), then run | ||
| # each binary directly from the shell. This bypasses Gradle's daemon I/O | ||
| # which swallows child process output when fd 1/2 are not the terminal. | ||
|
|
||
| .sanitizer_job: | ||
| stage: sanitizer | ||
| extends: .cache-config | ||
| needs: [] | ||
| timeout: 30m | ||
| variables: | ||
| GRADLE_USER_HOME: .gradle | ||
| rules: | ||
| - if: '$JDK_VERSION != null || $DEBUG_LEVEL != null || $HASH != null || $DOWNSTREAM != null' | ||
| when: never | ||
| - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' | ||
| when: never | ||
| - when: on_success | ||
| interruptible: true | ||
| before_script: | ||
| - apt-get update -qq | ||
| - apt-get install -y -qq cmake libgtest-dev libgmock-dev binutils libc6-dbg llvm | ||
| script: | ||
| - ./gradlew :ddprof-lib:buildGtest${SANITIZER_CONFIG} --no-daemon --parallel --build-cache | ||
| - | | ||
| find ddprof-lib/build/bin/gtest -mindepth 2 -maxdepth 2 -type f -executable \ | ||
| | grep "/${SANITIZER_LC}_" \ | ||
| | sort \ | ||
| | while read binary; do | ||
| echo "" | ||
| echo "=== $(basename $binary) ===" | ||
| "$binary" | ||
| rc=$? | ||
| if [ $rc -ne 0 ]; then | ||
| echo "FAILED: $(basename $binary) exited $rc" | ||
| exit $rc | ||
| fi | ||
| done | ||
| artifacts: | ||
| when: always | ||
| paths: | ||
| - ddprof-lib/build/bin/gtest/${SANITIZER_LC}*/ | ||
| expire_in: 1 day | ||
|
|
||
| gtest-asan-amd64: | ||
| extends: .sanitizer_job | ||
| allow_failure: true | ||
|
jbachorik marked this conversation as resolved.
|
||
| tags: [ "arch:amd64" ] | ||
| image: $BUILD_IMAGE_X64 | ||
| variables: | ||
| SANITIZER_CONFIG: Asan | ||
| SANITIZER_LC: asan | ||
|
|
||
| gtest-tsan-amd64: | ||
| extends: .sanitizer_job | ||
| allow_failure: true | ||
| # docker-in-docker:amd64 = Kata Containers (kata-qemu micro VMs). | ||
| # Kata maps host-guest communication structures at fixed high addresses | ||
| # that land in TSan's shadow region regardless of LLVM version or sysctl. | ||
| # TSan on amd64 requires a non-Kata runner (EC2 or bare metal). | ||
| # Kept allow_failure so it runs and provides coverage if the environment is fixed. | ||
| tags: [ "docker-in-docker:amd64" ] | ||
| image: $BUILD_IMAGE_X64 | ||
| variables: | ||
| SANITIZER_CONFIG: Tsan | ||
| SANITIZER_LC: tsan | ||
| script: | ||
| - ./gradlew :ddprof-lib:buildGtest${SANITIZER_CONFIG} --no-daemon --parallel --build-cache | ||
| - | | ||
| find ddprof-lib/build/bin/gtest -mindepth 2 -maxdepth 2 -type f -executable \ | ||
| | grep "/${SANITIZER_LC}_" | sort | while read binary; do | ||
| echo "=== $(basename $binary) ===" | ||
| GTEST_DEATH_TEST_STYLE=threadsafe "$binary" | ||
| rc=$? | ||
| [ $rc -ne 0 ] && { echo "FAILED: $(basename $binary) exited $rc"; exit $rc; } | ||
| done | ||
|
|
||
| gtest-asan-arm64: | ||
| extends: .sanitizer_job | ||
| allow_failure: true | ||
| tags: [ "arch:arm64" ] | ||
| image: $BUILD_IMAGE_ARM64 | ||
| variables: | ||
| SANITIZER_CONFIG: Asan | ||
| SANITIZER_LC: asan | ||
|
|
||
| gtest-tsan-arm64: | ||
| extends: .sanitizer_job | ||
| allow_failure: true | ||
| # docker-in-docker:arm64 = EC2 VM. sysctl works directly. | ||
| # vm.mmap_rnd_bits=28 is sufficient — TSan's LLVM re-exec handles the rare | ||
| # case where a library lands in the shadow region by re-running the process | ||
| # via personality(ADDR_NO_RANDOMIZE). | ||
| # Do NOT set kernel.randomize_va_space=0: with ASLR fully off, ld-linux-aarch64.so | ||
| # loads at its fixed default address (0x002000000000) which is exactly TSan's | ||
| # 39-bit shadow start — guaranteed conflict every time. | ||
| tags: [ "docker-in-docker:arm64" ] | ||
| image: $BUILD_IMAGE_ARM64 | ||
| variables: | ||
| SANITIZER_CONFIG: Tsan | ||
| SANITIZER_LC: tsan | ||
| script: | ||
| - ./gradlew :ddprof-lib:buildGtest${SANITIZER_CONFIG} --no-daemon --parallel --build-cache | ||
| - | | ||
| sysctl -w vm.mmap_rnd_bits=28 2>/dev/null || true | ||
| find ddprof-lib/build/bin/gtest -mindepth 2 -maxdepth 2 -type f -executable \ | ||
| | grep "/${SANITIZER_LC}_" | sort | while read binary; do | ||
| echo "=== $(basename $binary) ===" | ||
| GTEST_DEATH_TEST_STYLE=threadsafe "$binary" | ||
| rc=$? | ||
| [ $rc -ne 0 ] && { echo "FAILED: $(basename $binary) exited $rc"; exit $rc; } | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.