Commit 3e1aa956 by FritzFlorian

Add thread sanitizer to CI.

parent 0744bc50
...@@ -3,6 +3,7 @@ image: "ubuntu:latest" ...@@ -3,6 +3,7 @@ image: "ubuntu:latest"
stages: stages:
- build - build
- test - test
- sanitizer
before_script: before_script:
- apt update; apt-get install --yes --force-yes build-essential cmake - apt update; apt-get install --yes --force-yes build-essential cmake
...@@ -10,7 +11,7 @@ before_script: ...@@ -10,7 +11,7 @@ before_script:
build_cmake: build_cmake:
stage: build stage: build
script: script:
./build_cmake_release.sh ./ci_scripts/build_cmake_release.sh
artifacts: artifacts:
paths: paths:
- cmake-build-release/bin/ - cmake-build-release/bin/
...@@ -18,4 +19,12 @@ build_cmake: ...@@ -18,4 +19,12 @@ build_cmake:
run_tests: run_tests:
stage: test stage: test
script: script:
./build_cmake_release.sh; ./cmake-build-release/bin/tests ./ci_scripts/run_tests.sh
\ No newline at end of file
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 @@ ...@@ -2,7 +2,7 @@
mkdir cmake-build-release mkdir cmake-build-release
cd cmake-build-release cd cmake-build-release
cmake .. -DCMAKE_BUILD_TYPE=RELEASE cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=OFF
make make
# echo the result of make to show it in gitlab # 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 @@ ...@@ -5,6 +5,6 @@
option(THREAD_SANITIZER "Add thread sanitizer" OFF) option(THREAD_SANITIZER "Add thread sanitizer" OFF)
if(THREAD_SANITIZER) if(THREAD_SANITIZER)
add_compile_options(-fsanitize=thread -g) add_compile_options(-fsanitize=thread -g)
add_link_options(-fsanitize=thread) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
endif() endif()
message("-- Thread Sanitizer: ${THREAD_SANITIZER}") 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