[gjs] tests: Add option not to use Xvfb
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs] tests: Add option not to use Xvfb
- Date: Wed, 10 Feb 2016 04:28:02 +0000 (UTC)
commit 15ed6a6c30299566afa452b9f4d14c33d1216adb
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Jan 24 14:53:51 2016 -0800
tests: Add option not to use Xvfb
Normally the tests are run under Xvfb because of needing to call
gtk_init(); in a headless build environment this will fail if there is no
X server.
However, requiring Xvfb doesn't make sense if using GTK with other
backends than X. This adds a configure option to specify whether the
tests should or shouldn't be run under Xvfb. The default is not to use
Xvfb, which might mean you need to configure your headless build
environment to use --with-xvfb-tests.
https://bugzilla.gnome.org/show_bug.cgi?id=761072
Makefile-test.am | 12 ++++++++----
configure.ac | 15 ++++++++++++++-
2 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/Makefile-test.am b/Makefile-test.am
index 523870c..d65daad 100644
--- a/Makefile-test.am
+++ b/Makefile-test.am
@@ -4,7 +4,8 @@ EXTRA_DIST += \
TEST_PROGS_OPTIONS =
-XVFB = Xvfb -ac -noreset -screen 0 1024x768x16
+if XVFB_TESTS
+XVFB_INVOCATION = $(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 \
991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 \
@@ -12,12 +13,15 @@ XIDS = 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 \
9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 \
9995 9996 9997 9998 9999
XVFB_START = \
-${XVFB} -help 2>/dev/null 1>&2 \
+${XVFB_INVOCATION} -help 2>/dev/null 1>&2 \
&& XID=`for id in $(XIDS) ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \
&& { ${XVFB} :$$XID -nolisten tcp -auth /dev/null >/dev/null 2>&1 & \
trap "kill -15 $$! " 0 HUP INT QUIT TRAP USR1 PIPE TERM ; } \
|| { echo "Gtk+Tests:ERROR: Failed to start Xvfb environment for X11 target tests."; exit 1; } \
- && DISPLAY=:$$XID && export DISPLAY
+ && DISPLAY=:$$XID && export DISPLAY &&
+else
+XVFB_START =
+endif
if DBUS_TESTS
RUN_WITH_DBUS = ${top_srcdir}/test/run-with-dbus --session --system
@@ -26,7 +30,7 @@ RUN_WITH_DBUS =
TEST_PROGS_OPTIONS += -s /js/GDBus
endif
-GTESTER = ${XVFB_START} && ${TESTS_ENVIRONMENT} ${RUN_WITH_DBUS} gtester
+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 778da68..700bcf0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -223,6 +223,16 @@ fi
AC_SUBST(EXTRA_LINK_FLAGS)
+AC_ARG_WITH([xvfb-tests],
+ [AS_HELP_STRING([--with-xvfb-tests],
+ [Run all tests under an XVFB server @<:@default=no@:>@])])
+AS_IF([test "x$with_xvfb_tests" = "xyes"], [
+ AC_PATH_PROG([XVFB], [Xvfb])
+ AS_IF([test -z "$XVFB"],
+ [AC_MSG_ERROR([Xvfb is required for --with-xvfb-tests])])
+])
+AM_CONDITIONAL([XVFB_TESTS], [test "x$with_xvfb_tests" = "xyes"])
+
AC_ARG_WITH([dbus-tests],
[AS_HELP_STRING([--without-dbus-tests],
[Don't try to use DBus during make check @<:@default=use@:>@])])
@@ -247,7 +257,10 @@ 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"])
+TEST_MSG=
+AM_COND_IF([XVFB_TESTS], [TEST_MSG="xvfb "])
+AM_COND_IF([DBUS_TESTS], [TEST_MSG="${TEST_MSG}dbus"])
+AS_IF([test -z "$TEST_MSG"], [TEST_MSG="nothing special"])
AC_MSG_RESULT([
$PACKAGE_NAME $VERSION
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]