summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-02-06 16:12:01 (GMT)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-19 17:10:25 (GMT)
commitf3fef7babc1003737455bb1984fcd09442ab53cc (patch)
treedb6e9988a87d37b8a37be8421c04bffa3e72d65d
parent0f68a60c8d6ef710b430cc72d61849e5f2f5860e (diff)
downloadtelepathy-mission-control-f3fef7babc1003737455bb1984fcd09442ab53cc.tar.gz
telepathy-mission-control-f3fef7babc1003737455bb1984fcd09442ab53cc.tar.xz
run-test.sh: output in TAP format, and install an installed-tests wrapper
See: https://wiki.gnome.org/action/show/Initiatives/GnomeGoals/InstalledTests https://en.wikipedia.org/wiki/Test_Anything_Protocol Bug: https://bugs.freedesktop.org/show_bug.cgi?id=74626 Reviewed-by: Guillaume Desmottes
-rw-r--r--tests/twisted/Makefile.am12
-rw-r--r--tests/twisted/run-test.sh.in35
2 files changed, 33 insertions, 14 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index 2a96647..7091bfa 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -123,6 +123,14 @@ TWISTED_OTHER_FILES = \
mc-twisted-tests.list:
$(AM_V_GEN)echo $(TWISTED_BASIC_TESTS) $(TWISTED_SEPARATE_TESTS) > $@
+twisted-tests.test: Makefile
+ $(AM_V_GEN)( echo '[Test]'; \
+ echo 'Exec=${twistedtestsdir}/run-test.sh'; \
+ echo 'Type=session'; \
+ echo 'Output=TAP' ) > $@.tmp
+ @chmod +x $@.tmp
+ @mv $@.tmp $@
+
run-test.sh: run-test.sh.in Makefile
$(AM_V_GEN)sed \
-e "s|[@]mctestsdir[@]|@mctestsdir@|g" \
@@ -131,6 +139,9 @@ run-test.sh: run-test.sh.in Makefile
@chmod +x $@
if ENABLE_INSTALLED_TESTS
+insttestdir = ${datadir}/installed-tests/telepathy-mission-control
+nodist_insttest_DATA = twisted-tests.test
+
# Install files in each directory. They could be tests, pristine data files,
# scripts or built source
twistedtestsdir = @mctestsdir@/twisted
@@ -162,6 +173,7 @@ config.py: Makefile
BUILT_SOURCES = \
config.py \
mc-twisted-tests.list \
+ twisted-tests.test \
run-test.sh \
$(NULL)
diff --git a/tests/twisted/run-test.sh.in b/tests/twisted/run-test.sh.in
index 3b6ef78..5f29132 100644
--- a/tests/twisted/run-test.sh.in
+++ b/tests/twisted/run-test.sh.in
@@ -19,7 +19,7 @@ export MC_TEST_CURDIR
if test "x$MC_TEST_UNINSTALLED" = x; then
script_fullname=`readlink -e "@mctestsdir@/twisted/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
@@ -35,11 +35,11 @@ if test "x$MC_TEST_UNINSTALLED" = x; then
export MC_TWISTED_PATH
else
if test -z "$MC_ABS_TOP_SRCDIR"; then
- echo "MC_ABS_TOP_SRCDIR must be set" >&2
+ echo "Bail out! MC_ABS_TOP_SRCDIR must be set"
exit 1
fi
if test -z "$MC_ABS_TOP_BUILDDIR"; then
- echo "MC_ABS_TOP_BUILDDIR must be set" >&2
+ echo "Bail out! MC_ABS_TOP_BUILDDIR must be set"
exit 1
fi
@@ -80,12 +80,19 @@ else
fi
n=0
-n_failed=0
for i in $list ; do
n=$(( $n + 1 ))
- echo "Testing $i ..."
+done
+
+echo "1..$n"
+
+i=0
+n_failed=0
+for t in $list ; do
+ i=$(( $i + 1 ))
+ echo "# Testing $i/$n: $t ..."
- tmp="${MC_TEST_CURDIR}/tmp-`echo $i | tr ./ __`"
+ tmp="${MC_TEST_CURDIR}/tmp-`echo $t | tr ./ __`"
rm -fr "$tmp"
mkdir "$tmp"
@@ -113,37 +120,37 @@ for i in $list ; do
--also-for-system \
--config-file="${config_file}" \
-- \
- @TEST_PYTHON@ -u "${test_src}/twisted/$i" \
+ @TEST_PYTHON@ -u "${test_src}/twisted/$t" \
> "$tmp"/test.log 2>&1 || e=$?
case "$e" in
(0)
- echo "PASS: $i"
+ echo "ok $i - $t"
if test -z "$MC_TEST_KEEP_TEMP"; then
rm -fr "$tmp"
fi
;;
(77)
- echo "SKIP: $i"
+ echo "ok $i # SKIP $t"
if test -z "$MC_TEST_KEEP_TEMP"; then
rm -fr "$tmp"
fi
;;
(*)
n_failed=$(( $n_failed + 1 ))
- echo "FAIL: $i ($e)"
+ echo "not ok $i - $t ($e)"
(
cd $tmp && for x in *.log; do
- echo "===== log file: $x ====="
- cat "$x"
+ echo "# ===== log file: $x ====="
+ sed 's/^/# /' "$x"
done
- echo "===== end of log files for $i ====="
+ echo "# ===== end of log files for $t ====="
)
;;
esac
done
if test $n_failed != 0; then
- echo "Tests run: $n; tests failed: $n_failed"
+ echo "# Tests run: $n; tests failed: $n_failed"
exit 1
else
exit 0