Skip to content

Commit ddabcf5

Browse files
authored
Run ThreadSanitizer on push to master (#575)
Fixes: #557
1 parent 4b1a244 commit ddabcf5

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

.github/workflows/tsan.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: tsan
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '**'
9+
- '!.gitignore'
10+
- '!LICENSE'
11+
- '!README.md'
12+
- '!docs/**'
13+
- '!examples/**'
14+
- '.github/workflows/tsan.yml'
15+
- '.github/workflows/valgrind.yml'
16+
workflow_dispatch:
17+
18+
jobs:
19+
linux:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
submodules: true
25+
- name: build
26+
run: |
27+
cmake -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONFIG_TSAN=ON
28+
cmake --build build -j`nproc`
29+
- name: test
30+
run: |
31+
./build/run-test262 -m -c test262.conf -c test262-fast.conf -a

.github/workflows/valgrind.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
- '!README.md'
1212
- '!docs/**'
1313
- '!examples/**'
14+
- '.github/workflows/tsan.yml'
1415
- '.github/workflows/valgrind.yml'
1516
workflow_dispatch:
1617

CMakeLists.txt

+13
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ xoption(BUILD_CLI_WITH_MIMALLOC "Build the qjs executable with mimalloc" OFF)
115115
xoption(BUILD_CLI_WITH_STATIC_MIMALLOC "Build the qjs executable with mimalloc (statically linked)" OFF)
116116
xoption(CONFIG_ASAN "Enable AddressSanitizer (ASan)" OFF)
117117
xoption(CONFIG_MSAN "Enable MemorySanitizer (MSan)" OFF)
118+
xoption(CONFIG_TSAN "Enable ThreadSanitizer (TSan)" OFF)
118119
xoption(CONFIG_UBSAN "Enable UndefinedBehaviorSanitizer (UBSan)" OFF)
119120

120121
if(CONFIG_ASAN)
@@ -144,6 +145,18 @@ add_link_options(
144145
-fno-sanitize-recover=all
145146
-fno-omit-frame-pointer
146147
)
148+
elseif(CONFIG_TSAN)
149+
message(STATUS "Building with TSan")
150+
add_compile_options(
151+
-fsanitize=thread
152+
-fno-sanitize-recover=all
153+
-fno-omit-frame-pointer
154+
)
155+
add_link_options(
156+
-fsanitize=thread
157+
-fno-sanitize-recover=all
158+
-fno-omit-frame-pointer
159+
)
147160
elseif(CONFIG_UBSAN)
148161
message(STATUS "Building with UBSan")
149162
add_compile_definitions(

0 commit comments

Comments
 (0)