summaryrefslogtreecommitdiff
path: root/tools/run-test-valgrind.sh
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-05-05 17:48:57 +0200
committerMichael Biebl <biebl@debian.org>2015-05-05 17:48:57 +0200
commitf408e27bccfacf347605a8d98649975a68f38a17 (patch)
tree654fd6695c31511baf919b1c0870d119a352ed75 /tools/run-test-valgrind.sh
parent2c032d8f1c6292c1338a615e6ec40252889ba85c (diff)
Imported Upstream version 1.0.2upstream/1.0.2
Diffstat (limited to 'tools/run-test-valgrind.sh')
-rwxr-xr-xtools/run-test-valgrind.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/run-test-valgrind.sh b/tools/run-test-valgrind.sh
index 506fff75c..200a27d13 100755
--- a/tools/run-test-valgrind.sh
+++ b/tools/run-test-valgrind.sh
@@ -3,8 +3,21 @@
LIBTOOL="$1"; shift
VALGRIND="$1"; shift
SUPPRESSIONS="$1"; shift
+if [ "$1" = "--launch-dbus" ]; then
+ # Spawn DBus if there's none
+ if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then
+ eval `dbus-launch --sh-syntax`
+ trap "kill $DBUS_SESSION_BUS_PID" EXIT
+ fi
+ shift
+fi
TEST="$1"; shift
+if [ "$NMTST_NO_VALGRIND" != "" ]; then
+ "$TEST"
+ exit $?
+fi
+
LOGFILE="valgrind-`echo "$TEST" | tr -cd '[:alpha:]-'`.log"
export G_SLICE=always-malloc
@@ -19,7 +32,12 @@ $LIBTOOL --mode=execute "$VALGRIND" \
"$TEST"
RESULT=$?
-if [ $RESULT -ne 0 ]; then
+if [ $RESULT -eq 0 -a "$(wc -c "$LOGFILE" | awk '{print$1}')" -ne 0 ]; then
+ echo "valgrind succeeded, but log is not empty: $LOGFILE"
+ exit 1
+fi
+
+if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
echo "Don't forget to check the valgrind log at '`realpath $LOGFILE`'." >&2
fi