From 63c545136f2f4f4bae3bc978249ab7f1668c9273 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 3 Jun 2013 14:59:18 +0100 Subject: [PATCH] run-test.sh: keep a single Gabble and dbus-daemon during "make check" This cuts "make check" from 5:22 down to 4:58 on my X220. --- tests/twisted/Makefile.am | 1 + tests/twisted/run-test.sh.in | 41 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am index 37f7326..8c86d53 100644 --- a/tests/twisted/Makefile.am +++ b/tests/twisted/Makefile.am @@ -326,6 +326,7 @@ if WANT_TWISTED_TESTS GABBLE_TEST_SLEEP="--sleep=$$sleep" \ GABBLE_ABS_TOP_SRCDIR=@abs_top_srcdir@ \ GABBLE_ABS_TOP_BUILDDIR=@abs_top_builddir@ \ + GABBLE_TEST_SINGLE_INSTANCE=1 \ 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";\ diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in index 8dd5fd6..5cf1e02 100644 --- a/tests/twisted/run-test.sh.in +++ b/tests/twisted/run-test.sh.in @@ -43,14 +43,45 @@ else list=$(cat "${test_build}"/twisted/gabble-twisted-tests.list) fi +case "$GABBLE_TEST_SINGLE_INSTANCE" in + (inner) + # already re-executed under a temporary session bus + test -n "$DBUS_SESSION_BUS_ADDRESS" || exit 2 + ;; + (1) + # re-exec self under a temporary session bus + GABBLE_TEST_SINGLE_INSTANCE=inner + export GABBLE_TEST_SINGLE_INSTANCE + exec sh "${test_src}/twisted/tools/with-session-bus.sh" \ + ${GABBLE_TEST_SLEEP} \ + --config-file="${config_file}" \ + -- \ + ${test_build}/twisted/run-test.sh "$list" + echo "exec failed" >&2 + exit 1 + ;; + (*) + # empty or 0: we're going to run each test under its own session bus + ;; +esac + any_failed=0 for i in $list ; do echo "Testing $i ..." - sh "${test_src}/twisted/tools/with-session-bus.sh" \ - ${GABBLE_TEST_SLEEP} \ - --config-file="${config_file}" \ - -- \ - @TEST_PYTHON@ -u "${test_src}/twisted/$i" + + case "$GABBLE_TEST_SINGLE_INSTANCE" in + (inner) + @TEST_PYTHON@ -u "${test_src}/twisted/$i" + ;; + (*) + sh "${test_src}/twisted/tools/with-session-bus.sh" \ + ${GABBLE_TEST_SLEEP} \ + --config-file="${config_file}" \ + -- \ + @TEST_PYTHON@ -u "${test_src}/twisted/$i" + ;; + esac + e=$? case "$e" in (0) -- 1.7.10.4