#!/usr/bin/env bash

mkdir cmake-build-release-thread-sanitizer
cd cmake-build-release-thread-sanitizer
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=ON
make

# run the actual tests with sanitizer enabled, reporting the result
TSAN_OPTIONS="exitcode=1" ./bin/tests
STATUS_CODE=$?

exit $STATUS_CODE
