chiark / gitweb /
Test suite: Print better info on failures
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 24 Jul 2016 18:40:06 +0000 (19:40 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 31 Jul 2016 20:50:00 +0000 (21:50 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
tests/lib

index b4c1128..6b31c9d 100644 (file)
--- a/tests/lib
+++ b/tests/lib
@@ -7,6 +7,20 @@ set -o pipefail
 . tests/lib-core
 . tests/lib-restricts
 
+t-report-failure () {
+       set +x
+       rc=$1
+       cat <<END >&2
+TEST FAILED
+funcs: ${FUNCNAME[*]}
+lines: ${BASH_LINENO[*]}
+files: ${BASH_SOURCE[*]}
+END
+       exit 16
+}
+
+trap 'test $? = 0 || t-report-failure' EXIT
+
 t-set-intree
 
 : ${DGIT_TEST_DEBUG=-D}