From b0527554e09fe1196a8b8c5d5c83fa5752cd3a86 Mon Sep 17 00:00:00 2001 From: FritzFlorian Date: Tue, 19 Mar 2019 20:04:23 +0100 Subject: [PATCH] Fix: handle thread sanitizer logfile correctly. --- .gitlab-ci.yml | 4 ++-- ci_scripts/run_thread_sanitizer.sh | 4 ++-- test/thread_tests.cpp | 9 +++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d5509e7..a68bf3c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "ubuntu:latest" +image: "madduci/docker-linux-cpp:latest" stages: - build @@ -27,4 +27,4 @@ run_thread_sanitizer: ./ci_scripts/run_thread_sanitizer.sh artifacts: paths: - - "./cmake-build-release-thread-sanitizer/sanitizer.log.*" + - sanitizer.log.* diff --git a/ci_scripts/run_thread_sanitizer.sh b/ci_scripts/run_thread_sanitizer.sh index 0bb65f7..9d27b4d 100755 --- a/ci_scripts/run_thread_sanitizer.sh +++ b/ci_scripts/run_thread_sanitizer.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash mkdir cmake-build-release-thread-sanitizer -cd cmake-build-release +cd cmake-build-release-thread-sanitizer cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=ON make @@ -10,7 +10,7 @@ TSAN_OPTIONS="log_path=sanitizer.log exitcode=1" ./bin/tests STATUS_CODE=$? # rename the output log... -mv sanitizer.log.* sanitizer.log +mv sanitizer.log.* ../sanitizer.log touch sanitizer.log exit $STATUS_CODE diff --git a/test/thread_tests.cpp b/test/thread_tests.cpp index 06fe9db..4ac6740 100644 --- a/test/thread_tests.cpp +++ b/test/thread_tests.cpp @@ -7,6 +7,8 @@ using namespace pls::internal::base; using namespace std; static bool visited; +static int local_value_1; +static vector local_value_two; TEST_CASE( "thread creation and joining", "[internal/base/thread.h]") { visited = false; @@ -18,10 +20,13 @@ TEST_CASE( "thread creation and joining", "[internal/base/thread.h]") { } TEST_CASE( "thread state", "[internal/base/thread.h]") { - auto t1 = create_thread([]() { REQUIRE(*this_thread::state() == 1); }, 1); - auto t2 = create_thread([]() { REQUIRE(*this_thread::state>() == vector{1, 2}); }, vector{1, 2}); + auto t1 = create_thread([]() { local_value_1 = *this_thread::state(); }, 1); + auto t2 = create_thread([]() { local_value_two = *this_thread::state>(); }, vector{1, 2}); t1.start(); t2.start(); t1.join(); t2.join(); + + REQUIRE(local_value_1 == 1); + REQUIRE(local_value_two == vector{1, 2}); } -- libgit2 0.26.0