summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-12-13 00:44:11 -0800
committerPatrick Ohly <patrick.ohly@intel.com>2018-01-03 10:39:50 +0100
commit705a5c66a8f65f4f39059f60d8410dce2430e06c (patch)
treed9997497aee97a2dfc28757a0f6a77a082962d16
parent3325aebbff42025cb9f25fb17c5255bad613cac1 (diff)
wrappercheck.sh: detect premature exit while waiting for D-Bus daemon
The "waiting for daemon to connect to D-Bus" loop did not check whether daemon was still running at all, causing testing to get stuck occasionally when the daemon failed. THe loop waiting for output already checked that, but can be simplified. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
-rwxr-xr-xtest/wrappercheck.sh9
1 files changed, 4 insertions, 5 deletions
diff --git a/test/wrappercheck.sh b/test/wrappercheck.sh
index 357e0639..55be48b2 100755
--- a/test/wrappercheck.sh
+++ b/test/wrappercheck.sh
@@ -74,10 +74,8 @@ PIDS+="$BACKGROUND_PID"
if [ "$DAEMON_LOG" ] && [ "$WAIT_FOR_DAEMON_OUTPUT" ]; then
( set +x; echo >&2 "*** waiting for daemon to write '$WAIT_FOR_DAEMON_OUTPUT' into $DAEMON_LOG"
- while [ $daemonmatches -eq $(grep -e "$WAIT_FOR_DAEMON_OUTPUT" "$DAEMON_LOG" | wc -l) ]; do
- if ! kill -0 $BACKGROUND_PID 2>/dev/null; then
- break
- fi
+ while kill -0 $BACKGROUND_PID 2>/dev/null &&
+ [ $daemonmatches -eq $(grep -e "$WAIT_FOR_DAEMON_OUTPUT" "$DAEMON_LOG" | wc -l) ]; do
sleep 1
done
)
@@ -85,7 +83,8 @@ fi
if [ "$WAIT_FOR_DBUS_DAEMON" ]; then
( set +x; echo >&2 "*** waiting for daemon to connect to D-Bus as '$WAIT_FOR_DBUS_DAEMON'"
- while ! (dbus-send --session --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep -q "$WAIT_FOR_DBUS_DAEMON"); do
+ while kill -0 $BACKGROUND_PID 2>/dev/null &&
+ ! (dbus-send --session --print-reply --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep -q "$WAIT_FOR_DBUS_DAEMON"); do
sleep 1
done
)