summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/Makefile.am1
-rw-r--r--tools/Makefile.in1
-rwxr-xr-xtools/run-test-dbus-session.sh10
-rwxr-xr-xtools/run-test-valgrind.sh11
4 files changed, 20 insertions, 3 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index f008956d..27d6bcc4 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -3,5 +3,6 @@ EXTRA_DIST = \
 	debug-helper.py \
 	doc-generator.xsl \
 	run-test-valgrind.sh \
+	run-test-dbus-session.sh \
 	test-networkmanager-service.py \
 	test-sudo-wrapper.sh
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 0c4078a3..585a0503 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -399,6 +399,7 @@ EXTRA_DIST = \
 	debug-helper.py \
 	doc-generator.xsl \
 	run-test-valgrind.sh \
+	run-test-dbus-session.sh \
 	test-networkmanager-service.py \
 	test-sudo-wrapper.sh
 
diff --git a/tools/run-test-dbus-session.sh b/tools/run-test-dbus-session.sh
new file mode 100755
index 00000000..0235d65b
--- /dev/null
+++ b/tools/run-test-dbus-session.sh
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if ! which dbus-run-session &>/dev/null; then
+    eval `dbus-launch --sh-syntax`
+    trap "kill $DBUS_SESSION_BUS_PID" EXIT
+    "$@"
+    exit $?
+fi
+
+dbus-run-session -- "$@"
diff --git a/tools/run-test-valgrind.sh b/tools/run-test-valgrind.sh
index 4dc092a0..f2eeefcd 100755
--- a/tools/run-test-valgrind.sh
+++ b/tools/run-test-valgrind.sh
@@ -80,10 +80,14 @@ else
     fi
 fi
 
+NMTST_DBUS_RUN_SESSION=()
 if [ "$NMTST_LAUNCH_DBUS" == "yes" ]; then
-    # Spawn DBus
-    eval `dbus-launch --sh-syntax`
-    trap "kill $DBUS_SESSION_BUS_PID" EXIT
+    if ! which dbus-run-session &>/dev/null ; then
+        eval `dbus-launch --sh-syntax`
+        trap "kill $DBUS_SESSION_BUS_PID" EXIT
+    else
+        NMTST_DBUS_RUN_SESSION=(dbus-run-session --)
+    fi
 fi
 
 if [ "$NMTST_NO_VALGRIND" != "" ]; then
@@ -95,6 +99,7 @@ LOGFILE="${TEST}.valgrind-log"
 
 export G_SLICE=always-malloc
 export G_DEBUG=gc-friendly
+"${NMTST_DBUS_RUN_SESSION[@]}" \
 "${NMTST_LIBTOOL[@]}" "$NMTST_VALGRIND" \
 	--quiet \
 	--error-exitcode=$VALGRIND_ERROR \