Run ThreadSanitizer on push to master (#575)

Fixes: https://github.com/quickjs-ng/quickjs/issues/557
This commit is contained in:
Ben Noordhuis 2024-10-06 20:17:50 +02:00 committed by GitHub
parent 4b1a244d3b
commit ddabcf5e93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 45 additions and 0 deletions

31
.github/workflows/tsan.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: tsan
on:
push:
branches:
- master
paths:
- '**'
- '!.gitignore'
- '!LICENSE'
- '!README.md'
- '!docs/**'
- '!examples/**'
- '.github/workflows/tsan.yml'
- '.github/workflows/valgrind.yml'
workflow_dispatch:
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: build
run: |
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONFIG_TSAN=ON
cmake --build build -j`nproc`
- name: test
run: |
./build/run-test262 -m -c test262.conf -c test262-fast.conf -a

View file

@ -11,6 +11,7 @@ on:
- '!README.md' - '!README.md'
- '!docs/**' - '!docs/**'
- '!examples/**' - '!examples/**'
- '.github/workflows/tsan.yml'
- '.github/workflows/valgrind.yml' - '.github/workflows/valgrind.yml'
workflow_dispatch: workflow_dispatch:

View file

@ -115,6 +115,7 @@ xoption(BUILD_CLI_WITH_MIMALLOC "Build the qjs executable with mimalloc" OFF)
xoption(BUILD_CLI_WITH_STATIC_MIMALLOC "Build the qjs executable with mimalloc (statically linked)" OFF) xoption(BUILD_CLI_WITH_STATIC_MIMALLOC "Build the qjs executable with mimalloc (statically linked)" OFF)
xoption(CONFIG_ASAN "Enable AddressSanitizer (ASan)" OFF) xoption(CONFIG_ASAN "Enable AddressSanitizer (ASan)" OFF)
xoption(CONFIG_MSAN "Enable MemorySanitizer (MSan)" OFF) xoption(CONFIG_MSAN "Enable MemorySanitizer (MSan)" OFF)
xoption(CONFIG_TSAN "Enable ThreadSanitizer (TSan)" OFF)
xoption(CONFIG_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan)" OFF) xoption(CONFIG_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan)" OFF)
if(CONFIG_ASAN) if(CONFIG_ASAN)
@ -144,6 +145,18 @@ add_link_options(
-fno-sanitize-recover=all -fno-sanitize-recover=all
-fno-omit-frame-pointer -fno-omit-frame-pointer
) )
elseif(CONFIG_TSAN)
message(STATUS "Building with TSan")
add_compile_options(
-fsanitize=thread
-fno-sanitize-recover=all
-fno-omit-frame-pointer
)
add_link_options(
-fsanitize=thread
-fno-sanitize-recover=all
-fno-omit-frame-pointer
)
elseif(CONFIG_UBSAN) elseif(CONFIG_UBSAN)
message(STATUS "Building with UBSan") message(STATUS "Building with UBSan")
add_compile_definitions( add_compile_definitions(