[Pkg-telepathy-commits] [telepathy-idle] 09/26: Run regression tests under the run-test.sh "driver"

Simon McVittie smcv at debian.org
Thu Apr 3 17:49:42 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-idle.

commit 2613f5c4ad4965845b28b44e974f4527c8736efa
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Thu Sep 12 10:49:10 2013 +0200

    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=69258
---
 tests/twisted/Makefile.am    | 65 ++++++++++++++++++++++++++++----------------
 tests/twisted/run-test.sh.in | 41 +++++++++++++++-------------
 2 files changed, 64 insertions(+), 42 deletions(-)

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 17fa541..966c708 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -34,35 +34,49 @@ TWISTED_TESTS = \
 		messages/room-config.py \
 		$(NULL)
 
-TESTS =
-
-TESTS_ENVIRONMENT = \
-	PYTHONPATH=@abs_top_srcdir@/tests/twisted:@abs_top_builddir@/tests/twisted \
-	IDLE_SSL_KEY=@abs_top_srcdir@/tests/twisted/tools/idletest.key \
-	IDLE_SSL_CERT=@abs_top_srcdir@/tests/twisted/tools/idletest.cert
+config.py: Makefile
+	$(AM_V_GEN) { \
+		echo "PACKAGE_STRING = \"$(PACKAGE_STRING)\""; \
+	} > $@
 
 if WANT_TWISTED_TESTS
 
 check-local: check-twisted
 
-check-twisted:
+CHECK_TWISTED_SLEEP=0
+
+check-twisted: $(BUILT_SOURCES)
 	$(MAKE) -C tools
-	rm -f tools/core
-	rm -f tools/idle-testing.log
-	failed=0; \
-	sh $(srcdir)/tools/with-session-bus.sh \
-		--config-file=tools/tmp-session-bus.conf \
-		-- $(MAKE) check-TESTS \
-		TESTS="$(TWISTED_TESTS)" \
-		TESTS_ENVIRONMENT="$(TESTS_ENVIRONMENT) $(TEST_PYTHON) -u" || \
-		failed=1; \
-	if test -e tools/core; then\
-		echo -e "\033[0;31;1mCore dump exists: tools/core\033[0m";\
-		exit 1;\
+	if test "x$(CHECK_TWISTED_SLEEP)" = x0; then \
+		idle_test_sleep= ; \
+	else \
+		idle_test_sleep=--sleep=$(CHECK_TWISTED_SLEEP); \
 	fi; \
-	if test $$failed = 1; then\
-		exit 1;\
-	fi;
+	IDLE_TEST_UNINSTALLED=1 \
+	  IDLE_ABS_TOP_SRCDIR=@abs_top_srcdir@ \
+	  IDLE_ABS_TOP_BUILDDIR=@abs_top_builddir@ \
+	  IDLE_TEST_SLEEP=$$idle_test_sleep \
+	  ./run-test.sh "$(TWISTED_TESTS)"
+
+idle-twisted-tests.list: Makefile
+	$(AM_V_GEN)echo $(TWISTED_TESTS) > $@
+
+BUILT_SOURCES = \
+	config.py \
+	idle-twisted-tests.list \
+	run-test.sh \
+	$(NULL)
+
+# We don't really use idletestsdir 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![@]idletestsdir[@]!${pkglibexecdir}/tests!' \
+			-e 's![@]TEST_PYTHON[@]!$(TEST_PYTHON)!' \
+			< $< > $@.tmp && \
+		chmod +x $@.tmp && \
+		mv $@.tmp $@
 
 endif
 
@@ -74,6 +88,11 @@ EXTRA_DIST = \
 	     constants.py \
 	     $(NULL)
 
-CLEANFILES = idle-[1-9]*.log *.pyc */*.pyc
+CLEANFILES = \
+	$(BUILT_SOURCES) \
+	idle-[1-9]*.log \
+	*.pyc \
+	*/*.pyc \
+	$(NULL)
 
 SUBDIRS = tools
diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in
index 8dd5fd6..215b455 100644
--- a/tests/twisted/run-test.sh.in
+++ b/tests/twisted/run-test.sh.in
@@ -1,53 +1,56 @@
 #!/bin/sh
 
-if test "x$GABBLE_TEST_UNINSTALLED" = x; then
-  script_fullname=`readlink -e "@gabbletestsdir@/twisted/run-test.sh"`
+if test "x$IDLE_TEST_UNINSTALLED" = x; then
+  script_fullname=`readlink -e "@idletestsdir@/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="@idletestsdir@"
+  test_build="@idletestsdir@"
+  config_file="@idletestsdir@/twisted/tools/servicedir/tmp-session-bus.conf"
 
-  PYTHONPATH="@gabbletestsdir@/twisted"
+  PYTHONPATH="@idletestsdir@/twisted"
   export PYTHONPATH
 
-  GABBLE_TWISTED_PATH="@gabbletestsdir@/twisted"
-  export GABBLE_TWISTED_PATH
+  IDLE_TWISTED_PATH="@idletestsdir@/twisted"
+  export IDLE_TWISTED_PATH
 else
-  if test -z "$GABBLE_ABS_TOP_SRCDIR"; then
-    echo "GABBLE_ABS_TOP_SRCDIR must be set" >&2
+  if test -z "$IDLE_ABS_TOP_SRCDIR"; then
+    echo "IDLE_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 "$IDLE_ABS_TOP_BUILDDIR"; then
+    echo "IDLE_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="${IDLE_ABS_TOP_SRCDIR}/tests"
+  test_build="${IDLE_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
+  IDLE_TWISTED_PATH="${test_src}/twisted"
+  export IDLE_TWISTED_PATH
 fi
 
+IDLE_SSL_KEY=${IDLE_ABS_TOP_SRCDIR}/tests/twisted/tools/idletest.key
+IDLE_SSL_CERT=${IDLE_ABS_TOP_SRCDIR}/tests/twisted/tools/idletest.cert
+
 if [ -n "$1" ] ; then
   list="$1"
 else
-  list=$(cat "${test_build}"/twisted/gabble-twisted-tests.list)
+  list=$(cat "${test_build}"/twisted/idle-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} \
+    ${IDLE_TEST_SLEEP} \
     --config-file="${config_file}" \
     -- \
     @TEST_PYTHON@ -u "${test_src}/twisted/$i"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-idle.git



More information about the Pkg-telepathy-commits mailing list