From e9bfd0e29c164b79205c23617b199573b78abd5b Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Mon, 20 Oct 2014 18:24:26 +0200 Subject: [PATCH] tests: Don't run session-long dbus daemons for tests They require a tty or X11 displays, thus are not suitable for headless runs (such as in mock). Furthermore, they die with the tty or X11 session, which is somehow late -- a lot of them may accumulate. Let's kill them right away. --- libnm-glib/tests/libnm-glib-test-launch.sh | 8 +++++--- libnm/tests/libnm-test-launch.sh | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libnm-glib/tests/libnm-glib-test-launch.sh b/libnm-glib/tests/libnm-glib-test-launch.sh index 1db656ad06..42d9fbe26d 100755 --- a/libnm-glib/tests/libnm-glib-test-launch.sh +++ b/libnm-glib/tests/libnm-glib-test-launch.sh @@ -1,7 +1,9 @@ #!/bin/sh +# Spawn DBus if there's none if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then - exec dbus-launch --exit-with-session "$@" -else - exec "$@" + eval `dbus-launch --sh-syntax` + trap "kill $DBUS_SESSION_BUS_PID" EXIT fi + +"$@" diff --git a/libnm/tests/libnm-test-launch.sh b/libnm/tests/libnm-test-launch.sh index 1db656ad06..42d9fbe26d 100755 --- a/libnm/tests/libnm-test-launch.sh +++ b/libnm/tests/libnm-test-launch.sh @@ -1,7 +1,9 @@ #!/bin/sh +# Spawn DBus if there's none if [ -z "$DBUS_SESSION_BUS_ADDRESS" ]; then - exec dbus-launch --exit-with-session "$@" -else - exec "$@" + eval `dbus-launch --sh-syntax` + trap "kill $DBUS_SESSION_BUS_PID" EXIT fi + +"$@"