[gjs] build: Use dbus-run-session



commit 458100a962d05f1ce783ce125909719fbd86a5cb
Author: Philip Chimento <philip chimento gmail com>
Date:   Tue Nov 15 21:08:00 2016 -0800

    build: Use dbus-run-session
    
    DBus 1.8 gained a utility called dbus-run-session, that will run another
    program inside a new session bus and then shut down the session bus
    afterwards. This can replace the hand-rolled run-with-dbus script.
    
    Even though we started a fake system bus with run-with-dbus, I don't
    believe it was used. We also generated extra configuration files with
    which to start the buses, but I don't believe those were necessary
    either.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771745

 Makefile-test.am   |   16 ++---
 configure.ac       |    6 +-
 test/run-with-dbus |  184 ----------------------------------------------------
 test/test-bus.conf |    2 +
 4 files changed, 12 insertions(+), 196 deletions(-)
---
diff --git a/Makefile-test.am b/Makefile-test.am
index 608b9cf..7aff2cd 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -1,8 +1,6 @@
-EXTRA_DIST += \
-       test/run-with-dbus \
-       test/test-bus.conf
+EXTRA_DIST += test/test-bus.conf
 
-TEST_PROGS_OPTIONS =
+TEST_PROGS_OPTIONS = 2>test_user_data/logs/stderr.log
 
 if XVFB_TESTS
 XVFB_INVOCATION = $(XVFB) -ac -noreset -screen 0 1024x768x16
@@ -24,7 +22,9 @@ XVFB_START =
 endif
 
 if DBUS_TESTS
-RUN_WITH_DBUS = ${top_srcdir}/test/run-with-dbus --session --system
+LOG_COMPILER = $(DBUS_RUN_SESSION)
+AM_LOG_FLAGS = --config-file=$(srcdir)/test/test-bus.conf --
+RUN_WITH_DBUS = $(LOG_COMPILER) $(AM_LOG_FLAGS)
 else
 RUN_WITH_DBUS =
 TEST_PROGS_OPTIONS += -s /js/GDBus
@@ -35,7 +35,6 @@ TEST_PROGS_OPTIONS += -s /js/Gtk
 endif
 
 GTESTER = ${XVFB_START} ${TESTS_ENVIRONMENT} ${RUN_WITH_DBUS} gtester
-CLEANFILES += uninstalled-system-test-bus.conf uninstalled-test-bus.conf
 clean-local: test-user-data-clean
 
 test-user-data-clean:
@@ -108,6 +107,7 @@ CLEANFILES +=                                               \
        $(NULL)
 
 check-local: gjs-tests
+       $(MKDIR_P) test_user_data/logs
        @test -z "${TEST_PROGS}" || ${GTESTER} --verbose ${TEST_PROGS} ${TEST_PROGS_OPTIONS}
 
 # GJS_PATH is empty here since we want to force the use of our own
@@ -115,16 +115,14 @@ check-local: gjs-tests
 TESTS_ENVIRONMENT =                                                    \
        TOP_SRCDIR=$(abs_top_srcdir)                                    \
        TOP_BUILDDIR=$(abs_top_builddir)                                \
-       DBUS_SESSION_BUS_ADDRESS=''                                     \
        XDG_DATA_HOME=test_user_data                                    \
        GJS_DEBUG_OUTPUT=test_user_data/logs/gjs.log                    \
-       BUILDDIR=.                                                      \
        GJS_USE_UNINSTALLED_FILES=1                                     \
        GJS_TEST_TIMEOUT=420                                            \
        GJS_PATH= \
        LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(FIREFOX_JS_LIBDIR)"       \
        G_FILENAME_ENCODING=latin1      # ensure filenames are not utf8 \
-       DBUS_UUIDGEN="$(DBUS_UUIDGEN)"
+       $(NULL)
 
 simple_tests = test/testCommandLine.sh
 EXTRA_DIST += $(simple_tests)
diff --git a/configure.ac b/configure.ac
index b9e6c92..afcebe0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,9 +198,9 @@ AC_ARG_WITH([dbus-tests],
   [AS_HELP_STRING([--without-dbus-tests],
     [Don't try to use DBus during make check @<:@default=use@:>@])])
 AS_IF([test "x$with_dbus_tests" != "xno"], [
-  AC_PATH_PROG([DBUS_UUIDGEN], [dbus-uuidgen])
-  AS_IF([test -z "$DBUS_UUIDGEN"],
-    [AC_MSG_ERROR([dbus-uuidgen is required for --with-dbus-tests])])
+  AC_PATH_PROG([DBUS_RUN_SESSION], [dbus-run-session])
+  AS_IF([test -z "$DBUS_RUN_SESSION"],
+    [AC_MSG_ERROR([dbus-run-session is required for --with-dbus-tests])])
 ])
 AM_CONDITIONAL([DBUS_TESTS], [test "x$with_dbus_tests" != "xno"])
 
diff --git a/test/test-bus.conf b/test/test-bus.conf
index 96546b1..05cd743 100644
--- a/test/test-bus.conf
+++ b/test/test-bus.conf
@@ -6,6 +6,8 @@
   <!-- Our well-known bus type, don't change this -->
   <type>session</type>
 
+  <standard_session_servicedirs/>
+
   <listen>unix:tmpdir=/tmp</listen>
 
   <policy context="default">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]