[asan] fix the test runner to detect build breakages; add a test for -pie

llvm-svn: 146528
This commit is contained in:
Kostya Serebryany 2011-12-14 00:05:22 +00:00
parent ac6ae7302d
commit e85da73553
1 changed files with 10 additions and 3 deletions

View File

@ -1,5 +1,7 @@
#!/bin/bash
set -e # fail on any error
OS=`uname`
CXX=$1
CC=$2
@ -7,9 +9,14 @@ CXXFLAGS="-mno-omit-leaf-frame-pointer"
SYMBOLIZER=../scripts/asan_symbolize.py
C_TEST=use-after-free
$CC -g -faddress-sanitizer -O2 $C_TEST.c || exit 1
echo "Sanity checking a test in pure C"
./a.out 2>&1 | grep "heap-use-after-free" > /dev/null || exit 1
$CC -g -faddress-sanitizer -O2 $C_TEST.c
./a.out 2>&1 | grep "heap-use-after-free" > /dev/null
rm ./a.out
echo "Sanity checking a test in pure C with -pie"
$CC -g -faddress-sanitizer -O2 $C_TEST.c -pie
./a.out 2>&1 | grep "heap-use-after-free" > /dev/null
rm ./a.out
for t in *.tmpl; do
@ -29,7 +36,7 @@ for t in *.tmpl; do
else
actual_t="$t"
fi
./$exe 2>&1 | $SYMBOLIZER 2> /dev/null | c++filt | ./match_output.py $actual_t || exit 1
./$exe 2>&1 | $SYMBOLIZER 2> /dev/null | c++filt | ./match_output.py $actual_t
echo $exe
rm ./$exe
[ -e "$so" ] && rm ./$so