run_thread_sanitizer.sh 490 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
mv ./sanitizer.log.* ../thread-sanitizer.log
14
if [[ $? != 0 ]]; then
15
    echo "No sanitizer warnings." > ../thread-sanitizer.log
16
fi
17 18

exit $STATUS_CODE