chiark / gitweb /
Test suite: Print better info on failures
[dgit.git] / tests / lib
index b4c1128c9a82f834b7490ff83e8750257fe56049..6b31c9d8635504862328ffbb750e677b4c4da42e 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}