diff options
author | Simon McVittie <smcv@debian.org> | 2022-02-21 10:35:10 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2022-02-25 14:57:18 +0000 |
commit | ba6fdab22d677f9363be1b23d93e6314a5c2b321 (patch) | |
tree | a873dc8af095fd29dfc7e2e8f0288f0d581a5c5b | |
parent | e5922ee2714bf058ca58c4a3850023562353f869 (diff) | |
download | dbus-ba6fdab22d677f9363be1b23d93e6314a5c2b321.tar.gz |
tests: Ensure session bus has started before integration test
The session dbus-daemon won't necessarily be run immediately on login
if we are using systemd socket activation for it, and the transient
services directory $XDG_RUNTIME_DIR/dbus-1/services isn't created until
it's actually run. Ping the dbus-daemon to make sure it's available.
Signed-off-by: Simon McVittie <smcv@debian.org>
Bug-Debian: https://bugs.debian.org/1005889
(cherry picked from commit 47a4bdfaf8f31ebb20f2d0b549109cb946b08440)
-rw-r--r-- | test/integration/transient-services.sh | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/integration/transient-services.sh b/test/integration/transient-services.sh index 2d946d9e..40bb8aed 100644 --- a/test/integration/transient-services.sh +++ b/test/integration/transient-services.sh @@ -74,8 +74,19 @@ trap cleanup EXIT echo "1..2" -# This is an integration test, so we expect the dbus-daemon to already be -# running +# If the dbus-daemon is launched on-demand by a systemd socket unit, it +# might not be there yet, even if the socket is +( +dbus-send --session --dest="org.freedesktop.DBus" \ + --type=method_call --print-reply /org/freedesktop/DBus \ + org.freedesktop.DBus.Peer.Ping || touch "$workdir/failed" \ +) 2>&1 | sed -e 's/^/# /' + +if [ -e "$workdir/failed" ]; then + echo "Bail out! Unable to ensure dbus-daemon has started" + exit 1 +fi + if ! test -d "$XDG_RUNTIME_DIR/dbus-1/services"; then echo "Bail out! $XDG_RUNTIME_DIR/dbus-1/services is not a directory" exit 1 |