summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2011-08-24 10:59:41 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2011-09-21 11:25:48 +0100
commit5defa43b6f809f39ec79cc426414f2f6b1896065 (patch)
tree7f251bade1db7daa6e3cb55b48e2afddadd212dd
parent7fc9c026669976463adcd1e02ad19c582ed27289 (diff)
Check for Python; skip Python tests if not found
As with the optional test-dependencies on GLib and dbus-glib, we make this a hard dependency if --enable-tests[=yes], but not if --enable-tests=auto. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=37847 Reviewed-by: Will Thompson <will.thompson@collabora.co.uk>
-rw-r--r--configure.ac9
-rw-r--r--test/name-test/Makefile.am2
-rwxr-xr-xtest/name-test/run-test-systemserver.sh5
-rwxr-xr-xtest/name-test/run-test.sh4
4 files changed, 16 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index 864303fa..efe14f4d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -218,6 +218,15 @@ AC_ARG_ENABLE([installed-tests],
AM_CONDITIONAL([DBUS_ENABLE_INSTALLED_TESTS],
[test "x$enable_installed_tests" = xyes])
+if test "x$enable_tests" = xyes; then
+ # full test coverage is required, Python is a hard dependency
+ AC_MSG_NOTICE([Full test coverage (--enable-tests=yes) requires Python])
+ AM_PATH_PYTHON([2.6])
+else
+ # --enable-tests not given: do not abort if Python is missing
+ AM_PATH_PYTHON([2.6], [], [:])
+fi
+
if test x$enable_verbose_mode = xyes; then
AC_DEFINE(DBUS_ENABLE_VERBOSE_MODE,1,[Support a verbose mode])
fi
diff --git a/test/name-test/Makefile.am b/test/name-test/Makefile.am
index 5f11f0be..45c21d46 100644
--- a/test/name-test/Makefile.am
+++ b/test/name-test/Makefile.am
@@ -4,7 +4,7 @@ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_TEST_C
## 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@
+TESTS_ENVIRONMENT=DBUS_TOP_BUILDDIR=@abs_top_builddir@ DBUS_TOP_SRCDIR=@abs_top_srcdir@ PYTHON=@PYTHON@
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 d3b8d557..afd1f045 100755
--- a/test/name-test/run-test-systemserver.sh
+++ b/test/name-test/run-test-systemserver.sh
@@ -41,10 +41,11 @@ if ! grep -q 'DBus.Error' echo-error-output.tmp; then
fi
echo "running test echo signal"
-if ! python $DBUS_TOP_SRCDIR/test/name-test/test-wait-for-echo.py; then
+if test "x$PYTHON" = "x:"; then
+ echo "Skipped test-echo-signal: Python interpreter not found"
+elif ! $PYTHON $DBUS_TOP_SRCDIR/test/name-test/test-wait-for-echo.py; then
echo "Failed test-wait-for-echo"
exit 1
fi
-
exit 0
diff --git a/test/name-test/run-test.sh b/test/name-test/run-test.sh
index a70055bb..cad5937e 100755
--- a/test/name-test/run-test.sh
+++ b/test/name-test/run-test.sh
@@ -49,7 +49,9 @@ echo "running test-shutdown"
${DBUS_TOP_BUILDDIR}/libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/name-test/test-shutdown || die "test-shutdown failed"
echo "running test activation forking"
-if ! python $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then
+if test "x$PYTHON" = "x:"; then
+ echo "Skipped test-activation-forking: Python interpreter not found"
+elif ! $PYTHON $DBUS_TOP_SRCDIR/test/name-test/test-activation-forking.py; then
echo "Failed test-activation-forking"
exit 1
fi