Skip to content

Commit

Permalink
Added support for TSan to CMake, added CI run
Browse files Browse the repository at this point in the history
  • Loading branch information
timwoj authored and arr2036 committed Aug 9, 2021
1 parent d3af74f commit 6b1a47b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ env:
matrix:
- BUILD_TYPE=Release
- BUILD_TYPE=Debug ENABLE_ASAN=YES ENABLE_LSAN=YES ENABLE_UBSAN=YES ASAN_OPTIONS="symbolize=1 detect_leaks=1 detect_stack_use_after_return=1" LSAN_OPTIONS="fast_unwind_on_malloc=0:malloc_context_size=50"
- BUILD_TYPE=Debug ENABLE_TSAN=YES
addons:
apt:
config:
Expand Down Expand Up @@ -42,4 +43,3 @@ before_script:
- ./scripts/travis/build.sh
script:
- make ARGS="-V" test

10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ if(ENABLE_UBSAN)
list(APPEND DEBUG_FSANITIZERFLAGS "undefined")
endif()

#
# ThreadSanitizer
#
if(ENABLE_TSAN)
#
# -fsanitize=thread - Build with tsan support
#
list(APPEND DEBUG_FSANITIZERFLAGS "thread")
endif()

if(DEBUG_FSANITIZERFLAGS)
string (REPLACE ";" "," DEBUG_FSANITIZERFLAGS "${DEBUG_FSANITIZERFLAGS}")
set(CMAKE_C_FLAGS_DEBUG "-fsanitize=${DEBUG_FSANITIZERFLAGS} ${CMAKE_C_FLAGS_DEBUG}")
Expand Down
1 change: 1 addition & 0 deletions scripts/travis/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ if ! cmake . -G "Unix Makefiles" \
-DENABLE_ASAN="${ENABLE_ASAN:-NO}" \
-DENABLE_LSAN="${ENABLE_LSAN:-NO}" \
-DENABLE_UBSAN="${ENABLE_UBSAN:-NO}" \
-DENABLE_TSAN="${ENABLE_TSAN:-NO}" \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}"; then
fatal "Failed during cmake build configuration"
fi
Expand Down

0 comments on commit 6b1a47b

Please sign in to comment.