[TSan] Slightly improve check_analyze script.

De-hardcode path to TSan-ified executable: pass it as an input to
the scripts. Fix them so that they don't write to the current
directory. Remove their invocation from Makefile.old: they are
broken there anyway, as check_analyze.sh now matches trunk Clang.

llvm-svn: 254936
This commit is contained in:
Alexey Samsonov 2015-12-07 20:18:50 +00:00
parent cbc12262e3
commit a8bf5099d6
3 changed files with 28 additions and 8 deletions

View File

@ -79,7 +79,6 @@ presubmit:
$(MAKE) -f Makefile.old clean
$(MAKE) -f Makefile.old run DEBUG=0 -j 16 CC=gcc CXX=g++
./check_memcpy.sh
./check_analyze.sh
# Sanity check for Go runtime
(cd go && ./buildgo.sh)
# Check cmake build

View File

@ -1,10 +1,17 @@
#!/bin/bash
#
# Script that prints information about generated code in TSan runtime.
set -e
set -u
if [[ "$#" != 1 ]]; then
echo "Usage: $0 /path/to/binary/built/with/tsan"
exit 1
fi
get_asm() {
grep __tsan_$1.: -A 10000 libtsan.objdump | \
grep __tsan_$1.: -A 10000 ${OBJDUMP_CONTENTS} | \
awk "/[^:]$/ {print;} />:/ {c++; if (c == 2) {exit}}"
}
@ -19,15 +26,19 @@ list="write1 \
func_entry \
func_exit"
BIN=`dirname $0`/tsan_test
objdump -d $BIN > libtsan.objdump
nm -S $BIN | grep "__tsan_" > libtsan.nm
BIN=$1
OUTPUT_DIR=$(mktemp -t -d analyze_libtsan_out.XXXXXXXX)
OBJDUMP_CONTENTS=${OUTPUT_DIR}/libtsan_objdump
NM_CONTENTS=${OUTPUT_DIR}/libtsan_nm
objdump -d $BIN > ${OBJDUMP_CONTENTS}
nm -S $BIN | grep "__tsan_" > ${NM_CONTENTS}
for f in $list; do
file=asm_$f.s
file=${OUTPUT_DIR}/asm_$f.s
get_asm $f > $file
tot=$(wc -l < $file)
size=$(grep __tsan_$f$ libtsan.nm | awk --non-decimal-data '{print ("0x"$2)+0}')
size=$(grep __tsan_$f$ ${NM_CONTENTS} | awk --non-decimal-data '{print ("0x"$2)+0}')
rsp=$(grep '(%rsp)' $file | wc -l)
push=$(grep 'push' $file | wc -l)
pop=$(grep 'pop' $file | wc -l)

View File

@ -1,7 +1,17 @@
#!/bin/bash
#
# Script that checks that critical functions in TSan runtime have correct number
# of push/pop/rsp instructions to verify that runtime is efficient enough.
set -u
RES=$(./analyze_libtsan.sh)
if [[ "$#" != 1 ]]; then
echo "Usage: $0 /path/to/binary/built/with/tsan"
exit 1
fi
SCRIPTDIR=$(dirname $0)
RES=$(${SCRIPTDIR}/analyze_libtsan.sh $1)
PrintRes() {
printf "%s\n" "$RES"
}