[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / tsan / test_output.sh
blob8a15a673862f506a529a668b279f0a9131d3f4d8
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
8 BLACKLIST=$HERE/Helpers/blacklist.txt
10 # Assume clang and clang++ are in path.
11 : ${CC:=clang}
12 : ${CXX:=clang++}
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"
19 test_file() {
20 SRC=$1
21 COMPILER=$2
22 echo ----- TESTING $(basename $1)
23 OBJ=$SRC.o
24 EXE=$SRC.exe
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
30 rm -f $EXE $OBJ
34 if [ "$1" == "" ]; then
35 for c in $HERE/*.{c,cc}; do
36 if [[ $c == */failing_* ]]; then
37 echo SKIPPING FAILING TEST $c
38 continue
40 if [[ $c == */load_shared_lib.cc ]]; then
41 echo TEST $c is not supported
42 continue
44 if [ "`grep "TSAN_OPTIONS" $c`" ]; then
45 echo SKIPPING $c -- requires TSAN_OPTIONS
46 continue
48 COMPILER=$CXX
49 case $c in
50 *.c) COMPILER=$CC
51 esac
52 test_file $c $COMPILER &
53 done
54 for job in `jobs -p`; do
55 wait $job || exit 1
56 done
57 else
58 test_file $HERE/$1 $CXX "DUMP"