From 388f1833e9b0f74300e1f96b24684c98efb31afb Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 7 Aug 2013 17:03:53 +0100 Subject: [PATCH 3/6] Run regression tests under the run-test.sh "driver" Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65290 Signed-off-by: Simon McVittie --- tests/twisted/Makefile.am | 55 +++++++++++++++++++++++++++++++------------- tests/twisted/run-test.sh.in | 38 +++++++++++++++--------------- 2 files changed, 58 insertions(+), 35 deletions(-) diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index a9f19a0..0ce3f17 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -17,25 +17,22 @@ TWISTED_TESTS = \ voip/add-remove-content.py \ $(NULL) -TESTS = - -TESTS_ENVIRONMENT = \ - PYTHONPATH=@abs_top_srcdir@/tests/twisted::@abs_top_builddir@/tests/twisted - check-local: check-coding-style check-twisted CHECK_TWISTED_SLEEP=0 -check-twisted: +check-twisted: $(BUILT_SOURCES) $(MAKE) -C tools - rm -f tools/rakia-testing.log - sh $(srcdir)/tools/with-session-bus.sh \ - --config-file=tools/tmp-session-bus.conf \ - --sleep=$(CHECK_TWISTED_SLEEP) \ - -- $(MAKE) check-TESTS \ - TESTS="$(TWISTED_TESTS)" \ - TESTS_ENVIRONMENT="$(TESTS_ENVIRONMENT) $(PYTHON)" 2>&1 | \ - fgrep -v -e DeprecationWarning -e DigestAuthorizer + if test "x$(CHECK_TWISTED_SLEEP)" = x0; then \ + rakia_test_sleep= ; \ + else \ + rakia_test_sleep=--sleep=$(CHECK_TWISTED_SLEEP); \ + fi; \ + RAKIA_TEST_UNINSTALLED=1 \ + RAKIA_ABS_TOP_SRCDIR=@abs_top_srcdir@ \ + RAKIA_ABS_TOP_BUILDDIR=@abs_top_builddir@ \ + RAKIA_TEST_SLEEP=$$rakia_test_sleep \ + ./run-test.sh "$(TWISTED_TESTS)" if ENABLE_DEBUG DEBUGGING_PYBOOL = True @@ -49,7 +46,28 @@ config.py: Makefile echo "DEBUGGING = $(DEBUGGING_PYBOOL)"; \ } > $@ -BUILT_SOURCES = config.py +rakia-twisted-tests.list: Makefile + $(AM_V_GEN)echo $(TWISTED_TESTS) > $@ + +BUILT_SOURCES = \ + config.py \ + rakia-twisted-tests.list \ + run-test.sh \ + $(NULL) + +# We don't really use rakiatestsdir 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. +# +# Similarly, Gabble supports TEST_PYTHON differing from PYTHON for historical +# reasons, but we don't do that here. +run-test.sh: run-test.sh.in Makefile + $(AM_V_GEN)sed \ + -e 's![@]rakiatestsdir[@]!${pkglibexecdir}/tests!' \ + -e 's![@]TEST_PYTHON[@]!$(PYTHON)!' \ + < $< > $@.tmp && \ + chmod +x $@.tmp && \ + mv $@.tmp $@ EXTRA_DIST = \ $(TWISTED_TESTS) \ @@ -59,7 +77,12 @@ EXTRA_DIST = \ servicetest.py \ voip/voip_test.py -CLEANFILES = rakia-[1-9]*.log *.pyc */*.pyc config.py +CLEANFILES = \ + $(BUILT_SOURCES) \ + rakia-[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 8dd5fd6..f21a4dc 100644 --- a/tests/twisted/run-test.sh.in +++ b/tests/twisted/run-test.sh.in @@ -1,53 +1,53 @@ #!/bin/sh -if test "x$GABBLE_TEST_UNINSTALLED" = x; then - script_fullname=`readlink -e "@gabbletestsdir@/twisted/run-test.sh"` +if test "x$RAKIA_TEST_UNINSTALLED" = x; then + script_fullname=`readlink -e "@rakiatestsdir@/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="@rakiatestsdir@" + test_build="@rakiatestsdir@" + config_file="@rakiatestsdir@/twisted/tools/tmp-session-bus.conf" - PYTHONPATH="@gabbletestsdir@/twisted" + PYTHONPATH="@rakiatestsdir@/twisted" export PYTHONPATH - GABBLE_TWISTED_PATH="@gabbletestsdir@/twisted" - export GABBLE_TWISTED_PATH + RAKIA_TWISTED_PATH="@rakiatestsdir@/twisted" + export RAKIA_TWISTED_PATH else - if test -z "$GABBLE_ABS_TOP_SRCDIR"; then - echo "GABBLE_ABS_TOP_SRCDIR must be set" >&2 + if test -z "$RAKIA_ABS_TOP_SRCDIR"; then + echo "RAKIA_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 "$RAKIA_ABS_TOP_BUILDDIR"; then + echo "RAKIA_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="${RAKIA_ABS_TOP_SRCDIR}/tests" + test_build="${RAKIA_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 + RAKIA_TWISTED_PATH="${test_src}/twisted" + export RAKIA_TWISTED_PATH fi if [ -n "$1" ] ; then list="$1" else - list=$(cat "${test_build}"/twisted/gabble-twisted-tests.list) + list=$(cat "${test_build}"/twisted/rakia-twisted-tests.list) fi any_failed=0 for i in $list ; do echo "Testing $i ..." sh "${test_src}/twisted/tools/with-session-bus.sh" \ - ${GABBLE_TEST_SLEEP} \ + ${RAKIA_TEST_SLEEP} \ --config-file="${config_file}" \ -- \ @TEST_PYTHON@ -u "${test_src}/twisted/$i" -- 1.8.4.rc1