. test-helper.sh
+dbus_session_setup || { echo "1..0 # SKIP"; exit; }
mock_snapperd_setup || { echo "1..0 # SKIP"; exit; }
# http://testanything.org/
set -e
set -u
+. test-helper.sh
+
+dbus_session_setup || { echo "1..0 # SKIP"; exit; }
+
# http://testanything.org/
echo 1..1
-. test-helper.sh
-
TEST="1 - It complains about malformed XML in config file"
STDERR=$(test_empty_messages | runit zypp-plugin-malformed.conf 2>&1 >/dev/null || :)
echo "$STDERR"
set -e
set -u
+. test-helper.sh
+
+dbus_session_setup || { echo "1..0 # SKIP"; exit; }
+
# http://testanything.org/
echo 1..1
-. test-helper.sh
-
TEST="1 - It complains about invalid XML in config file"
STDERR=$(test_pre_post_snapshots | runit zypp-plugin-invalid.conf 2>&1 >/dev/null || :)
echo "$STDERR"
. test-helper.sh
+dbus_session_setup || { echo "1..0 # SKIP"; exit; }
+
# http://testanything.org/
echo 1..2
if HAVE_ZYPP
-TEST_LOG_DRIVER = dbus-run-session -- $(SHELL) tap-driver.sh
+TEST_LOG_DRIVER = $(SHELL) tap-driver.sh
check_SCRIPTS = 1-happy.test 2-malformed-xml.test 3-invalid-xml.test 4-badjson.test 99-shell.test
noinst_SCRIPTS = mock-snapperd test-helper.sh
stomp_message PLUGINEND "" ""
}
+# snapper needs a DBus connection even if it ends up not using it :-/
+dbus_session_setup() {
+ if [ -z "${DBUS_SESSION_BUS_ADDRESS-}" ]; then
+ if ! type -P dbus-run-session >/dev/null; then
+ echo "dbus-run-session cannot be run, skipping test"
+ return 77
+ else
+ echo "Restarting test with dbus-run-session"
+ exec dbus-run-session -- "$0"
+ fi
+ fi
+}
+
mock_snapperd_setup() {
MOCKDEP=(ruby -e "require 'dbus'")
if ! "${MOCKDEP[@]}"; then