diff options
| author | Tomi Ollila <tomi.ollila@iki.fi> | 2016-05-28 15:39:29 +0300 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2016-06-11 13:03:09 -0300 |
| commit | d53b417d1f5935a924b0f0127e64750c8448ac3a (patch) | |
| tree | 06e0051336955ff8007bff81e6688b09e3fa82f1 /test | |
| parent | 1ca752fa362e7c245d88b6cc742d178824f2a50c (diff) | |
test: add function die () and have use of it in add_email_corpus ()
Added die() function to test-lib.sh with the following first use of it:
If notmuch new fails during email corpus addition the database is
most probably inexistent or broken and the added corpus would be
unusable while running single tests, giving misleading failures
("only" full 'make test' cleans out old corpus).
Diffstat (limited to 'test')
| -rw-r--r-- | test/test-lib.sh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/test-lib.sh b/test/test-lib.sh index 05e203d7..4a8ef1f4 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -251,6 +251,16 @@ trap_signal () { exit $code } +die () { + _exit_common + exec >&6 + say_color error '%-6s' FATAL + echo " $*" + echo + echo "Unexpected exit while executing $0." + exit 1 +} + GIT_EXIT_OK= # Note: TEST_TMPDIR *NOT* exported! TEST_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/notmuch-test-$$.XXXXXX") @@ -544,7 +554,7 @@ add_email_corpus () cp -a $TEST_DIRECTORY/corpus.mail ${MAIL_DIR} else cp -a $TEST_DIRECTORY/corpus ${MAIL_DIR} - notmuch new >/dev/null + notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus" cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpus.mail fi } |
