1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#! @SHELL@
# Run examples and tests through valgrind.
builddir="@builddir@"
if test x"@VALGRIND@" = ":"; then
echo >&2 "valgrind is required to run this"
exit 1
fi
args=""
args="$args --error-exitcode=1"
args="$args --leak-check=yes"
args="$args --leak-resolution=high"
args="$args --num-callers=20"
args="$args --show-reachable=yes"
args="$args --tool=memcheck"
log="$(mktemp -p "$builddir")"
for prog in "$@"; do
echo -n "$prog .. "
if [ -z "${prog##*.sh}" ]; then
"./$prog" "@VALGRIND@" $args > "$log" 2>&1
else
"@VALGRIND@" $args -- "./$prog" > "$log" 2>&1
fi
res=$?
if [ $res -ne 0 ]; then
echo "FAIL."
cat "$log"
rm "$log"
exit 1
fi
echo "OK."
rm "$log"
done
|