summary refs log tree commit diff
path: root/tools/run-test-valgrind.sh
diff options
context:
space:
mode:
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 506fff75..200a27d1 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