chiark / gitweb /
Test suite: Print better info on failures
[dgit.git] / tests / lib
index c51c4a6146a50230fed33afc80a41f78e222a08c..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}
@@ -513,9 +527,9 @@ t-apply-diff () {
 }
 
 t-gbp-unapplied-pq2qc () {
-       # does `gbp pq export' (leaving us on BRANCH (eg "quilt-tip"))
+       # does `gbp pq export'
        # commits the resulting debian/patches on  qc/BRANCH
-       # goes back to patch-queue/BRANCH
+       # leaves us on qc/BRANCH (eg "qc/quilt-tip"))
        # qc/BRANCH is not fast-forwarding
 
        gbp pq export
@@ -531,7 +545,6 @@ t-gbp-unapplied-pq2qc () {
        git checkout qc/$branch
        git add debian/patches
        git commit -m 'Commit patch queue'
-       git checkout patch-queue/$branch
 }
 
 t-gbp-example-prep () {
@@ -553,6 +566,10 @@ t-gbp-example-prep () {
        t-gbp-unapplied-pq2qc
 
        t-commit 'some updates' 1.0-2
+
+       git merge -s ours \
+               -m 'Pseudo-merge to make descendant of archive' \
+               remotes/dgit/dgit/sid
 }
 
 t-commit () {