[gjs] tests: Add option not to use DBus



commit 7b4e0195fba61deceb3d468e76b913f9bced9b1f
Author: Philip Chimento <philip chimento gmail com>
Date:   Sun Jan 24 14:37:12 2016 -0800

    tests: Add option not to use DBus
    
    This adds a --without-dbus-tests configure option, which allows you to
    skip the /js/GDBus test if you don't need DBus. The default is still to
    use DBus.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=761072

 Makefile-test.am |    8 ++++++++
 configure.ac     |   18 ++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/Makefile-test.am b/Makefile-test.am
index ac3efdb..523870c 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -2,6 +2,8 @@ EXTRA_DIST += \
        test/run-with-dbus \
        test/test-bus.conf
 
+TEST_PROGS_OPTIONS =
+
 XVFB = Xvfb -ac -noreset -screen 0 1024x768x16
 XIDS = 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 \
    491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 \
@@ -17,7 +19,13 @@ ${XVFB} -help 2>/dev/null 1>&2 \
     || { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \
     && DISPLAY=:$$XID && export DISPLAY
 
+if DBUS_TESTS
 RUN_WITH_DBUS = ${top_srcdir}/test/run-with-dbus --session --system
+else
+RUN_WITH_DBUS =
+TEST_PROGS_OPTIONS += -s /js/GDBus
+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
diff --git a/configure.ac b/configure.ac
index e3615c1..778da68 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,6 +223,21 @@ fi
 
 AC_SUBST(EXTRA_LINK_FLAGS)
 
+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([UUIDGEN], [uuidgen])
+  AS_IF([test -z "$UUIDGEN"],
+    [AC_MSG_ERROR([uuidgen is required for --with-dbus-tests])])
+  AC_MSG_CHECKING([whether $UUIDGEN supports the -r flag])
+  AS_IF([$UUIDGEN -r >/dev/null 2>&1], [
+    AC_MSG_RESULT([yes])
+    UUIDGEN="$UUIDGEN -r"
+  ], [AC_MSG_RESULT([no])])
+])
+AM_CONDITIONAL([DBUS_TESTS], [test "x$with_dbus_tests" != "xno"])
+
 gjsjsdir="\${datadir}/gjs-1.0"
 AC_SUBST([gjsjsdir])
 
@@ -232,6 +247,8 @@ AC_SUBST([pkglibexecdir], ["${libexecdir}/${PACKAGE}"])
 AC_CONFIG_FILES([Makefile gjs-1.0.pc gjs-internals-1.0.pc])
 AC_OUTPUT
 
+AM_COND_IF([DBUS_TESTS], [TEST_MSG="dbus"], [TEST_MSG="nothing special"])
+
 AC_MSG_RESULT([
         $PACKAGE_NAME $VERSION
 
@@ -243,4 +260,5 @@ AC_MSG_RESULT([
        readline:               ${have_readline}
        dtrace:                 ${ENABLE_DTRACE}
        systemtap:              ${ENABLE_SYSTEMTAP}
+       Run tests under:        ${TEST_MSG}
 ])


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