[next] telepathy-rakia: Adjust wrappers to be more like the ones in telepathy-idle-1
Simon McVittie
smcv at kemper.freedesktop.org
Wed May 7 03:36:32 PDT 2014
Module: telepathy-rakia
Branch: next
Commit: adbadc671eacd74138357f90d93f9d7b22cd8296
URL: http://cgit.freedesktop.org/telepathy/telepathy-rakia/commit/?id=adbadc671eacd74138357f90d93f9d7b22cd8296
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Wed May 7 11:20:51 2014 +0100
Adjust wrappers to be more like the ones in telepathy-idle-1
- output in TAP format
- output debug logs on error
---
tests/twisted/run-test.sh.in | 112 +++++++++++++++++++++++++++----
tests/twisted/tools/exec-with-log.sh.in | 37 +++++++---
2 files changed, 126 insertions(+), 23 deletions(-)
diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in
index b798d7a..e3a6426 100644
--- a/tests/twisted/run-test.sh.in
+++ b/tests/twisted/run-test.sh.in
@@ -1,9 +1,25 @@
#!/bin/sh
+# This script assumes that it is run in a temporary directory where it can
+# create and delete subdirectories for files, logs, etc., but other users
+# cannot write (for instance, /tmp is unsuitable, but
+# the directory created by `mktemp -d /tmp/test.XXXXXXXXXX` is fine).
+#
+# During "make check" or "make installcheck" it runs in
+# ${top_builddir}/tests/twisted.
+#
+# During installed testing, the test environment must run it in a
+# suitable location.
+
+set -e
+
+CHECK_TWISTED_CURDIR="`pwd`"
+export CHECK_TWISTED_CURDIR
+
if test "x$CHECK_TWISTED_UNINSTALLED" = x; then
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
+ echo "Bail out! This script is meant to be installed at $script_fullname"
exit 1
fi
@@ -16,11 +32,11 @@ if test "x$CHECK_TWISTED_UNINSTALLED" = x; then
export PYTHONPATH
else
if ! test -d "$G_TEST_SRCDIR"; then
- echo "G_TEST_SRCDIR must be set and absolute" >&2
+ echo "Bail out! G_TEST_SRCDIR must be set and absolute"
exit 1
fi
if ! test -d "$G_TEST_BUILDDIR"; then
- echo "G_TEST_BUILDDIR must be set and absolute" >&2
+ echo "Bail out! G_TEST_BUILDDIR must be set and absolute"
exit 1
fi
@@ -30,33 +46,103 @@ fi
config_file="${G_TEST_BUILDDIR}/tools/tmp-session-bus.conf"
+RAKIA_DEBUG=all
+export RAKIA_DEBUG
+
+TPORT_LOG=1
+export TPORT_LOG
+
+G_MESSAGES_DEBUG=all
+export G_MESSAGES_DEBUG
+
+XDG_CONFIG_DIRS="${G_TEST_SRCDIR}"
+export XDG_CONFIG_DIRS
+
if [ -n "$1" ] ; then
list="$1"
else
- list=$(cat "${G_TEST_BUILDDIR}/twisted-tests.list")
+ list=$(cat "${G_TEST_BUILDDIR}"/twisted-tests.list)
fi
-any_failed=0
+n=0
for i in $list ; do
- echo "Testing $i ..."
+ n=$(( $n + 1 ))
+done
+
+echo "1..$n"
+
+i=0
+n_failed=0
+for t in $list ; do
+ i=$(( $i + 1 ))
+ echo "# Testing $i/$n: $t ..."
+
+ tmp="${CHECK_TWISTED_CURDIR}/tmp-`echo $t | tr ./ __`"
+ rm -fr "$tmp"
+ mkdir "$tmp"
+
+ CHECK_TWISTED_LOG_DIR="${tmp}"
+ export CHECK_TWISTED_LOG_DIR
+ XDG_CONFIG_HOME="${tmp}/config"
+ export XDG_CONFIG_HOME
+ XDG_DATA_HOME="${tmp}/localshare"
+ export XDG_DATA_HOME
+ XDG_DATA_DIRS="${tmp}/share:${G_TEST_SRCDIR}:${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
+ export XDG_DATA_DIRS
+ XDG_CACHE_HOME="${tmp}/cache"
+ export XDG_CACHE_HOME
+ XDG_CACHE_DIR="${tmp}/cache"
+ export XDG_CACHE_DIR
+ IDLE_LOGFILE="${tmp}/cm.log"
+ export IDLE_LOGFILE
+
+ CHECK_TWISTED_VERBOSE=1
+ export CHECK_TWISTED_VERBOSE
+
+ e=0
sh "${G_TEST_SRCDIR}/tools/with-session-bus.sh" \
${CHECK_TWISTED_SLEEP} \
--config-file="${config_file}" \
-- \
- @TEST_PYTHON@ -u "${G_TEST_SRCDIR}/$i"
- e=$?
+ @TEST_PYTHON@ -u "${G_TEST_SRCDIR}/$t" \
+ > "$tmp"/test.log 2>&1 || e=$?
case "$e" in
(0)
- echo "PASS: $i"
+ echo "ok $i - $t"
+ if test -z "$CHECK_TWISTED_KEEP_TEMP"; then
+ rm -fr "$tmp"
+ fi
;;
(77)
- echo "SKIP: $i"
+ echo "ok $i # SKIP $t"
+ (
+ cd $tmp && for x in *.log; do
+ echo "# ===== log file: $x ====="
+ sed 's/^/# /' "$x"
+ done
+ echo "# ===== end of log files for $t ====="
+ )
+ if test -z "$CHECK_TWISTED_KEEP_TEMP"; then
+ rm -fr "$tmp"
+ fi
;;
(*)
- any_failed=1
- echo "FAIL: $i ($e)"
+ n_failed=$(( $n_failed + 1 ))
+ echo "not ok $i - $t ($e)"
+ (
+ cd $tmp && for x in *.log; do
+ echo "# ===== log file: $x ====="
+ sed 's/^/# /' "$x"
+ done
+ echo "# ===== end of log files for $t ====="
+ )
;;
esac
done
-exit $any_failed
+if test $n_failed != 0; then
+ echo "# Tests run: $n; tests failed: $n_failed"
+ exit 1
+else
+ exit 0
+fi
diff --git a/tests/twisted/tools/exec-with-log.sh.in b/tests/twisted/tools/exec-with-log.sh.in
index a0f34b9..4ffacac 100644
--- a/tests/twisted/tools/exec-with-log.sh.in
+++ b/tests/twisted/tools/exec-with-log.sh.in
@@ -2,20 +2,37 @@
cd "@abs_top_builddir@/tests/twisted/tools"
-export RAKIA_DEBUG=all
-export TPORT_LOG=1
+if test -z "$CHECK_TWISTED_LOG_DIR"; then
+ echo "CHECK_TWISTED_LOG_DIR must be set"
+ exit 1
+fi
+
+RAKIA_DEBUG=all
+export RAKIA_DEBUG
+TPORT_LOG=1
+export TPORT_LOG
G_MESSAGES_DEBUG=all
export G_MESSAGES_DEBUG
ulimit -c unlimited
-exec > rakia-testing.log 2>&1
+exec > "${CHECK_TWISTED_LOG_DIR}/rakia-testing.log" 2>&1
if test -n "$RAKIA_TEST_VALGRIND"; then
- export G_DEBUG=gc-friendly
- export G_SLICE=always-malloc
- RAKIA_WRAPPER="valgrind --leak-check=full"
-# RAKIA_WRAPPER="$RAKIA_WRAPPER --gen-suppressions=all"
- RAKIA_WRAPPER="$RAKIA_WRAPPER --suppressions=@abs_top_srcdir@/tests/suppressions/tp-glib.supp"
- RAKIA_WRAPPER="$RAKIA_WRAPPER --suppressions=@abs_top_srcdir@/tests/suppressions/rakia.supp"
+ export G_DEBUG=${G_DEBUG:+"${G_DEBUG},"}gc-friendly
+ export G_SLICE=always-malloc
+ RAKIA_WRAPPER="valgrind --leak-check=full --num-callers=20"
+ RAKIA_WRAPPER="$RAKIA_WRAPPER --show-reachable=yes"
+ RAKIA_WRAPPER="$RAKIA_WRAPPER --gen-suppressions=all"
+ RAKIA_WRAPPER="$RAKIA_WRAPPER --child-silent-after-fork=yes"
+ RAKIA_WRAPPER="$RAKIA_WRAPPER --suppressions=@abs_top_srcdir@/tests/suppressions/tp-glib.supp"
+ RAKIA_WRAPPER="$RAKIA_WRAPPER --suppressions=@abs_top_srcdir@/tests/suppressions/rakia.supp"
+elif test -n "$RAKIA_TEST_REFDBG"; then
+ if test -z "$REFDBG_OPTIONS" ; then
+ export REFDBG_OPTIONS="btnum=10"
+ fi
+ if test -z "$RAKIA_WRAPPER" ; then
+ RAKIA_WRAPPER="refdbg"
+ fi
fi
-exec $RAKIA_WRAPPER @abs_top_builddir@/src/telepathy-rakia-1
+export G_DEBUG=fatal-warnings" ${G_DEBUG}"
+exec @abs_top_builddir@/libtool --mode=execute $RAKIA_WRAPPER @abs_top_builddir@/src/telepathy-rakia-1
More information about the telepathy-commits
mailing list