From 50527e7ee32f2a5a2f23c7238467790f19705c51 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 19 Feb 2013 16:39:38 +0000 Subject: [PATCH 3/3] Make sure tests run with a temporary XDG_RUNTIME_DIR We don't want the regression tests' "session" getting mixed up in system-wide "sessions". This doesn't actually matter yet, but it is likely to matter in future. Signed-off-by: Simon McVittie --- test/Makefile.am | 4 +++- test/name-test/Makefile.am | 7 ++++++- test/name-test/run-test-systemserver.sh | 5 +++++ test/name-test/run-test.sh | 5 +++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index e944899..62ba715 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -115,11 +115,13 @@ endif DBUS_WITH_GLIB installcheck_tests = installcheck_environment = \ + XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ DBUS_TEST_DAEMON=$(DESTDIR)$(DBUS_DAEMONDIR)/dbus-daemon$(EXEEXT) \ DBUS_TEST_HOMEDIR=@abs_top_builddir@/dbus \ DBUS_TEST_SYSCONFDIR=$(DESTDIR)$(sysconfdir) TESTS_ENVIRONMENT = \ + XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ DBUS_BLOCK_ON_ABORT=1 \ DBUS_FATAL_WARNINGS=1 \ DBUS_TEST_DAEMON=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \ @@ -316,7 +318,7 @@ imported_data = \ $(NULL) noinst_DATA = $(imported_data) -CLEANFILES = $(noinst_DATA) +CLEANFILES = $(noinst_DATA) XDG_RUNTIME_DIR data/valid-config-files/session.conf: $(top_builddir)/bus/session.conf $(AM_V_at)$(MKDIR_P) data/valid-config-files diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index 6aaf178..43ebe15 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -12,7 +12,12 @@ AM_LDFLAGS = @R_DYNAMIC_LDFLAG@ ## so if adding tests not to be run in make check, don't add them to ## TESTS if DBUS_BUILD_TESTS -TESTS_ENVIRONMENT=DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@ PYTHON=@PYTHON@ +TESTS_ENVIRONMENT = \ + DBUS_TOP_BUILDDIR=@abs_top_builddir@ \ + DBUS_TOP_SRCDIR=@abs_top_srcdir@ \ + PYTHON=@PYTHON@ \ + XDG_RUNTIME_DIR=@abs_top_builddir@/test/XDG_RUNTIME_DIR \ + $(NULL) TESTS=run-test.sh run-test-systemserver.sh else TESTS= diff --git a/test/name-test/run-test-systemserver.sh b/test/name-test/run-test-systemserver.sh index afd1f04..90c0372 100755 --- a/test/name-test/run-test-systemserver.sh +++ b/test/name-test/run-test-systemserver.sh @@ -30,6 +30,11 @@ if test -n "$DBUS_TEST_MONITOR"; then dbus-monitor --session & fi +XDG_RUNTIME_DIR="$DBUS_TOP_BUILDDIR"/test/XDG_RUNTIME_DIR +test -d "$XDG_RUNTIME_DIR" || mkdir "$XDG_RUNTIME_DIR" +chmod 0700 "$XDG_RUNTIME_DIR" +export XDG_RUNTIME_DIR + echo "running test-expected-echo-fail" ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/tools/dbus-send --print-reply --dest=org.freedesktop.DBus.TestSuiteEchoService /org/freedesktop/TestSuite org.freedesktop.TestSuite.Echo string:hi >echo-error-output.tmp 2>&1 if ! grep -q 'DBus.Error' echo-error-output.tmp; then diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh index cad5937..84379c4 100755 --- a/test/name-test/run-test.sh +++ b/test/name-test/run-test.sh @@ -30,6 +30,11 @@ if test -n "$DBUS_TEST_MONITOR"; then dbus-monitor --session & fi +XDG_RUNTIME_DIR="$DBUS_TOP_BUILDDIR"/test/XDG_RUNTIME_DIR +test -d "$XDG_RUNTIME_DIR" || mkdir "$XDG_RUNTIME_DIR" +chmod 0700 "$XDG_RUNTIME_DIR" +export XDG_RUNTIME_DIR + echo "running test-ids" ${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-ids || die "test-ids failed" -- 1.7.10.4