123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- #!/bin/sh
- make
- if [ $? = 2 ] ; then
- echo "Did you run configure? Or maybe you're running the script from the tools directory? (you need to run it from the top kea build directory)"
- exit 1
- fi
- set -e
- LOGFILE="${VALGRIND_FILE:-`pwd`/valgrind.log}"
- FLAGS="${VALGRIND_FLAGS:---leak-check=full --track-fds=yes}"
- FLAGS="$FLAGS --log-file=$LOGFILE.%p"
- FOUND_ANY=false
- FAILED=
- eval $(find . -type f -name *_unittests -print | grep -v '\.libs/' | while read testname ; do
- sed -e 's#exec "#exec valgrind '"$FLAGS"' "#' "$testname" > "$testname.valgrind"
- chmod +x "$testname.valgrind"
- echo "$testname" >>"$LOGFILE"
- echo "===============" >>"$LOGFILE"
- OLDDIR="`pwd`"
- cd $(dirname "$testname")
- ./$(basename $testname).valgrind >&2 &
- PID="$!"
- set +e
- wait "$PID"
- CODE="$?"
- set -e
- cd "$OLDDIR"
- if [ "$CODE" != 0 ] ; then
- echo 'FAILED="$FAILED
- '"$testname"'"'
- fi
- NAME="$LOGFILE.$PID"
- rm "$testname.valgrind"
-
- if [ -e $NAME ]; then
- grep "==$PID==" "$NAME" >>"$LOGFILE"
- rm "$NAME"
- fi
- echo 'FOUND_ANY=true'
- done)
- if test -n "$FAILED"; then
- echo "These tests failed:" >&2
- echo "$FAILED" >&2
- fi
- if ! $FOUND_ANY ; then
- echo "No test was found. It is possible you configured without --with-gtest or you run it from wrong directory" >&2
- exit 1
- fi
|