Commit 829b6757 by Florian Fritz

Merge branch 'setup-ci' into 'master'

Fix CI Setup

See merge request !1
parents a1256f23 a1a7481f
Pipeline #1097 passed with stages
in 1 minute 33 seconds
image: "ubuntu:latest" image: "matrim/cmake-examples:3.10.3"
stages: stages:
- build - build
- test - test
- sanitizer - sanitizer
before_script:
- apt update; apt-get install --yes --force-yes build-essential cmake
build_cmake: build_cmake:
stage: build stage: build
script: script:
./ci_scripts/build_cmake_release.sh ./ci_scripts/build_cmake_release.sh
artifacts: artifacts:
paths: paths:
- cmake-build-release/bin/ - release/
run_tests: run_tests:
stage: test stage: test
...@@ -25,6 +22,3 @@ run_thread_sanitizer: ...@@ -25,6 +22,3 @@ run_thread_sanitizer:
stage: sanitizer stage: sanitizer
script: script:
./ci_scripts/run_thread_sanitizer.sh ./ci_scripts/run_thread_sanitizer.sh
artifacts:
paths:
- "./cmake-build-release-thread-sanitizer/sanitizer.log.*"
...@@ -5,5 +5,12 @@ cd cmake-build-release ...@@ -5,5 +5,12 @@ cd cmake-build-release
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=OFF cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=OFF
make make
rm -r -f ../release
mkdir ../release
cp -r bin/ ../release/bin
cp -r lib/ ../release/lib
cp -r ../lib/pls/include/ ../release/include/
rm -f -r ../release/lib/pls
# echo the result of make to show it in gitlab # echo the result of make to show it in gitlab
exit $? exit $?
#!/usr/bin/env bash #!/usr/bin/env bash
mkdir cmake-build-release-thread-sanitizer mkdir cmake-build-release-thread-sanitizer
cd cmake-build-release cd cmake-build-release-thread-sanitizer
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=ON cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=ON
make make
# run the actual tests with sanitizer enabled, reporting the result # run the actual tests with sanitizer enabled, reporting the result
TSAN_OPTIONS="log_path=sanitizer.log exitcode=1" ./bin/tests TSAN_OPTIONS="exitcode=1" ./bin/tests
STATUS_CODE=$? STATUS_CODE=$?
# rename the output log...
mv sanitizer.log.* sanitizer.log
touch sanitizer.log
exit $STATUS_CODE exit $STATUS_CODE
...@@ -7,6 +7,8 @@ using namespace pls::internal::base; ...@@ -7,6 +7,8 @@ using namespace pls::internal::base;
using namespace std; using namespace std;
static bool visited; static bool visited;
static int local_value_1;
static vector<int> local_value_two;
TEST_CASE( "thread creation and joining", "[internal/base/thread.h]") { TEST_CASE( "thread creation and joining", "[internal/base/thread.h]") {
visited = false; visited = false;
...@@ -18,10 +20,13 @@ TEST_CASE( "thread creation and joining", "[internal/base/thread.h]") { ...@@ -18,10 +20,13 @@ TEST_CASE( "thread creation and joining", "[internal/base/thread.h]") {
} }
TEST_CASE( "thread state", "[internal/base/thread.h]") { TEST_CASE( "thread state", "[internal/base/thread.h]") {
auto t1 = create_thread([]() { REQUIRE(*this_thread::state<int>() == 1); }, 1); auto t1 = create_thread([]() { local_value_1 = *this_thread::state<int>(); }, 1);
auto t2 = create_thread([]() { REQUIRE(*this_thread::state<vector<int>>() == vector<int>{1, 2}); }, vector<int>{1, 2}); auto t2 = create_thread([]() { local_value_two = *this_thread::state<vector<int>>(); }, vector<int>{1, 2});
t1.start(); t1.start();
t2.start(); t2.start();
t1.join(); t1.join();
t2.join(); t2.join();
REQUIRE(local_value_1 == 1);
REQUIRE(local_value_two == vector<int>{1, 2});
} }
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