telepathy-gabble: Adapt run-test.sh to be able to run the tests uninstalled
Simon McVittie
smcv at kemper.freedesktop.org
Tue Jun 11 03:32:08 PDT 2013
Module: telepathy-gabble
Branch: master
Commit: fcc3900f4e6f6c9a58d95d15af8175b5d04fdaf4
URL: http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=fcc3900f4e6f6c9a58d95d15af8175b5d04fdaf4
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Mon Jun 3 09:14:54 2013 +0100
Adapt run-test.sh to be able to run the tests uninstalled
When autoreconfiscated with Automake 1.13, the way in which we were
(ab?)using Automake's test driver no longer works. We can't just
switch back to the old serial test driver without a dependency on
at least Automake 1.12, either. However, run-test.sh (which was already
used for installed tests) is quite capable of running uninstalled
tests, with a bit of adjustment:
* if GABBLE_TEST_UNINSTALLED is set, expect GABBLE_ABS_TOP_SRCDIR,
GABBLE_ABS_TOP_BUILDDIR and optionally GABBLE_TEST_SLEEP in the
environment
* look for installed or uninstalled files, as appropriate
* use TEST_PYTHON (which might differ from PYTHON)
* use python -u (unbuffered stdout) for better debugging
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65290
Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>
---
tests/twisted/Makefile.am | 1 +
tests/twisted/run-test.sh.in | 52 +++++++++++++++++++++++++++++++----------
2 files changed, 40 insertions(+), 13 deletions(-)
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index fdc6d61..e8ffeb1 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -451,6 +451,7 @@ gabble-twisted-tests.list:
run-test.sh: run-test.sh.in Makefile
$(AM_V_GEN)sed -e "s|[@]gabbletestsdir[@]|@gabbletestsdir@|g" \
-e "s|[@]PYTHON[@]|$(PYTHON)|g" \
+ -e "s|[@]TEST_PYTHON[@]|$(TEST_PYTHON)|g" \
$< > $@
@chmod +x $@
diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in
index e663855..e0b146c 100644
--- a/tests/twisted/run-test.sh.in
+++ b/tests/twisted/run-test.sh.in
@@ -1,30 +1,56 @@
#!/bin/sh
-script_fullname=`readlink -e "@gabbletestsdir@/twisted/run-test.sh"`
-if [ `readlink -e "$0"` != "$script_fullname" ] ; then
- echo "This script is meant to be installed at $script_fullname"
- exit 1
-fi
+if test "x$GABBLE_TEST_UNINSTALLED" = x; then
+ script_fullname=`readlink -e "@gabbletestsdir@/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"
-PYTHONPATH=@gabbletestsdir@/twisted
-export PYTHONPATH
+ PYTHONPATH="@gabbletestsdir@/twisted"
+ export PYTHONPATH
+
+ GABBLE_TWISTED_PATH="@gabbletestsdir@/twisted"
+ export GABBLE_TWISTED_PATH
+else
+ if test -z "$GABBLE_ABS_TOP_SRCDIR"; then
+ echo "GABBLE_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
+ exit 1
+ fi
-GABBLE_TWISTED_PATH=@gabbletestsdir@/twisted
-export GABBLE_TWISTED_PATH
+ 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"
+
+ PYTHONPATH="${test_src}/twisted:${test_build}/twisted"
+ export PYTHONPATH
+
+ GABBLE_TWISTED_PATH="${test_src}/twisted"
+ export GABBLE_TWISTED_PATH
+fi
if [ -n "$1" ] ; then
list="$1"
else
- list=$(cat @gabbletestsdir@/twisted/gabble-twisted-tests.list)
+ list=$(cat "${test_build}"/twisted/gabble-twisted-tests.list)
fi
any_failed=0
for i in $list ; do
echo "Testing $i ..."
- sh @gabbletestsdir@/twisted/tools/with-session-bus.sh \
- --config-file=@gabbletestsdir@/twisted/tools/servicedir/tmp-session-bus.conf \
+ sh "${test_src}/twisted/tools/with-session-bus.sh" \
+ ${GABBLE_TEST_SLEEP} \
+ --config-file="${config_file}" \
-- \
- @PYTHON@ @gabbletestsdir@/twisted/$i
+ @TEST_PYTHON@ -u "${test_src}/twisted/$i"
e=$?
case "$e" in
(0)
More information about the telepathy-commits
mailing list