Commit f2f239fc authored by Simon McVittie's avatar Simon McVittie

tests: Make tests fail if they try to connect to the real session bus

It is too easy for a developer working in an environment that has a
session bus to write tests that pass locally, but fail in minimal
environments. This is also risky because the tests might do
destructive things on the developer's real session bus. We can avoid
connecting to the session bus by consistently removing its address
from the environment, and replacing it with something that will
always fail.
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101698
parent 8e48532d
......@@ -200,6 +200,7 @@ installable_test_meta_with_config = \
installcheck_tests =
installcheck_environment = \
export XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR; \
export DBUS_SESSION_BUS_ADDRESS=do-not-use-real-session:; \
export DBUS_TEST_DAEMON=$(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon$(EXEEXT); \
export DBUS_TEST_DBUS_LAUNCH=$(DESTDIR)$(bindir)/dbus-launch$(EXEEXT); \
export DBUS_TEST_DBUS_MONITOR=$(DESTDIR)$(bindir)/dbus-monitor$(EXEEXT); \
......@@ -211,6 +212,7 @@ installcheck_environment = \
AM_TESTS_ENVIRONMENT = \
export XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR; \
export DBUS_FATAL_WARNINGS=1; \
export DBUS_SESSION_BUS_ADDRESS=do-not-use-real-session:; \
export DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT); \
export DBUS_TEST_DBUS_LAUNCH=@abs_top_builddir@/tools/dbus-launch$(EXEEXT); \
export DBUS_TEST_DBUS_MONITOR=@abs_top_builddir@/tools/dbus-monitor$(EXEEXT); \
......
......@@ -28,6 +28,7 @@ TESTS =
if DBUS_ENABLE_EMBEDDED_TESTS
if DBUS_UNIX
AM_TESTS_ENVIRONMENT = \
export DBUS_SESSION_BUS_ADDRESS=do-not-use-real-session:; \
export DBUS_TOP_BUILDDIR=@abs_top_builddir@; \
export DBUS_TOP_SRCDIR=@abs_top_srcdir@; \
export PATH="@abs_top_builddir@/bus:$$PATH"; \
......@@ -35,7 +36,6 @@ AM_TESTS_ENVIRONMENT = \
export DBUS_TEST_DATA=@abs_top_builddir@/test/data; \
export DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT); \
export XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR; \
unset DBUS_SESSION_BUS_ADDRESS; \
unset DBUS_SESSION_BUS_PID; \
$(NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment