mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2025-12-31 07:40:16 +01:00
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 <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101698
This commit is contained in:
parent
8e48532d24
commit
f2f239fc83
2 changed files with 3 additions and 1 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue