Add ThreadSanitizer CI jobs (Linux + macOS)#148
Draft
bghgary wants to merge 3 commits intoBabylonJS:mainfrom
Draft
Add ThreadSanitizer CI jobs (Linux + macOS)#148bghgary wants to merge 3 commits intoBabylonJS:mainfrom
bghgary wants to merge 3 commits intoBabylonJS:mainfrom
Conversation
Add ENABLE_THREAD_SANITIZER CMake option for detecting data races at runtime. TSan cannot be combined with ASan, so it's a separate option with a mutual exclusion check. Adds an Ubuntu_ThreadSanitizer_clang CI job that runs the full test suite under TSan. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds ThreadSanitizer (TSan) support to the build and CI to detect data races at runtime, integrating it alongside existing sanitizer infrastructure.
Changes:
- Added
ENABLE_THREAD_SANITIZERCMake option and wiring to apply-fsanitize=threadcompile/link flags (with mutual exclusion vsENABLE_SANITIZERS). - Extended the Linux CI template to accept an
enableThreadSanitizerparameter and pass it through to CMake. - Added a new Azure Pipelines Linux/Clang TSan job.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
CMakeLists.txt |
Adds a dedicated CMake toggle for ThreadSanitizer and applies the required toolchain flags. |
.gitignore |
Ignores the UnitTests dist/ output directory. |
.github/jobs/linux.yml |
Adds a pipeline parameter/variable to enable TSan and passes it into the CMake configure step. |
.github/azure-pipelines.yml |
Introduces a new Ubuntu/Clang ThreadSanitizer CI job using the Linux job template. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
MSVC does not support ThreadSanitizer. Added macOS CI job and enableThreadSanitizer parameter to macos.yml. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add ThreadSanitizer (TSan) support for detecting data races at runtime.
Changes
ENABLE_THREAD_SANITIZERoption with-fsanitize=thread. Includes a mutual exclusion check withENABLE_SANITIZERSsince TSan and ASan cannot be combined.enableThreadSanitizerparameter, passed asENABLE_THREAD_SANITIZERto CMake.enableThreadSanitizerparameter.Ubuntu_ThreadSanitizer_clangandmacOS_Xcode164_ThreadSanitizerCI jobs.Platform Support
TSan is supported on Linux and macOS with Clang/GCC. MSVC does not support TSan and Clang targeting Windows does not have a TSan runtime library.
CI Impact
The TSan jobs run in parallel with other jobs and do not increase overall pipeline time.
Known Issues
TSan detects pre-existing data races in the codebase (e.g. in
AppRuntime::Run). These are not introduced by this PR and should be addressed incrementally. The TSan jobs will fail until they are fixed.