summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2015-07-14 19:38:58 +0200
committerMichael Biebl <biebl@debian.org>2015-07-14 19:38:58 +0200
commit50a58f0fabd8a34c1b6108a107e08abe3c1ccd24 (patch)
tree6790165f39daee79e2b6c6617483320613493367 /tools
parentf408e27bccfacf347605a8d98649975a68f38a17 (diff)
Imported Upstream version 1.0.4 upstream/1.0.4
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.in2
-rwxr-xr-xtools/run-test-valgrind.sh54
-rwxr-xr-xtools/test-networkmanager-service.py2
3 files changed, 43 insertions, 15 deletions
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 626bf6a3..4d93bbd5 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -135,6 +135,7 @@ ACLOCAL = @ACLOCAL@
 ALL_LINGUAS = @ALL_LINGUAS@
 AMTAR = @AMTAR@
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AM_TESTS_FD_REDIRECT = @AM_TESTS_FD_REDIRECT@
 AR = @AR@
 AUTOCONF = @AUTOCONF@
 AUTOHEADER = @AUTOHEADER@
@@ -248,6 +249,7 @@ LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@
 LIBTOOL = @LIBTOOL@
 LIPO = @LIPO@
 LN_S = @LN_S@
+LOG_DRIVER = @LOG_DRIVER@
 LTLIBICONV = @LTLIBICONV@
 LTLIBINTL = @LTLIBINTL@
 LTLIBOBJS = @LTLIBOBJS@
diff --git a/tools/run-test-valgrind.sh b/tools/run-test-valgrind.sh
index 200a27d1..ff5bc44c 100755
--- a/tools/run-test-valgrind.sh
+++ b/tools/run-test-valgrind.sh
@@ -3,18 +3,17 @@
 LIBTOOL="$1"; shift
 VALGRIND="$1"; shift
 SUPPRESSIONS="$1"; shift
+VALGRIND_ERROR=37
 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
+    # Spawn DBus
+    eval `dbus-launch --sh-syntax`
+    trap "kill $DBUS_SESSION_BUS_PID" EXIT
     shift
 fi
-TEST="$1"; shift
+TEST="$1"
 
 if [ "$NMTST_NO_VALGRIND" != "" ]; then
-	"$TEST"
+	"$@"
 	exit $?
 fi
 
@@ -24,21 +23,48 @@ export G_SLICE=always-malloc
 export G_DEBUG=gc-friendly
 $LIBTOOL --mode=execute "$VALGRIND" \
 	--quiet \
-	--error-exitcode=1 \
+	--error-exitcode=$VALGRIND_ERROR \
 	--leak-check=full \
 	--gen-suppressions=all \
 	--suppressions="$SUPPRESSIONS" \
+	--num-callers=100 \
 	--log-file="$LOGFILE" \
-	"$TEST"
+	"$@"
 RESULT=$?
 
-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
+test -s "$LOGFILE"
+HAS_ERRORS=$?
 
 if [ $RESULT -ne 0 -a $RESULT -ne 77 ]; then
-	echo "Don't forget to check the valgrind log at '`realpath $LOGFILE`'." >&2
+	if [ $HAS_ERRORS -ne 0 ]; then
+		rm -f "$LOGFILE"
+	elif [ $RESULT -ne $VALGRIND_ERROR ]; then
+		# the test (probably) didn't fail due to valgrind.
+		echo "The test failed. Also check the valgrind log at '`realpath "$LOGFILE"`'" >&2
+	else
+		echo "valgrind failed! Check the log at '`realpath "$LOGFILE"`'" >&2
+		UNRESOLVED=$(awk -F: '/obj:\// {print $NF}' "$LOGFILE" | sort | uniq)
+		if [ -n "$UNRESOLVED" ]; then
+			echo Some addresses could not be resolved into symbols. >&2
+			echo The errors might get suppressed when you install the debuging symbols. >&2
+			if [ -x /usr/bin/dnf ]; then
+				echo Hint: dnf debuginfo-install $UNRESOLVED >&2
+			elif [ -x /usr/bin/debuginfo-install ]; then
+				echo Hint: debuginfo-install $UNRESOLVED >&2
+			else
+				echo Files without debugging symbols: $UNRESOLVED >&2
+			fi
+		fi
+	fi
+	exit $RESULT
+fi
+
+if [ $HAS_ERRORS -eq 0 ]; then
+	# shouldn't actually happen...
+	echo "valgrind succeeded, but log is not empty: '`realpath "$LOGFILE"`'" >&2
+	exit 1
 fi
 
+rm -f "$LOGFILE"
+
 exit $RESULT
diff --git a/tools/test-networkmanager-service.py b/tools/test-networkmanager-service.py
index 50803c88..6035fecd 100755
--- a/tools/test-networkmanager-service.py
+++ b/tools/test-networkmanager-service.py
@@ -1148,7 +1148,7 @@ def main():
         sys.exit(1)
 
     # Watch stdin; if it closes, assume our parent has crashed, and exit
-    io = GLib.IOChannel.unix_new(0)
+    io = GLib.IOChannel(0)
     io.add_watch(GLib.IOCondition.HUP, stdin_cb)
 
     # also quit after inactivity to ensure we don't stick around if the above fails somehow