From 12d06383dda4735cf0ab1ec651688c107a11dc17 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 20 Jul 2016 12:07:03 +0100 Subject: [PATCH] test: expand dbus-launch-eval test to cover stdin being closed Signed-off-by: Simon McVittie --- test/test-dbus-launch-eval.sh | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/test/test-dbus-launch-eval.sh b/test/test-dbus-launch-eval.sh index 7b5a66d..c33437e 100755 --- a/test/test-dbus-launch-eval.sh +++ b/test/test-dbus-launch-eval.sh @@ -41,7 +41,7 @@ else config="--sh-syntax" fi -echo "1..1" +echo "1..3" unset DBUS_SESSION_BUS_ADDRESS unset DBUS_SESSION_BUS_PID @@ -61,3 +61,42 @@ ${DBUS_TEST_DBUS_SEND} --session --dest=org.freedesktop.DBus \ kill "$DBUS_SESSION_BUS_PID" echo "ok 1 - normal dbus-launch" + +unset DBUS_SESSION_BUS_ADDRESS +unset DBUS_SESSION_BUS_PID + +eval "$(${DBUS_TEST_DBUS_LAUNCH} --sh-syntax "$config" <&-)" + +test -n "$DBUS_SESSION_BUS_ADDRESS" +env | grep '^DBUS_SESSION_BUS_ADDRESS=' + +test -n "$DBUS_SESSION_BUS_PID" +test "x$(env | grep '^DBUS_SESSION_BUS_PID=')" = "x" +kill -0 "$DBUS_SESSION_BUS_PID" + +${DBUS_TEST_DBUS_SEND} --session --dest=org.freedesktop.DBus \ + --type=method_call --print-reply / org.freedesktop.DBus.ListNames >&2 + +kill "$DBUS_SESSION_BUS_PID" + +echo "ok 2 - dbus-launch with stdin closed" + +unset DBUS_SESSION_BUS_ADDRESS +unset DBUS_SESSION_BUS_PID + +# we can't close stdout because that breaks --sh-syntax +eval "$(${DBUS_TEST_DBUS_LAUNCH} --sh-syntax "$config" <&- 2>&-)" + +test -n "$DBUS_SESSION_BUS_ADDRESS" +env | grep '^DBUS_SESSION_BUS_ADDRESS=' + +test -n "$DBUS_SESSION_BUS_PID" +test "x$(env | grep '^DBUS_SESSION_BUS_PID=')" = "x" +kill -0 "$DBUS_SESSION_BUS_PID" + +${DBUS_TEST_DBUS_SEND} --session --dest=org.freedesktop.DBus \ + --type=method_call --print-reply / org.freedesktop.DBus.ListNames >&2 + +kill "$DBUS_SESSION_BUS_PID" + +echo "ok 3 - dbus-launch with stdin and stderr closed" -- 2.8.1