From 02a2eeb427d6b424029f6e5e5ddad4c6ec987741 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Thu, 6 Aug 2015 12:13:36 +0300 Subject: [PATCH] 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. --- devel/gen-testdb.sh | 2 +- performance-test/M00-new.sh | 2 +- performance-test/M01-dump-restore.sh | 2 +- performance-test/T00-new.sh | 2 +- performance-test/T01-dump-restore.sh | 2 +- performance-test/T02-tag.sh | 2 +- performance-test/perf-test-lib.sh | 4 ++-- test/README | 2 +- test/T000-basic.sh | 2 +- test/T010-help-test.sh | 2 +- test/T020-compact.sh | 2 +- test/T030-config.sh | 2 +- test/T040-setup.sh | 2 +- test/T050-new.sh | 2 +- test/T060-count.sh | 2 +- test/T070-insert.sh | 2 +- test/T080-search.sh | 2 +- test/T090-search-output.sh | 2 +- test/T095-address.sh | 2 +- test/T100-search-by-folder.sh | 2 +- test/T110-search-position-overlap-bug.sh | 2 +- test/T120-search-insufficient-from-quoting.sh | 2 +- test/T130-search-limiting.sh | 2 +- test/T140-excludes.sh | 2 +- test/T150-tagging.sh | 2 +- test/T160-json.sh | 2 +- test/T170-sexp.sh | 2 +- test/T180-text.sh | 2 +- test/T190-multipart.sh | 2 +- test/T200-thread-naming.sh | 2 +- test/T205-author-naming.sh | 2 +- test/T210-raw.sh | 2 +- test/T220-reply.sh | 2 +- test/T230-reply-to-sender.sh | 2 +- test/T240-dump-restore.sh | 2 +- test/T250-uuencode.sh | 2 +- test/T260-thread-order.sh | 2 +- test/T270-author-order.sh | 2 +- test/T280-from-guessing.sh | 2 +- test/T290-long-id.sh | 2 +- test/T300-encoding.sh | 2 +- test/T310-emacs.sh | 2 +- test/T320-emacs-large-search-buffer.sh | 2 +- test/T330-emacs-subject-to-filename.sh | 2 +- test/T340-maildir-sync.sh | 2 +- test/T350-crypto.sh | 2 +- test/T360-symbol-hiding.sh | 2 +- test/T370-search-folder-coherence.sh | 2 +- test/T380-atomicity.sh | 2 +- test/T390-python.sh | 2 +- test/T395-ruby.sh | 2 +- test/T400-hooks.sh | 2 +- test/T410-argument-parsing.sh | 2 +- test/T420-emacs-test-functions.sh | 2 +- test/T430-emacs-address-cleaning.sh | 2 +- test/T440-emacs-hello.sh | 2 +- test/T450-emacs-show.sh | 2 +- test/T455-emacs-charsets.sh | 2 +- test/T460-emacs-tree.sh | 2 +- test/T470-missing-headers.sh | 2 +- test/T480-hex-escaping.sh | 2 +- test/T490-parse-time-string.sh | 2 +- test/T500-search-date.sh | 2 +- test/T510-thread-replies.sh | 2 +- test/T520-show.sh | 2 +- test/T530-upgrade.sh | 2 +- test/T550-db-features.sh | 2 +- test/T560-lib-error.sh | 2 +- test/test-lib-common.sh | 2 +- test/test-lib.sh | 5 +++-- test/test-verbose | 2 +- 71 files changed, 74 insertions(+), 73 deletions(-) diff --git a/devel/gen-testdb.sh b/devel/gen-testdb.sh index 621b31e6..61ae48a3 100755 --- a/devel/gen-testdb.sh +++ b/devel/gen-testdb.sh @@ -79,7 +79,7 @@ while getopts v:c:s: opt; do done shift `expr $OPTIND - 1` -. ./test-lib.sh +. ./test-lib.sh || exit 1 SHORT_CORPUS=$(basename ${CORPUS:-database}) DBNAME=${SHORT_CORPUS}${SUFFIX} diff --git a/performance-test/M00-new.sh b/performance-test/M00-new.sh index 99c3f520..a040a97e 100755 --- a/performance-test/M00-new.sh +++ b/performance-test/M00-new.sh @@ -2,7 +2,7 @@ test_description='notmuch new' -. ./perf-test-lib.sh +. ./perf-test-lib.sh || exit 1 # ensure initial 'notmuch new' is run by memory_start uncache_database diff --git a/performance-test/M01-dump-restore.sh b/performance-test/M01-dump-restore.sh index be5894a6..8fea9824 100755 --- a/performance-test/M01-dump-restore.sh +++ b/performance-test/M01-dump-restore.sh @@ -2,7 +2,7 @@ test_description='dump and restore' -. ./perf-test-lib.sh +. ./perf-test-lib.sh || exit 1 memory_start diff --git a/performance-test/T00-new.sh b/performance-test/T00-new.sh index 553bb8b6..b9f21158 100755 --- a/performance-test/T00-new.sh +++ b/performance-test/T00-new.sh @@ -2,7 +2,7 @@ test_description='notmuch new' -. ./perf-test-lib.sh +. ./perf-test-lib.sh || exit 1 uncache_database diff --git a/performance-test/T01-dump-restore.sh b/performance-test/T01-dump-restore.sh index b2ff9400..9cfd5cd6 100755 --- a/performance-test/T01-dump-restore.sh +++ b/performance-test/T01-dump-restore.sh @@ -2,7 +2,7 @@ test_description='dump and restore' -. ./perf-test-lib.sh +. ./perf-test-lib.sh || exit 1 time_start diff --git a/performance-test/T02-tag.sh b/performance-test/T02-tag.sh index 78cecccc..dacb50b8 100755 --- a/performance-test/T02-tag.sh +++ b/performance-test/T02-tag.sh @@ -2,7 +2,7 @@ test_description='tagging' -. ./perf-test-lib.sh +. ./perf-test-lib.sh || exit 1 time_start diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh index 88601fc7..00d2f1c6 100644 --- a/performance-test/perf-test-lib.sh +++ b/performance-test/perf-test-lib.sh @@ -1,4 +1,4 @@ -. ./version.sh +. ./version.sh || exit 1 corpus_size=large @@ -25,7 +25,7 @@ do echo "error: unknown performance test option '$1'" >&2; exit 1 ;; esac done -. ../test/test-lib-common.sh +. ../test/test-lib-common.sh || exit 1 set -e 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 "' \ 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 < embedded_message From: Carl Worth 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 "' \ 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 "' \ 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 "' '[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 "' \ 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" && -- 2.26.2