[TSan] Exclude blacklist tests from manual test runner
[blocksruntime.git] / test / tsan / test_output.sh
blob8b286f413bd8adad30d466a0151964006787232d
1 #!/bin/bash
3 ulimit -s 8192
4 set -e # fail on any error
6 HERE=$(dirname $0)
7 TSAN_DIR=$(dirname $0)/../../lib/tsan
9 # Assume clang and clang++ are in path.
10 : ${CC:=clang}
11 : ${CXX:=clang++}
12 : ${FILECHECK:=FileCheck}
14 # TODO: add testing for all of -O0...-O3
15 CFLAGS="-fsanitize=thread -fPIE -O1 -g -Wall"
16 LDFLAGS="-pie -pthread -ldl -lrt -lm -Wl,--whole-archive $TSAN_DIR/rtl/libtsan.a -Wl,--no-whole-archive"
18 test_file() {
19 SRC=$1
20 COMPILER=$2
21 echo ----- TESTING $(basename $1)
22 OBJ=$SRC.o
23 EXE=$SRC.exe
24 $COMPILER $SRC $CFLAGS -c -o $OBJ
25 $COMPILER $OBJ $LDFLAGS -o $EXE
26 RES=$($EXE 2>&1 || true)
27 printf "%s\n" "$RES" | $FILECHECK $SRC
28 if [ "$3" == "" ]; then
29 rm -f $EXE $OBJ
33 if [ "$1" == "" ]; then
34 for c in $HERE/*.{c,cc}; do
35 if [[ $c == */failing_* ]]; then
36 echo SKIPPING FAILING TEST $c
37 continue
39 if [[ $c == */load_shared_lib.cc ]]; then
40 echo TEST $c is not supported
41 continue
43 if [[ $c == */*blacklist*.cc ]]; then
44 echo TEST $c is not supported
45 continue
47 if [ "`grep "TSAN_OPTIONS" $c`" ]; then
48 echo SKIPPING $c -- requires TSAN_OPTIONS
49 continue
51 COMPILER=$CXX
52 case $c in
53 *.c) COMPILER=$CC
54 esac
55 test_file $c $COMPILER &
56 done
57 for job in `jobs -p`; do
58 wait $job || exit 1
59 done
60 else
61 test_file $HERE/$1 $CXX "DUMP"