From: Ralf Habacker Date: Mon, 31 Oct 2011 14:53:25 +0000 (+0100) Subject: Use separate bus configuration files for executing test cases with a temporary sessio... X-Git-Tag: dbus-1.13.8~63 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6d4639a3335ace14a699192acddf92a97acc8085;p=thirdparty%2Fdbus.git Use separate bus configuration files for executing test cases with a temporary session bus Instead of the previous adaptation of the existing template for the session bus, a separate template is now used, which can be more easily adapted to the requirements of the test applications. Bug: https://gitlab.freedesktop.org/dbus/dbus/issues/57 --- diff --git a/test/Makefile.am b/test/Makefile.am index f373585c5..7e2e202f6 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -458,6 +458,8 @@ in_data = \ data/valid-config-files/multi-user.conf.in \ data/valid-config-files/pending-fd-timeout.conf.in \ data/valid-config-files/systemd-activation.conf.in \ + data/valid-config-files/tmp-session.conf.in \ + data/valid-config-files-system/tmp-session-like-system.conf.in \ data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoExec.service.in \ data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoService.service.in \ data/invalid-service-files-system/org.freedesktop.DBus.TestSuiteNoUser.service.in \ @@ -476,7 +478,6 @@ in_data = \ EXTRA_DIST += $(in_data) static_data = \ - name-test/tmp-session-like-system.conf \ data/auth/anonymous-client-successful.auth-script \ data/auth/anonymous-server-successful.auth-script \ data/auth/cancel.auth-script \ @@ -579,6 +580,8 @@ uninstalled-config-local: for F in $(in_data); do \ $(MKDIR_P) "$${F%/*}"; \ sed \ + -e 's,[@]DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL[@],$(DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL),' \ + -e 's,[@]DBUS_SESSION_BUS_LISTEN_ADDRESS[@],$(DBUS_SESSION_BUS_LISTEN_ADDRESS),' \ -e 's,[@]DBUS_TEST_DATA[@],@abs_builddir@/data,' \ -e 's,[@]DBUS_TEST_EXEC[@],@abs_builddir@,' \ -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \ @@ -594,6 +597,8 @@ if DBUS_ENABLE_INSTALLED_TESTS for F in $(in_data); do \ $(MKDIR_P) "installable/$${F%/*}"; \ sed \ + -e 's,[@]DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL[@],$(DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL),' \ + -e 's,[@]DBUS_SESSION_BUS_LISTEN_ADDRESS[@],$(DBUS_SESSION_BUS_LISTEN_ADDRESS),' \ -e 's,[@]DBUS_TEST_DATA[@],$(testexecdir)/data,' \ -e 's,[@]DBUS_TEST_EXEC[@],$(testexecdir),' \ -e 's,[@]DBUS_USER[@],$(DBUS_USER),' \ diff --git a/test/name-test/tmp-session-like-system.conf b/test/data/valid-config-files-system/tmp-session-like-system.conf.in similarity index 93% rename from test/name-test/tmp-session-like-system.conf rename to test/data/valid-config-files-system/tmp-session-like-system.conf.in index b3d9caeaf..9665a22a0 100644 --- a/test/name-test/tmp-session-like-system.conf +++ b/test/data/valid-config-files-system/tmp-session-like-system.conf.in @@ -1,5 +1,5 @@ unix:tmpdir=/tmp - + @DBUS_TEST_DATA@/valid-service-files @@ -63,21 +63,21 @@ send_member="EmitFoo"/> - 1000000000 1000000000 1000000000 - 120000 + 120000 240000 - 100000 + 100000 10000 100000 10000 diff --git a/test/data/valid-config-files/tmp-session.conf.in b/test/data/valid-config-files/tmp-session.conf.in new file mode 100644 index 000000000..502619dd6 --- /dev/null +++ b/test/data/valid-config-files/tmp-session.conf.in @@ -0,0 +1,67 @@ + + + + session + + + + + @DBUS_SESSION_BUS_LISTEN_ADDRESS@ + + + @DBUS_SESSION_CONF_MAYBE_AUTH_EXTERNAL@ + + @DBUS_TEST_DATA@/valid-service-files + + + + + + + + + + + + + + 1000000000 + 250000000 + 1000000000 + 250000000 + 1000000000 + + 120000 + 240000 + 150000 + 100000 + 10000 + 100000 + 10000 + 50000 + 50000 + 50000 + 10000 + 10000 + 1000000000 + + 16 + + diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am index dd7f82a88..8269feff3 100644 --- a/test/name-test/Makefile.am +++ b/test/name-test/Makefile.am @@ -19,7 +19,7 @@ SH_LOG_DRIVER = $(LOG_DRIVER) LOG_COMPILER = \ @abs_top_builddir@/tools/dbus-run-session$(EXEEXT) \ - --config-file=@abs_builddir@/uninstalled-session.conf \ + --config-file=@abs_top_builddir@/test/data/valid-config-files/tmp-session.conf \ --dbus-daemon=@abs_top_builddir@/bus/dbus-daemon$(EXEEXT) \ -- \ $(NULL) @@ -46,15 +46,6 @@ AM_TESTS_ENVIRONMENT = \ unset DBUS_SESSION_BUS_PID; \ $(NULL) -uninstalled-session.conf: $(top_builddir)/bus/session.conf Makefile - $(SED) -e 's|@abs_top_builddir@/test/data/valid-service-files|g' \ - -e 's| $@ - -check_DATA = \ - uninstalled-session.conf \ - $(NULL) - TESTS += \ run-test.sh \ run-test-systemserver.sh \ diff --git a/test/name-test/run-test-systemserver.sh b/test/name-test/run-test-systemserver.sh index 9926cad6c..b4a049844 100755 --- a/test/name-test/run-test-systemserver.sh +++ b/test/name-test/run-test-systemserver.sh @@ -7,8 +7,8 @@ MODE=$1 DBUS_TEST_NAME_RUN_TEST_SCRIPT=1 export DBUS_TEST_NAME_RUN_TEST_SCRIPT -SOURCE_CONFIG_FILE=$DBUS_TOP_SRCDIR/test/name-test/tmp-session-like-system.conf -export SOURCE_CONFIG_FILE +DBUS_TEST_CONFIG_FILE=$DBUS_TOP_BUILDDIR/test/data/valid-config-files-system/tmp-session-like-system.conf +export DBUS_TEST_CONFIG_FILE # Rerun ourselves with tmp session bus if we're not already if test -z "$DBUS_TEST_NAME_IN_SYS_RUN_TEST"; then DBUS_TEST_NAME_IN_SYS_RUN_TEST=1 diff --git a/tools/run-with-tmp-session-bus.sh b/tools/run-with-tmp-session-bus.sh index 688f9e483..28379bfaa 100755 --- a/tools/run-with-tmp-session-bus.sh +++ b/tools/run-with-tmp-session-bus.sh @@ -4,12 +4,13 @@ SCRIPTNAME="$0" WRAPPED_SCRIPT="$1" shift -CONFIG_FILE=./tmp-session-bus.$$.conf +if test -z "$DBUS_TEST_CONFIG_FILE"; then + DBUS_TEST_CONFIG_FILE="$DBUS_TOP_BUILDDIR/test/data/valid-config-files/tmp-session.conf" +fi die () { echo "$SCRIPTNAME: $*" >&2 - rm -f "$CONFIG_FILE" exit 1 } @@ -17,21 +18,6 @@ if test -z "$DBUS_TOP_BUILDDIR" ; then die "Must set DBUS_TOP_BUILDDIR" fi -SERVICE_DIR="$DBUS_TOP_BUILDDIR/test/data/valid-service-files" -ESCAPED_SERVICE_DIR=`echo $SERVICE_DIR | sed -e 's/\//\\\\\\//g'` -echo "escaped service dir is: $ESCAPED_SERVICE_DIR" >&2 - -if test -z "$SOURCE_CONFIG_FILE"; then - SOURCE_CONFIG_FILE="$DBUS_TOP_BUILDDIR/bus/session.conf"; -fi -## create a configuration file based on the standard session.conf -cat $SOURCE_CONFIG_FILE | \ - sed -e 's/'$ESCAPED_SERVICE_DIR'<\/servicedir>/g' | \ - sed -e 's/ $CONFIG_FILE - -echo "Created configuration file $CONFIG_FILE" >&2 - if ! test -e "$DBUS_TOP_BUILDDIR"/bus/dbus-daemon ; then die "$DBUS_TOP_BUILDDIR/bus/dbus-daemon does not exist" fi @@ -46,12 +32,11 @@ unset DBUS_SESSION_BUS_ADDRESS unset DBUS_SESSION_BUS_PID $DBUS_TOP_BUILDDIR/tools/dbus-run-session \ - --config-file="$CONFIG_FILE" \ + --config-file="$DBUS_TEST_CONFIG_FILE" \ --dbus-daemon="$DBUS_TOP_BUILDDIR/bus/dbus-daemon" \ -- \ "$WRAPPED_SCRIPT" "$@" error=$? # clean up -rm -f "$CONFIG_FILE" exit $error