summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-10 15:19:02 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-11 15:36:40 +0200
commit6dd2177a31a0d111dd0025892d95cbdcd2a23c78 (patch)
treec192ec8b42ddf511eba56d6cbbbb5d6062f73810
parent7647a1a355e34f8eaa0d5ea20d2d7b20dac6e927 (diff)
Run regression tests under the run-test.sh "driver"
As well as making the tests pass under Automake 1.13, this lays the groundwork for OSTree-style "installed tests" later. https://bugs.freedesktop.org/show_bug.cgi?id=69216
-rw-r--r--tests/twisted/Makefile.am56
-rw-r--r--tests/twisted/run-test.sh.in43
2 files changed, 61 insertions, 38 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index a78a99ff..a434bbcf 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -61,11 +61,6 @@ TWISTED_AVAHI_TESTS = \
TWISTED_AVAHI_OLPC_TESTS = \
avahi/olpc-activity-announcements.py
-TESTS =
-
-TESTS_ENVIRONMENT = \
- PYTHONPATH=@abs_top_srcdir@/tests/twisted:@abs_top_builddir@/tests/twisted:$(PYTHONPATH)
-
if WANT_TWISTED_TESTS
TWISTED_TESTS += $(TWISTED_BASIC_TESTS)
endif
@@ -80,20 +75,20 @@ endif
check-local: check-coding-style check-twisted
-check-twisted:
+CHECK_TWISTED_SLEEP=0
+
+check-twisted: $(BUILT_SOURCES)
$(MAKE) -C tools
- rm -f tools/core
- rm -f tools/salut-testing.log
- if ! test -n "$$SALUT_TEST_REAL_AVAHI"; then \
- also_for_system="--also-for-system"; \
+ if test "x$(CHECK_TWISTED_SLEEP)" = x0; then \
+ salut_test_sleep= ; \
+ else \
+ salut_test_sleep=--sleep=$(CHECK_TWISTED_SLEEP); \
fi; \
- sh $(srcdir)/tools/with-session-bus.sh $$also_for_system --config-file=tools/tmp-session-bus.conf -- $(MAKE) check-TESTS \
- TESTS="$(TWISTED_TESTS)" \
- TESTS_ENVIRONMENT="$(TESTS_ENVIRONMENT) $(TEST_PYTHON)"
- @if test -e tools/core; then\
- echo "Core dump exists: tools/core";\
- exit 1;\
- fi
+ SALUT_TEST_UNINSTALLED=1 \
+ SALUT_ABS_TOP_SRCDIR=@abs_top_srcdir@ \
+ SALUT_ABS_TOP_BUILDDIR=@abs_top_builddir@ \
+ SALUT_TEST_SLEEP=$$salut_test_sleep \
+ ./run-test.sh "$(TWISTED_TESTS)"
if ENABLE_PLUGINS
PLUGINS_ENABLED_PYBOOL = True
@@ -107,7 +102,25 @@ config.py: Makefile
echo "PLUGINS_ENABLED = $(PLUGINS_ENABLED_PYBOOL)"; \
} > $@
-BUILT_SOURCES = config.py
+salut-twisted-tests.list: Makefile
+ $(AM_V_GEN)echo $(TWISTED_TESTS) > $@
+
+BUILT_SOURCES = \
+ config.py \
+ salut-twisted-tests.list \
+ run-test.sh \
+ $(NULL)
+
+# We don't really use saluttestsdir yet - we only support uninstalled testing
+# so far - but I'm substituting it to keep the script more similar to Gabble's.
+# ${pkglibexecdir}/tests is what GNOME's InstalledTests goal recommends.
+run-test.sh: run-test.sh.in Makefile
+ $(AM_V_GEN)sed \
+ -e 's![@]saluttestsdir[@]!${pkglibexecdir}/tests!' \
+ -e 's![@]TEST_PYTHON[@]!$(TEST_PYTHON)!' \
+ < $< > $@.tmp && \
+ chmod +x $@.tmp && \
+ mv $@.tmp $@
EXTRA_DIST = \
$(TWISTED_AVAHI_TESTS) \
@@ -127,7 +140,12 @@ EXTRA_DIST = \
xmppstream.py \
ipv6.py
-CLEANFILES = salut-[1-9]*.log *.pyc */*.pyc config.py
+CLEANFILES = \
+ $(BUILT_SOURCES) \
+ salut-[1-9]*.log \
+ *.pyc \
+ */*.pyc \
+ $(NULL)
check_misc_sources = $(TESTS)
diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in
index 8dd5fd66..d517ad78 100644
--- a/tests/twisted/run-test.sh.in
+++ b/tests/twisted/run-test.sh.in
@@ -1,54 +1,59 @@
#!/bin/sh
-if test "x$GABBLE_TEST_UNINSTALLED" = x; then
- script_fullname=`readlink -e "@gabbletestsdir@/twisted/run-test.sh"`
+if test "x$SALUT_TEST_UNINSTALLED" = x; then
+ script_fullname=`readlink -e "@saluttestsdir@/twisted/run-test.sh"`
if [ `readlink -e "$0"` != "$script_fullname" ] ; then
echo "This script is meant to be installed at $script_fullname" >&2
exit 1
fi
- test_src="@gabbletestsdir@"
- test_build="@gabbletestsdir@"
- config_file="@gabbletestsdir@/twisted/tools/servicedir/tmp-session-bus.conf"
+ test_src="@saluttestsdir@"
+ test_build="@saluttestsdir@"
+ config_file="@saluttestsdir@/twisted/tools/servicedir/tmp-session-bus.conf"
- PYTHONPATH="@gabbletestsdir@/twisted"
+ PYTHONPATH="@saluttestsdir@/twisted"
export PYTHONPATH
- GABBLE_TWISTED_PATH="@gabbletestsdir@/twisted"
- export GABBLE_TWISTED_PATH
+ SALUT_TWISTED_PATH="@saluttestsdir@/twisted"
+ export SALUT_TWISTED_PATH
else
- if test -z "$GABBLE_ABS_TOP_SRCDIR"; then
- echo "GABBLE_ABS_TOP_SRCDIR must be set" >&2
+ if test -z "$SALUT_ABS_TOP_SRCDIR"; then
+ echo "SALUT_ABS_TOP_SRCDIR must be set" >&2
exit 1
fi
- if test -z "$GABBLE_ABS_TOP_BUILDDIR"; then
- echo "GABBLE_ABS_TOP_BUILDDIR must be set" >&2
+ if test -z "$SALUT_ABS_TOP_BUILDDIR"; then
+ echo "SALUT_ABS_TOP_BUILDDIR must be set" >&2
exit 1
fi
- test_src="${GABBLE_ABS_TOP_SRCDIR}/tests"
- test_build="${GABBLE_ABS_TOP_BUILDDIR}/tests"
- config_file="${test_build}/twisted/tools/servicedir-uninstalled/tmp-session-bus.conf"
+ test_src="${SALUT_ABS_TOP_SRCDIR}/tests"
+ test_build="${SALUT_ABS_TOP_BUILDDIR}/tests"
+ config_file="${test_build}/twisted/tools/tmp-session-bus.conf"
PYTHONPATH="${test_src}/twisted:${test_build}/twisted"
export PYTHONPATH
- GABBLE_TWISTED_PATH="${test_src}/twisted"
- export GABBLE_TWISTED_PATH
+ SALUT_TWISTED_PATH="${test_src}/twisted"
+ export SALUT_TWISTED_PATH
fi
if [ -n "$1" ] ; then
list="$1"
else
- list=$(cat "${test_build}"/twisted/gabble-twisted-tests.list)
+ list=$(cat "${test_build}"/twisted/salut-twisted-tests.list)
+fi
+
+if [ -z "$SALUT_TEST_REAL_AVAHI" ]; then
+ also_for_system="--also-for-system";
fi
any_failed=0
for i in $list ; do
echo "Testing $i ..."
sh "${test_src}/twisted/tools/with-session-bus.sh" \
- ${GABBLE_TEST_SLEEP} \
+ ${SALUT_TEST_SLEEP} \
--config-file="${config_file}" \
+ ${also_for_system} \
-- \
@TEST_PYTHON@ -u "${test_src}/twisted/$i"
e=$?