unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: notmuch@notmuchmail.org
Subject: [PATCH 3/5] test: Break on test script (or other) error
Date: Sun, 14 Nov 2010 22:54:30 +0100	[thread overview]
Message-ID: <1289771672-9204-3-git-send-email-sojkam1@fel.cvut.cz> (raw)
In-Reply-To: <87hbfjr2sr.fsf@steelpick.2x.cz>

Break notmuch-test whenever a test script returns non-zero status.
This happens either when some test from the script fails or when there
is an error in the script.

This is especially useful in the latter case since the error may not
appear in the final aggregated results.
---
 test/notmuch-test |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/test/notmuch-test b/test/notmuch-test
index b51045a..055467f 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -14,12 +14,20 @@ if [ ${BASH_VERSINFO[0]} -lt 4 ]; then
     exit 1
 fi
 
+set -e
+
+die () {
+    echo >&2 "Unexpected failure"
+}
+
+trap 'die' 0
+
 cd $(dirname "$0")
 
 TESTS="basic new search json thread-naming raw reply dump-restore uuencode thread-order author-order from-guessing long-id encoding emacs maildir-sync"
 
 # Clean up any results from a previous run
-rm -r test-results >/dev/null 2>/dev/null
+rm -rf test-results >/dev/null 2>/dev/null
 
 # Run the tests
 for test in $TESTS; do
@@ -31,3 +39,5 @@ done
 
 # Clean up
 rm -r test-results corpus.mail
+
+trap '' 0
-- 
1.7.2.3

  parent reply	other threads:[~2010-11-14 21:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09 23:40 [PATCH] test: Better handling of stdout and stderr Michal Sojka
2010-11-10 21:15 ` Carl Worth
2010-11-11  0:25   ` Carl Worth
2010-11-11 15:57     ` Michal Sojka
2010-11-14 21:52     ` Michal Sojka
2010-11-14 21:54       ` [PATCH 1/5] " Michal Sojka
2010-11-14 21:54       ` [PATCH 2/5] test: Add trailing newline to error messages Michal Sojka
2010-11-14 21:54       ` Michal Sojka [this message]
2010-12-07 23:33         ` [PATCH 3/5] test: Break on test script (or other) error Carl Worth
2010-12-08 14:28           ` Michal Sojka
2010-11-14 21:54       ` [PATCH 4/5] test: Detect unfinished subsets Michal Sojka
2010-11-14 21:54       ` [PATCH 5/5] test: Fix bugs detected thanks to the previous commit Michal Sojka
2010-11-16 19:32       ` [PATCH] test: Better handling of stdout and stderr Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1289771672-9204-3-git-send-email-sojkam1@fel.cvut.cz \
    --to=sojkam1@fel.cvut.cz \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).