4 set -e # fail on any error
7 TSAN_DIR
=$
(dirname $0)/..
/..
/lib
/tsan
8 BLACKLIST
=$HERE/Helpers
/blacklist.txt
10 # Assume clang and clang++ are in path.
13 : ${FILECHECK:=FileCheck}
15 # TODO: add testing for all of -O0...-O3
16 CFLAGS
="-fsanitize=thread -fsanitize-blacklist=$BLACKLIST -fPIE -O1 -g -Wall"
17 LDFLAGS
="-pie -lpthread -ldl -lrt -lm -Wl,--whole-archive $TSAN_DIR/rtl/libtsan.a -Wl,--no-whole-archive"
22 echo ----- TESTING $
(basename $1)
25 $COMPILER $SRC $CFLAGS -c -o $OBJ
26 $COMPILER $OBJ $LDFLAGS -o $EXE
27 RES
=$
($EXE 2>&1 || true
)
28 printf "%s\n" "$RES" |
$FILECHECK $SRC
29 if [ "$3" == "" ]; then
34 if [ "$1" == "" ]; then
35 for c
in $HERE/*.
{c
,cc
}; do
36 if [[ $c == */failing_
* ]]; then
37 echo SKIPPING FAILING TEST
$c
40 if [[ $c == */load_shared_lib.cc
]]; then
41 echo TEST
$c is not supported
44 if [ "`grep "TSAN_OPTIONS
" $c`" ]; then
45 echo SKIPPING
$c -- requires TSAN_OPTIONS
52 test_file
$c $COMPILER &
54 for job
in `jobs -p`; do
58 test_file
$HERE/$1 $CXX "DUMP"