aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTomi Ollila <tomi.ollila@iki.fi>2015-08-06 12:13:36 +0300
committerDavid Bremner <david@tethera.net>2015-08-07 21:56:39 +0200
commit02a2eeb427d6b424029f6e5e5ddad4c6ec987741 (patch)
treeabdc66ca743a1f21c70238e4c118a51d08c253f1 /test
parentaf3eba97fde00d6bc922df87732b3d28f717f120 (diff)
test: make script exit (1) if it "fails" to source (.) a file
The files (test) scripts source (with builtin command `.`) provides information which the scripts depend, and without the `source` to succeed allowing script to continue may lead to dangerous situations (e.g. rm -rf "${undefined_variable}"/*). At the end of all source (.) lines construct ' || exit 1' was added; In our case the script script will exit if it cannot find (or read) the file to be sourced. Additionally script would also exits if the last command of the sourced file exited nonzero.
Diffstat (limited to 'test')
-rw-r--r--test/README2
-rwxr-xr-xtest/T000-basic.sh2
-rwxr-xr-xtest/T010-help-test.sh2
-rwxr-xr-xtest/T020-compact.sh2
-rwxr-xr-xtest/T030-config.sh2
-rwxr-xr-xtest/T040-setup.sh2
-rwxr-xr-xtest/T050-new.sh2
-rwxr-xr-xtest/T060-count.sh2
-rwxr-xr-xtest/T070-insert.sh2
-rwxr-xr-xtest/T080-search.sh2
-rwxr-xr-xtest/T090-search-output.sh2
-rwxr-xr-xtest/T095-address.sh2
-rwxr-xr-xtest/T100-search-by-folder.sh2
-rwxr-xr-xtest/T110-search-position-overlap-bug.sh2
-rwxr-xr-xtest/T120-search-insufficient-from-quoting.sh2
-rwxr-xr-xtest/T130-search-limiting.sh2
-rwxr-xr-xtest/T140-excludes.sh2
-rwxr-xr-xtest/T150-tagging.sh2
-rwxr-xr-xtest/T160-json.sh2
-rwxr-xr-xtest/T170-sexp.sh2
-rwxr-xr-xtest/T180-text.sh2
-rwxr-xr-xtest/T190-multipart.sh2
-rwxr-xr-xtest/T200-thread-naming.sh2
-rwxr-xr-xtest/T205-author-naming.sh2
-rwxr-xr-xtest/T210-raw.sh2
-rwxr-xr-xtest/T220-reply.sh2
-rwxr-xr-xtest/T230-reply-to-sender.sh2
-rwxr-xr-xtest/T240-dump-restore.sh2
-rwxr-xr-xtest/T250-uuencode.sh2
-rwxr-xr-xtest/T260-thread-order.sh2
-rwxr-xr-xtest/T270-author-order.sh2
-rwxr-xr-xtest/T280-from-guessing.sh2
-rwxr-xr-xtest/T290-long-id.sh2
-rwxr-xr-xtest/T300-encoding.sh2
-rwxr-xr-xtest/T310-emacs.sh2
-rwxr-xr-xtest/T320-emacs-large-search-buffer.sh2
-rwxr-xr-xtest/T330-emacs-subject-to-filename.sh2
-rwxr-xr-xtest/T340-maildir-sync.sh2
-rwxr-xr-xtest/T350-crypto.sh2
-rwxr-xr-xtest/T360-symbol-hiding.sh2
-rwxr-xr-xtest/T370-search-folder-coherence.sh2
-rwxr-xr-xtest/T380-atomicity.sh2
-rwxr-xr-xtest/T390-python.sh2
-rwxr-xr-xtest/T395-ruby.sh2
-rwxr-xr-xtest/T400-hooks.sh2
-rwxr-xr-xtest/T410-argument-parsing.sh2
-rwxr-xr-xtest/T420-emacs-test-functions.sh2
-rwxr-xr-xtest/T430-emacs-address-cleaning.sh2
-rwxr-xr-xtest/T440-emacs-hello.sh2
-rwxr-xr-xtest/T450-emacs-show.sh2
-rwxr-xr-xtest/T455-emacs-charsets.sh2
-rwxr-xr-xtest/T460-emacs-tree.sh2
-rwxr-xr-xtest/T470-missing-headers.sh2
-rwxr-xr-xtest/T480-hex-escaping.sh2
-rwxr-xr-xtest/T490-parse-time-string.sh2
-rwxr-xr-xtest/T500-search-date.sh2
-rwxr-xr-xtest/T510-thread-replies.sh2
-rwxr-xr-xtest/T520-show.sh2
-rwxr-xr-xtest/T530-upgrade.sh2
-rwxr-xr-xtest/T550-db-features.sh2
-rwxr-xr-xtest/T560-lib-error.sh2
-rw-r--r--test/test-lib-common.sh2
-rw-r--r--test/test-lib.sh5
-rwxr-xr-xtest/test-verbose2
64 files changed, 66 insertions, 65 deletions
diff --git a/test/README b/test/README
index daf41600..ce403cef 100644
--- a/test/README
+++ b/test/README
@@ -138,7 +138,7 @@ Source 'test-lib.sh'
After assigning test_description, the test script should source
test-lib.sh like this:
- . ./test-lib.sh
+ . ./test-lib.sh || exit 1
This test harness library does the following things:
diff --git a/test/T000-basic.sh b/test/T000-basic.sh
index ef642457..d6811bd1 100755
--- a/test/T000-basic.sh
+++ b/test/T000-basic.sh
@@ -14,7 +14,7 @@ then
exit 1
fi
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
################################################################
# Test harness
diff --git a/test/T010-help-test.sh b/test/T010-help-test.sh
index d7266ffc..c1732376 100755
--- a/test/T010-help-test.sh
+++ b/test/T010-help-test.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="online help"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_expect_success 'notmuch --help' 'notmuch --help'
test_expect_success 'notmuch help' 'notmuch help'
diff --git a/test/T020-compact.sh b/test/T020-compact.sh
index 507f7698..8b4dbbc4 100755
--- a/test/T020-compact.sh
+++ b/test/T020-compact.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch compact"'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_message '[subject]=One'
add_message '[subject]=Two'
diff --git a/test/T030-config.sh b/test/T030-config.sh
index 7d14a85f..f404908a 100755
--- a/test/T030-config.sh
+++ b/test/T030-config.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='"notmuch config"'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Get string value"
test_expect_equal "$(notmuch config get user.name)" "Notmuch Test Suite"
diff --git a/test/T040-setup.sh b/test/T040-setup.sh
index 0e9f279a..cf0c00bc 100755
--- a/test/T040-setup.sh
+++ b/test/T040-setup.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='"notmuch setup"'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Notmuch new without a config suggests notmuch setup"
output=$(notmuch --config=new-notmuch-config new 2>&1)
diff --git a/test/T050-new.sh b/test/T050-new.sh
index ff1c3549..62573923 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch new" in several variations'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "No new messages"
output=$(NOTMUCH_NEW --debug)
diff --git a/test/T060-count.sh b/test/T060-count.sh
index da86c8cc..5ef3879f 100755
--- a/test/T060-count.sh
+++ b/test/T060-count.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch count" for messages and threads'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_email_corpus
diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 7e71c3b1..e7ec6a6c 100755
--- a/test/T070-insert.sh
+++ b/test/T070-insert.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch insert"'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_require_external_prereq gdb
diff --git a/test/T080-search.sh b/test/T080-search.sh
index 05027fb0..5e8b20ce 100755
--- a/test/T080-search.sh
+++ b/test/T080-search.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch search" in several variations'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_email_corpus
diff --git a/test/T090-search-output.sh b/test/T090-search-output.sh
index fe2ec9af..a28eaf20 100755
--- a/test/T090-search-output.sh
+++ b/test/T090-search-output.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='various settings for "notmuch search --output="'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_email_corpus
diff --git a/test/T095-address.sh b/test/T095-address.sh
index ed0cac78..8eecb2a6 100755
--- a/test/T095-address.sh
+++ b/test/T095-address.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch address" in several variants'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_email_corpus
diff --git a/test/T100-search-by-folder.sh b/test/T100-search-by-folder.sh
index 583bdf5e..2844ec61 100755
--- a/test/T100-search-by-folder.sh
+++ b/test/T100-search-by-folder.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch search" by folder: and path: (with variations)'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_message '[dir]=bad' '[subject]="To the bone"'
add_message '[dir]=.' '[subject]="Top level"'
diff --git a/test/T110-search-position-overlap-bug.sh b/test/T110-search-position-overlap-bug.sh
index 5da6ad6f..2a4238f9 100755
--- a/test/T110-search-position-overlap-bug.sh
+++ b/test/T110-search-position-overlap-bug.sh
@@ -18,7 +18,7 @@
# id:3wd4o8wa7fx.fsf@testarossa.amd.com
test_description='that notmuch does not overlap term positions'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_message '[to]="a@b.c, x@y.z"'
diff --git a/test/T120-search-insufficient-from-quoting.sh b/test/T120-search-insufficient-from-quoting.sh
index e83ea3d1..4862d826 100755
--- a/test/T120-search-insufficient-from-quoting.sh
+++ b/test/T120-search-insufficient-from-quoting.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='messages with unquoted . in name'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_message \
'[from]="Some.Name for Someone <bugs@quoting.com>"' \
diff --git a/test/T130-search-limiting.sh b/test/T130-search-limiting.sh
index 303762cf..c8986f4e 100755
--- a/test/T130-search-limiting.sh
+++ b/test/T130-search-limiting.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch search" --offset and --limit parameters'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_email_corpus
diff --git a/test/T140-excludes.sh b/test/T140-excludes.sh
index 8bbbc2dd..f91d4d7f 100755
--- a/test/T140-excludes.sh
+++ b/test/T140-excludes.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch search, count and show" with excludes in several variations'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
# Generates a thread consisting of a top level message and 'length'
# replies. The subject of the top message 'subject: top message"
diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
index 4a2673d4..821d3933 100755
--- a/test/T150-tagging.sh
+++ b/test/T150-tagging.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch tag"'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_message '[subject]=One'
add_message '[subject]=Two'
diff --git a/test/T160-json.sh b/test/T160-json.sh
index c1cf649d..b346f37e 100755
--- a/test/T160-json.sh
+++ b/test/T160-json.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="--format=json output"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Show message: json"
add_message "[subject]=\"json-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"json-show-message\""
diff --git a/test/T170-sexp.sh b/test/T170-sexp.sh
index 667e3195..800ebc63 100755
--- a/test/T170-sexp.sh
+++ b/test/T170-sexp.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="--format=sexp output"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Show message: sexp"
add_message "[subject]=\"sexp-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[bcc]=\"test_suite+bcc@notmuchmail.org\"" "[reply-to]=\"test_suite+replyto@notmuchmail.org\"" "[body]=\"sexp-show-message\""
diff --git a/test/T180-text.sh b/test/T180-text.sh
index b5ccefc9..3a265dbd 100755
--- a/test/T180-text.sh
+++ b/test/T180-text.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="--format=text output"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Show message: text"
add_message "[subject]=\"text-show-subject\"" "[date]=\"Sat, 01 Jan 2000 12:00:00 -0000\"" "[body]=\"text-show-message\""
diff --git a/test/T190-multipart.sh b/test/T190-multipart.sh
index ad8d29ea..7c4c9f71 100755
--- a/test/T190-multipart.sh
+++ b/test/T190-multipart.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="output of multipart message"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
cat <<EOF > embedded_message
From: Carl Worth <cworth@cworth.org>
diff --git a/test/T200-thread-naming.sh b/test/T200-thread-naming.sh
index dcfc1b36..132c1d77 100755
--- a/test/T200-thread-naming.sh
+++ b/test/T200-thread-naming.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="naming of threads with changing subject"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Initial thread name (oldest-first search)"
add_message '[subject]="thread-naming: Initial thread subject"' \
diff --git a/test/T205-author-naming.sh b/test/T205-author-naming.sh
index cb678ae8..69d8dc50 100755
--- a/test/T205-author-naming.sh
+++ b/test/T205-author-naming.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="naming of authors with unusual addresses"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Add author with empty quoted real name"
add_message '[subject]="author-naming: Initial thread subject"' \
diff --git a/test/T210-raw.sh b/test/T210-raw.sh
index daf5735c..dfea2d19 100755
--- a/test/T210-raw.sh
+++ b/test/T210-raw.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='notmuch show --format=raw'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_message
add_message
diff --git a/test/T220-reply.sh b/test/T220-reply.sh
index b0d854a1..30b78f67 100755
--- a/test/T220-reply.sh
+++ b/test/T220-reply.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="\"notmuch reply\" in several variations"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Basic reply"
add_message '[from]="Sender <sender@example.com>"' \
diff --git a/test/T230-reply-to-sender.sh b/test/T230-reply-to-sender.sh
index 30e5e385..608334dc 100755
--- a/test/T230-reply-to-sender.sh
+++ b/test/T230-reply-to-sender.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="\"notmuch reply --reply-to=sender\" in several variations"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Basic reply-to-sender"
add_message '[from]="Sender <sender@example.com>"' \
diff --git a/test/T240-dump-restore.sh b/test/T240-dump-restore.sh
index efe463ea..e6976ff8 100755
--- a/test/T240-dump-restore.sh
+++ b/test/T240-dump-restore.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="\"notmuch dump\" and \"notmuch restore\""
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_email_corpus
diff --git a/test/T250-uuencode.sh b/test/T250-uuencode.sh
index b3e1ac19..6f45d395 100755
--- a/test/T250-uuencode.sh
+++ b/test/T250-uuencode.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="handling of uuencoded data"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_message [subject]=uuencodetest '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
'[body]="This message is used to ensure that notmuch correctly handles a
diff --git a/test/T260-thread-order.sh b/test/T260-thread-order.sh
index 5239bd44..f720c998 100755
--- a/test/T260-thread-order.sh
+++ b/test/T260-thread-order.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="threading when messages received out of order"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
# Generate all single-root four message thread structures. We'll use
# this for multiple tests below.
diff --git a/test/T270-author-order.sh b/test/T270-author-order.sh
index 6ffeffc7..9124ece6 100755
--- a/test/T270-author-order.sh
+++ b/test/T270-author-order.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="author reordering;"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Adding parent message"
generate_message [body]=findme [id]=new-parent-id [subject]=author-reorder-threadtest '[from]="User <user@example.com>"' '[date]="Sat, 01 Jan 2000 12:00:00 -0000"'
diff --git a/test/T280-from-guessing.sh b/test/T280-from-guessing.sh
index 6dfaa40a..7c562fb9 100755
--- a/test/T280-from-guessing.sh
+++ b/test/T280-from-guessing.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="From line heuristics (with multiple configured addresses)"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Magic from guessing (nothing to go on)"
add_message '[from]="Sender <sender@example.com>"' \
diff --git a/test/T290-long-id.sh b/test/T290-long-id.sh
index 85e620fa..1fb7c037 100755
--- a/test/T290-long-id.sh
+++ b/test/T290-long-id.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="messages with ridiculously-long message IDs"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Referencing long ID before adding"
generate_message '[subject]="Reference of ridiculously-long message ID"' \
diff --git a/test/T300-encoding.sh b/test/T300-encoding.sh
index b6c86bf0..8d201c7e 100755
--- a/test/T300-encoding.sh
+++ b/test/T300-encoding.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="encoding issues"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Message with text of unknown charset"
add_message '[content-type]="text/plain; charset=unknown-8bit"' \
diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh
index d72799b4..61bc369a 100755
--- a/test/T310-emacs.sh
+++ b/test/T310-emacs.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs interface"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs.expected-output
diff --git a/test/T320-emacs-large-search-buffer.sh b/test/T320-emacs-large-search-buffer.sh
index 8b1251fe..3fd6958a 100755
--- a/test/T320-emacs-large-search-buffer.sh
+++ b/test/T320-emacs-large-search-buffer.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="Emacs with large search results buffer"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
x=xxxxxxxxxx # 10
x=$x$x$x$x$x$x$x$x$x$x # 100
diff --git a/test/T330-emacs-subject-to-filename.sh b/test/T330-emacs-subject-to-filename.sh
index 230c324d..517fa839 100755
--- a/test/T330-emacs-subject-to-filename.sh
+++ b/test/T330-emacs-subject-to-filename.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs: mail subject to filename"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
# emacs server can't be started in a child process with $(test_emacs ...)
test_emacs '(ignore)' > /dev/null
diff --git a/test/T340-maildir-sync.sh b/test/T340-maildir-sync.sh
index 3186e70f..efeaa3f6 100755
--- a/test/T340-maildir-sync.sh
+++ b/test/T340-maildir-sync.sh
@@ -2,7 +2,7 @@
test_description="maildir synchronization"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
# Create the expected maildir structure
mkdir $MAIL_DIR/cur
diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh
index 477b397e..3656cce9 100755
--- a/test/T350-crypto.sh
+++ b/test/T350-crypto.sh
@@ -5,7 +5,7 @@
# - verification of signatures from expired/revoked keys
test_description='PGP/MIME signature verification and decryption'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_gnupg_home ()
{
diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 98e4d4dc..4ec0ea65 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -9,7 +9,7 @@
test_description='exception symbol hiding'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest 'running test' run_test
mkdir -p ${PWD}/fakedb/.notmuch
diff --git a/test/T370-search-folder-coherence.sh b/test/T370-search-folder-coherence.sh
index 5e72a6cc..da4ec2b8 100755
--- a/test/T370-search-folder-coherence.sh
+++ b/test/T370-search-folder-coherence.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='folder tags removed and added through file renames remain consistent'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "No new messages"
output=$(NOTMUCH_NEW)
diff --git a/test/T380-atomicity.sh b/test/T380-atomicity.sh
index ee1e2f43..845dfde7 100755
--- a/test/T380-atomicity.sh
+++ b/test/T380-atomicity.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='atomicity'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
# This script tests the effects of killing and restarting "notmuch
# new" at arbitrary points. If notmuch new is properly atomic, the
diff --git a/test/T390-python.sh b/test/T390-python.sh
index c3f24f79..4726bc36 100755
--- a/test/T390-python.sh
+++ b/test/T390-python.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="python bindings"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_require_external_prereq ${NOTMUCH_PYTHON}
diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
index 8b8e6d24..d5cade8f 100755
--- a/test/T395-ruby.sh
+++ b/test/T395-ruby.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="ruby bindings"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
test_subtest_missing_external_prereq_["ruby development files"]=t
diff --git a/test/T400-hooks.sh b/test/T400-hooks.sh
index 1adab2f0..ed119131 100755
--- a/test/T400-hooks.sh
+++ b/test/T400-hooks.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='hooks'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
HOOK_DIR=${MAIL_DIR}/.notmuch/hooks
diff --git a/test/T410-argument-parsing.sh b/test/T410-argument-parsing.sh
index 2e5d7ae3..f8ff8ff9 100755
--- a/test/T410-argument-parsing.sh
+++ b/test/T410-argument-parsing.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="argument parsing"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "sanity check"
$TEST_DIRECTORY/arg-test pos1 --keyword=one --string=foo pos2 --int=7 --flag=one --flag=three > OUTPUT
diff --git a/test/T420-emacs-test-functions.sh b/test/T420-emacs-test-functions.sh
index ca4a7988..955c5f7f 100755
--- a/test/T420-emacs-test-functions.sh
+++ b/test/T420-emacs-test-functions.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs test function sanity"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "emacs test function sanity"
test_emacs_expect_t 't'
diff --git a/test/T430-emacs-address-cleaning.sh b/test/T430-emacs-address-cleaning.sh
index 04723467..664b79d2 100755
--- a/test/T430-emacs-address-cleaning.sh
+++ b/test/T430-emacs-address-cleaning.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs address cleaning"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "notmuch-test-address-clean part 1"
test_emacs_expect_t '(notmuch-test-address-cleaning-1)'
diff --git a/test/T440-emacs-hello.sh b/test/T440-emacs-hello.sh
index f7296166..a8ed2282 100755
--- a/test/T440-emacs-hello.sh
+++ b/test/T440-emacs-hello.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs notmuch-hello view"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs.expected-output
diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh
index bfcd5efe..0342a874 100755
--- a/test/T450-emacs-show.sh
+++ b/test/T450-emacs-show.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs notmuch-show view"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
diff --git a/test/T455-emacs-charsets.sh b/test/T455-emacs-charsets.sh
index 3078f9c9..7624fa4d 100755
--- a/test/T455-emacs-charsets.sh
+++ b/test/T455-emacs-charsets.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs notmuch-show charset handling"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
UTF8_YEN=$'\xef\xbf\xa5'
diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh
index 8e9f37cb..b6181b51 100755
--- a/test/T460-emacs-tree.sh
+++ b/test/T460-emacs-tree.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs tree view interface"
-. test-lib.sh
+. ./test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/tree.expected-output
diff --git a/test/T470-missing-headers.sh b/test/T470-missing-headers.sh
index cb38301c..e256c10a 100755
--- a/test/T470-missing-headers.sh
+++ b/test/T470-missing-headers.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='messages with missing headers'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
# Notmuch requires at least one of from, subject, or to or it will
# ignore the file. Generate two messages so that together they cover
diff --git a/test/T480-hex-escaping.sh b/test/T480-hex-escaping.sh
index ad50e1bc..10527b18 100755
--- a/test/T480-hex-escaping.sh
+++ b/test/T480-hex-escaping.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="hex encoding and decoding"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "round trip"
find $TEST_DIRECTORY/corpus -type f -print | sort | xargs cat > EXPECTED
diff --git a/test/T490-parse-time-string.sh b/test/T490-parse-time-string.sh
index 6aa9d433..ab90fcc5 100755
--- a/test/T490-parse-time-string.sh
+++ b/test/T490-parse-time-string.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="date/time parser module"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
# Sanity/smoke tests for the date/time parser independent of notmuch
diff --git a/test/T500-search-date.sh b/test/T500-search-date.sh
index 70bcf344..b28496b7 100755
--- a/test/T500-search-date.sh
+++ b/test/T500-search-date.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="date:since..until queries"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_email_corpus
diff --git a/test/T510-thread-replies.sh b/test/T510-thread-replies.sh
index 1392fbed..5ab066ac 100755
--- a/test/T510-thread-replies.sh
+++ b/test/T510-thread-replies.sh
@@ -9,7 +9,7 @@ test_description='test of proper handling of in-reply-to and references headers'
# database is constructed properly, even in the presence of
# non-RFC-compliant headers'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "Use References when In-Reply-To is broken"
add_message '[id]="foo@one.com"' \
diff --git a/test/T520-show.sh b/test/T520-show.sh
index 0657c993..fb232a32 100755
--- a/test/T520-show.sh
+++ b/test/T520-show.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='"notmuch show"'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
add_email_corpus
diff --git a/test/T530-upgrade.sh b/test/T530-upgrade.sh
index 6b42a690..7faf03d3 100755
--- a/test/T530-upgrade.sh
+++ b/test/T530-upgrade.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="database upgrade"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
dbtarball=database-v1.tar.xz
diff --git a/test/T550-db-features.sh b/test/T550-db-features.sh
index 5569768c..f94a660d 100755
--- a/test/T550-db-features.sh
+++ b/test/T550-db-features.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="database version and feature compatibility"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_begin_subtest "future database versions abort open"
${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 9999 ""
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index b1e77aa0..1ef4ff23 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="error reporting for library"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
backup_database () {
rm -rf notmuch-dir-backup
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index f99ed111..b1fc33d4 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -40,7 +40,7 @@ TEST_DIRECTORY=$(pwd)
notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
# configure output
-. $notmuch_path/sh.config
+. $notmuch_path/sh.config || exit 1
if test -n "$valgrind"
then
diff --git a/test/test-lib.sh b/test/test-lib.sh
index eeb5487b..0bf7163e 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -96,7 +96,8 @@ _x32="$_x04$_x04$_x04$_x04$_x04$_x04$_x04$_x04"
# test_description='Description of this test...
# This test checks if command xyzzy does the right thing...
# '
-# . ./test-lib.sh
+# . ./test-lib.sh || exit 1
+
[ "x$ORIGINAL_TERM" != "xdumb" ] && (
TERM=$ORIGINAL_TERM &&
export TERM &&
@@ -1223,7 +1224,7 @@ test_init_ () {
}
-. ./test-lib-common.sh
+. ./test-lib-common.sh || exit 1
emacs_generate_script
diff --git a/test/test-verbose b/test/test-verbose
index 4100c051..1723ce66 100755
--- a/test/test-verbose
+++ b/test/test-verbose
@@ -2,7 +2,7 @@
test_description='the verbosity options of the test framework itself.'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
test_expect_success 'print something in test_expect_success and pass' '
echo "hello stdout" &&