diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-03-26 12:37:53 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2014-03-26 12:37:53 +0000 |
commit | e538c1a52ff09df267743d37f6fa9187bb36b349 (patch) | |
tree | f843e14d7ce68e2aceb649ffeda66361146b2563 | |
parent | a7de4b947411aeeedadbe0882a4329da3b4cb14e (diff) |
tests: work in terms of G_TEST_SRCDIR, G_TEST_BUILDDIR and ${twistedtestsdir}
GLib already has a convention that G_TEST_SRCDIR, G_TEST_BUILDDIR
are set to @abs_srcdir@, @abs_builddir@. Let's use it.
That makes it much simpler to use a substitution variable whose value
is .../tests/twisted rather than .../tests, so do that too. As a side
benefit, this removes a variable whose name is Gabble-specific.
-rw-r--r-- | tests/twisted/Makefile.am | 9 | ||||
-rw-r--r-- | tests/twisted/run-test.sh.in | 41 |
2 files changed, 26 insertions, 24 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index 8e9845cde..c1a0b4a40 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -241,10 +241,11 @@ TWISTED_OTHER_FILES = \ tubes/tubetestutil.py \ $(NULL) +twistedtestsdir = @gabbletestsdir@/twisted + if ENABLE_INSTALLED_TESTS # Install files in each directory. They could be tests, pristine data files, # scripts or built source -twistedtestsdir = @gabbletestsdir@/twisted nobase_nodist_twistedtests_SCRIPTS = \ run-test.sh \ tools/exec-with-log.sh \ @@ -284,8 +285,8 @@ if WANT_TWISTED_TESTS failed=0; \ GABBLE_TEST_UNINSTALLED=1 \ GABBLE_TEST_SLEEP="--sleep=$$sleep" \ - GABBLE_ABS_TOP_SRCDIR=@abs_top_srcdir@ \ - GABBLE_ABS_TOP_BUILDDIR=@abs_top_builddir@ \ + G_TEST_SRCDIR=@abs_srcdir@ \ + G_TEST_BUILDDIR=@abs_builddir@ \ sh run-test.sh "$(TWISTED_TESTS)" || failed=1; \ if test -e tools/core; then\ echo -e "\033[0;31;1mCore dump exists: tools/core\033[0m";\ @@ -387,7 +388,7 @@ gabble-twisted-tests.list: Makefile $(AM_V_GEN)echo $(TWISTED_TESTS) > $@ run-test.sh: run-test.sh.in Makefile - $(AM_V_GEN)sed -e "s|[@]gabbletestsdir[@]|@gabbletestsdir@|g" \ + $(AM_V_GEN)sed -e "s|[@]twistedtestsdir[@]|${twistedtestsdir}|g" \ -e "s|[@]PYTHON[@]|$(PYTHON)|g" \ -e "s|[@]TEST_PYTHON[@]|$(TEST_PYTHON)|g" \ $< > $@ diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in index 5392397a7..29d27aecb 100644 --- a/tests/twisted/run-test.sh.in +++ b/tests/twisted/run-test.sh.in @@ -1,58 +1,59 @@ #!/bin/sh if test "x$GABBLE_TEST_UNINSTALLED" = x; then - script_fullname=`readlink -e "@gabbletestsdir@/twisted/run-test.sh"` + script_fullname=`readlink -e "@twistedtestsdir@/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" + G_TEST_SRCDIR="@twistedtestsdir@" + export G_TEST_SRCDIR + G_TEST_BUILDDIR="@twistedtestsdir@" + export G_TEST_BUILDDIR - PYTHONPATH="@gabbletestsdir@/twisted:@gabbletestsdir@/twisted/jingle" + config_file="@twistedtestsdir@/tools/servicedir/tmp-session-bus.conf" + + PYTHONPATH="@twistedtestsdir@:@twistedtestsdir@/jingle" export PYTHONPATH - GABBLE_TWISTED_PATH="@gabbletestsdir@/twisted" + GABBLE_TWISTED_PATH="@twistedtestsdir@" export GABBLE_TWISTED_PATH else - if test -z "$GABBLE_ABS_TOP_SRCDIR"; then - echo "GABBLE_ABS_TOP_SRCDIR must be set" >&2 + if test -z "$G_TEST_SRCDIR"; then + echo "G_TEST_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 "$G_TEST_BUILDDIR"; then + echo "G_TEST_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" + config_file="${G_TEST_BUILDDIR}/tools/servicedir-uninstalled/tmp-session-bus.conf" - PYTHONPATH="${test_src}/twisted:${test_build}/twisted" - PYTHONPATH="$PYTHONPATH:${test_src}/twisted/jingle" - PYTHONPATH="$PYTHONPATH:${test_build}/twisted/jingle" + PYTHONPATH="${G_TEST_SRCDIR}:${G_TEST_BUILDDIR}" + PYTHONPATH="$PYTHONPATH:${G_TEST_SRCDIR}/jingle" + PYTHONPATH="$PYTHONPATH:${G_TEST_BUILDDIR}/jingle" export PYTHONPATH - GABBLE_TWISTED_PATH="${test_src}/twisted" + GABBLE_TWISTED_PATH="${G_TEST_SRCDIR}" export GABBLE_TWISTED_PATH fi if [ -n "$1" ] ; then list="$1" else - list=$(cat "${test_build}"/twisted/gabble-twisted-tests.list) + list=$(cat "${G_TEST_BUILDDIR}"/gabble-twisted-tests.list) fi any_failed=0 for i in $list ; do echo "Testing $i ..." - sh "${test_src}/twisted/tools/with-session-bus.sh" \ + sh "${G_TEST_SRCDIR}/tools/with-session-bus.sh" \ ${GABBLE_TEST_SLEEP} \ --config-file="${config_file}" \ -- \ - @TEST_PYTHON@ -u "${test_src}/twisted/$i" + @TEST_PYTHON@ -u "${G_TEST_SRCDIR}/$i" e=$? case "$e" in (0) |