run_thread_sanitizer.sh 476 Bytes
Newer Older
1 2
#!/usr/bin/env bash

3
mkdir cmake-build-release-thread-sanitizer
4
cd cmake-build-release-thread-sanitizer
5 6 7 8
cmake .. -DCMAKE_BUILD_TYPE=RELEASE -DTHREAD_SANITIZER=ON
make

# run the actual tests with sanitizer enabled, reporting the result
9
TSAN_OPTIONS="log_path=sanitizer.log exitcode=1" ./bin/tests
10
STATUS_CODE=$?
11 12

# rename the output log...
13 14 15 16
mv ./sanitizer.log.* ../sanitizer.log
if [[ $? != 0 ]]; then
    echo "No sanitizer warnings." > ../sanitizer.log
fi
17 18

exit $STATUS_CODE