Commit 3e1aa956 by FritzFlorian

Add thread sanitizer to CI.

parent 0744bc50
......@@ -3,6 +3,7 @@ image: "ubuntu:latest"
stages:
- build
- test
- sanitizer
before_script:
- apt update; apt-get install --yes --force-yes build-essential cmake
......@@ -10,7 +11,7 @@ before_script:
build_cmake:
stage: build
script:
./build_cmake_release.sh
./ci_scripts/build_cmake_release.sh
artifacts:
paths:
- cmake-build-release/bin/
......@@ -18,4 +19,12 @@ build_cmake:
run_tests:
stage: test
script:
./build_cmake_release.sh; ./cmake-build-release/bin/tests
\ No newline at end of file
./ci_scripts/run_tests.sh
run_thread_sanitizer:
stage: sanitizer
script:
./ci_scripts/run_thread_sanitizer.sh
artifacts:
paths:
- cmake-build-release/sanitizer.log.*
\ No newline at end of file
......@@ -2,7 +2,7 @@
mkdir cmake-build-release
cd cmake-build-release
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=OFF
make
# echo the result of make to show it in gitlab
......
#!/usr/bin/env bash
mkdir cmake-build-release
cd cmake-build-release
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=OFF
make
# run the actual tests
./bin/tests
#!/usr/bin/env bash
mkdir cmake-build-release-thread-sunitizer
cd cmake-build-release
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=ON
make
# run the actual tests with sanitizer enabled, reporting the result
TSAN_OPTIONS="log_path=sanitizer.log exitcode=1" ./bin/tests
\ No newline at end of file
......@@ -5,6 +5,6 @@
option(THREAD_SANITIZER "Add thread sanitizer" OFF)
if(THREAD_SANITIZER)
add_compile_options(-fsanitize=thread -g)
add_link_options(-fsanitize=thread)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
endif()
message("-- Thread Sanitizer: ${THREAD_SANITIZER}")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment