Skip to content

Commit

Permalink
Run ThreadSanitizer on push to master (#575)
Browse files Browse the repository at this point in the history
Fixes: #557
  • Loading branch information
bnoordhuis authored Oct 6, 2024
1 parent 4b1a244 commit ddabcf5
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/tsan.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .github/workflows/valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- '!README.md'
- '!docs/**'
- '!examples/**'
- '.github/workflows/tsan.yml'
- '.github/workflows/valgrind.yml'
workflow_dispatch:

Expand Down
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(CONFIG_ASAN "Enable AddressSanitizer (ASan)" OFF)
xoption(CONFIG_MSAN "Enable MemorySanitizer (MSan)" OFF)
xoption(CONFIG_TSAN "Enable ThreadSanitizer (TSan)" OFF)
xoption(CONFIG_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan)" OFF)

if(CONFIG_ASAN)
Expand Down Expand Up @@ -144,6 +145,18 @@ add_link_options(
-fno-sanitize-recover=all
-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)
message(STATUS "Building with UBSan")
add_compile_definitions(
Expand Down

0 comments on commit ddabcf5

Please sign in to comment.