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.
71 files changed:
done
shift `expr $OPTIND - 1`
done
shift `expr $OPTIND - 1`
+. ./test-lib.sh || exit 1
SHORT_CORPUS=$(basename ${CORPUS:-database})
DBNAME=${SHORT_CORPUS}${SUFFIX}
SHORT_CORPUS=$(basename ${CORPUS:-database})
DBNAME=${SHORT_CORPUS}${SUFFIX}
test_description='notmuch new'
test_description='notmuch new'
+. ./perf-test-lib.sh || exit 1
# ensure initial 'notmuch new' is run by memory_start
uncache_database
# ensure initial 'notmuch new' is run by memory_start
uncache_database
test_description='dump and restore'
test_description='dump and restore'
+. ./perf-test-lib.sh || exit 1
test_description='notmuch new'
test_description='notmuch new'
+. ./perf-test-lib.sh || exit 1
test_description='dump and restore'
test_description='dump and restore'
+. ./perf-test-lib.sh || exit 1
test_description='tagging'
test_description='tagging'
+. ./perf-test-lib.sh || exit 1
+. ./version.sh || exit 1
echo "error: unknown performance test option '$1'" >&2; exit 1 ;;
esac
done
echo "error: unknown performance test option '$1'" >&2; exit 1 ;;
esac
done
-. ../test/test-lib-common.sh
+. ../test/test-lib-common.sh || exit 1
After assigning test_description, the test script should source
test-lib.sh like this:
After assigning test_description, the test script should source
test-lib.sh like this:
+ . ./test-lib.sh || exit 1
This test harness library does the following things:
This test harness library does the following things:
+. ./test-lib.sh || exit 1
################################################################
# Test harness
################################################################
# Test harness
#!/usr/bin/env bash
test_description="online help"
#!/usr/bin/env bash
test_description="online help"
+. ./test-lib.sh || exit 1
test_expect_success 'notmuch --help' 'notmuch --help'
test_expect_success 'notmuch help' 'notmuch help'
test_expect_success 'notmuch --help' 'notmuch --help'
test_expect_success 'notmuch help' 'notmuch help'
#!/usr/bin/env bash
test_description='"notmuch compact"'
#!/usr/bin/env bash
test_description='"notmuch compact"'
+. ./test-lib.sh || exit 1
add_message '[subject]=One'
add_message '[subject]=Two'
add_message '[subject]=One'
add_message '[subject]=Two'
#!/usr/bin/env bash
test_description='"notmuch config"'
#!/usr/bin/env bash
test_description='"notmuch config"'
+. ./test-lib.sh || exit 1
test_begin_subtest "Get string value"
test_expect_equal "$(notmuch config get user.name)" "Notmuch Test Suite"
test_begin_subtest "Get string value"
test_expect_equal "$(notmuch config get user.name)" "Notmuch Test Suite"
#!/usr/bin/env bash
test_description='"notmuch setup"'
#!/usr/bin/env bash
test_description='"notmuch setup"'
+. ./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)
test_begin_subtest "Notmuch new without a config suggests notmuch setup"
output=$(notmuch --config=new-notmuch-config new 2>&1)
#!/usr/bin/env bash
test_description='"notmuch new" in several variations'
#!/usr/bin/env bash
test_description='"notmuch new" in several variations'
+. ./test-lib.sh || exit 1
test_begin_subtest "No new messages"
output=$(NOTMUCH_NEW --debug)
test_begin_subtest "No new messages"
output=$(NOTMUCH_NEW --debug)
#!/usr/bin/env bash
test_description='"notmuch count" for messages and threads'
#!/usr/bin/env bash
test_description='"notmuch count" for messages and threads'
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description='"notmuch insert"'
#!/usr/bin/env bash
test_description='"notmuch insert"'
+. ./test-lib.sh || exit 1
test_require_external_prereq gdb
test_require_external_prereq gdb
#!/usr/bin/env bash
test_description='"notmuch search" in several variations'
#!/usr/bin/env bash
test_description='"notmuch search" in several variations'
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description='various settings for "notmuch search --output="'
#!/usr/bin/env bash
test_description='various settings for "notmuch search --output="'
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description='"notmuch address" in several variants'
#!/usr/bin/env bash
test_description='"notmuch address" in several variants'
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description='"notmuch search" by folder: and path: (with variations)'
#!/usr/bin/env bash
test_description='"notmuch search" by folder: and path: (with variations)'
+. ./test-lib.sh || exit 1
add_message '[dir]=bad' '[subject]="To the bone"'
add_message '[dir]=.' '[subject]="Top level"'
add_message '[dir]=bad' '[subject]="To the bone"'
add_message '[dir]=.' '[subject]="Top level"'
# id:3wd4o8wa7fx.fsf@testarossa.amd.com
test_description='that notmuch does not overlap term positions'
# id:3wd4o8wa7fx.fsf@testarossa.amd.com
test_description='that notmuch does not overlap term positions'
+. ./test-lib.sh || exit 1
add_message '[to]="a@b.c, x@y.z"'
add_message '[to]="a@b.c, x@y.z"'
#!/usr/bin/env bash
test_description='messages with unquoted . in name'
#!/usr/bin/env bash
test_description='messages with unquoted . in name'
+. ./test-lib.sh || exit 1
add_message \
'[from]="Some.Name for Someone <bugs@quoting.com>"' \
add_message \
'[from]="Some.Name for Someone <bugs@quoting.com>"' \
#!/usr/bin/env bash
test_description='"notmuch search" --offset and --limit parameters'
#!/usr/bin/env bash
test_description='"notmuch search" --offset and --limit parameters'
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description='"notmuch search, count and show" with excludes in several variations'
#!/usr/bin/env bash
test_description='"notmuch search, count and show" with excludes in several variations'
+. ./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"
# Generates a thread consisting of a top level message and 'length'
# replies. The subject of the top message 'subject: top message"
#!/usr/bin/env bash
test_description='"notmuch tag"'
#!/usr/bin/env bash
test_description='"notmuch tag"'
+. ./test-lib.sh || exit 1
add_message '[subject]=One'
add_message '[subject]=Two'
add_message '[subject]=One'
add_message '[subject]=Two'
#!/usr/bin/env bash
test_description="--format=json output"
#!/usr/bin/env bash
test_description="--format=json output"
+. ./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\""
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\""
#!/usr/bin/env bash
test_description="--format=sexp output"
#!/usr/bin/env bash
test_description="--format=sexp output"
+. ./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\""
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\""
#!/usr/bin/env bash
test_description="--format=text output"
#!/usr/bin/env bash
test_description="--format=text output"
+. ./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\""
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\""
#!/usr/bin/env bash
test_description="output of multipart message"
#!/usr/bin/env bash
test_description="output of multipart message"
+. ./test-lib.sh || exit 1
cat <<EOF > embedded_message
From: Carl Worth <cworth@cworth.org>
cat <<EOF > embedded_message
From: Carl Worth <cworth@cworth.org>
#!/usr/bin/env bash
test_description="naming of threads with changing subject"
#!/usr/bin/env bash
test_description="naming of threads with changing subject"
+. ./test-lib.sh || exit 1
test_begin_subtest "Initial thread name (oldest-first search)"
add_message '[subject]="thread-naming: Initial thread subject"' \
test_begin_subtest "Initial thread name (oldest-first search)"
add_message '[subject]="thread-naming: Initial thread subject"' \
#!/usr/bin/env bash
test_description="naming of authors with unusual addresses"
#!/usr/bin/env bash
test_description="naming of authors with unusual addresses"
+. ./test-lib.sh || exit 1
test_begin_subtest "Add author with empty quoted real name"
add_message '[subject]="author-naming: Initial thread subject"' \
test_begin_subtest "Add author with empty quoted real name"
add_message '[subject]="author-naming: Initial thread subject"' \
#!/usr/bin/env bash
test_description='notmuch show --format=raw'
#!/usr/bin/env bash
test_description='notmuch show --format=raw'
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description="\"notmuch reply\" in several variations"
#!/usr/bin/env bash
test_description="\"notmuch reply\" in several variations"
+. ./test-lib.sh || exit 1
test_begin_subtest "Basic reply"
add_message '[from]="Sender <sender@example.com>"' \
test_begin_subtest "Basic reply"
add_message '[from]="Sender <sender@example.com>"' \
#!/usr/bin/env bash
test_description="\"notmuch reply --reply-to=sender\" in several variations"
#!/usr/bin/env bash
test_description="\"notmuch reply --reply-to=sender\" in several variations"
+. ./test-lib.sh || exit 1
test_begin_subtest "Basic reply-to-sender"
add_message '[from]="Sender <sender@example.com>"' \
test_begin_subtest "Basic reply-to-sender"
add_message '[from]="Sender <sender@example.com>"' \
#!/usr/bin/env bash
test_description="\"notmuch dump\" and \"notmuch restore\""
#!/usr/bin/env bash
test_description="\"notmuch dump\" and \"notmuch restore\""
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description="handling of uuencoded data"
#!/usr/bin/env bash
test_description="handling of uuencoded data"
+. ./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
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
#!/usr/bin/env bash
test_description="threading when messages received out of order"
#!/usr/bin/env bash
test_description="threading when messages received out of order"
+. ./test-lib.sh || exit 1
# Generate all single-root four message thread structures. We'll use
# this for multiple tests below.
# Generate all single-root four message thread structures. We'll use
# this for multiple tests below.
#!/usr/bin/env bash
test_description="author reordering;"
#!/usr/bin/env bash
test_description="author reordering;"
+. ./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"'
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"'
#!/usr/bin/env bash
test_description="From line heuristics (with multiple configured addresses)"
#!/usr/bin/env bash
test_description="From line heuristics (with multiple configured addresses)"
+. ./test-lib.sh || exit 1
test_begin_subtest "Magic from guessing (nothing to go on)"
add_message '[from]="Sender <sender@example.com>"' \
test_begin_subtest "Magic from guessing (nothing to go on)"
add_message '[from]="Sender <sender@example.com>"' \
#!/usr/bin/env bash
test_description="messages with ridiculously-long message IDs"
#!/usr/bin/env bash
test_description="messages with ridiculously-long message IDs"
+. ./test-lib.sh || exit 1
test_begin_subtest "Referencing long ID before adding"
generate_message '[subject]="Reference of ridiculously-long message ID"' \
test_begin_subtest "Referencing long ID before adding"
generate_message '[subject]="Reference of ridiculously-long message ID"' \
#!/usr/bin/env bash
test_description="encoding issues"
#!/usr/bin/env bash
test_description="encoding issues"
+. ./test-lib.sh || exit 1
test_begin_subtest "Message with text of unknown charset"
add_message '[content-type]="text/plain; charset=unknown-8bit"' \
test_begin_subtest "Message with text of unknown charset"
add_message '[content-type]="text/plain; charset=unknown-8bit"' \
#!/usr/bin/env bash
test_description="emacs interface"
#!/usr/bin/env bash
test_description="emacs interface"
+. ./test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs.expected-output
EXPECTED=$TEST_DIRECTORY/emacs.expected-output
#!/usr/bin/env bash
test_description="Emacs with large search results buffer"
#!/usr/bin/env bash
test_description="Emacs with large search results buffer"
+. ./test-lib.sh || exit 1
x=xxxxxxxxxx # 10
x=$x$x$x$x$x$x$x$x$x$x # 100
x=xxxxxxxxxx # 10
x=$x$x$x$x$x$x$x$x$x$x # 100
#!/usr/bin/env bash
test_description="emacs: mail subject to filename"
#!/usr/bin/env bash
test_description="emacs: mail subject to filename"
+. ./test-lib.sh || exit 1
# emacs server can't be started in a child process with $(test_emacs ...)
test_emacs '(ignore)' > /dev/null
# emacs server can't be started in a child process with $(test_emacs ...)
test_emacs '(ignore)' > /dev/null
test_description="maildir synchronization"
test_description="maildir synchronization"
+. ./test-lib.sh || exit 1
# Create the expected maildir structure
mkdir $MAIL_DIR/cur
# Create the expected maildir structure
mkdir $MAIL_DIR/cur
# - verification of signatures from expired/revoked keys
test_description='PGP/MIME signature verification and decryption'
# - verification of signatures from expired/revoked keys
test_description='PGP/MIME signature verification and decryption'
+. ./test-lib.sh || exit 1
test_description='exception symbol hiding'
test_description='exception symbol hiding'
+. ./test-lib.sh || exit 1
test_begin_subtest 'running test' run_test
mkdir -p ${PWD}/fakedb/.notmuch
test_begin_subtest 'running test' run_test
mkdir -p ${PWD}/fakedb/.notmuch
#!/usr/bin/env bash
test_description='folder tags removed and added through file renames remain consistent'
#!/usr/bin/env bash
test_description='folder tags removed and added through file renames remain consistent'
+. ./test-lib.sh || exit 1
test_begin_subtest "No new messages"
output=$(NOTMUCH_NEW)
test_begin_subtest "No new messages"
output=$(NOTMUCH_NEW)
#!/usr/bin/env bash
test_description='atomicity'
#!/usr/bin/env bash
test_description='atomicity'
+. ./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
# This script tests the effects of killing and restarting "notmuch
# new" at arbitrary points. If notmuch new is properly atomic, the
#!/usr/bin/env bash
test_description="python bindings"
#!/usr/bin/env bash
test_description="python bindings"
+. ./test-lib.sh || exit 1
test_require_external_prereq ${NOTMUCH_PYTHON}
test_require_external_prereq ${NOTMUCH_PYTHON}
#!/usr/bin/env bash
test_description="ruby bindings"
#!/usr/bin/env bash
test_description="ruby bindings"
+. ./test-lib.sh || exit 1
if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
test_subtest_missing_external_prereq_["ruby development files"]=t
if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
test_subtest_missing_external_prereq_["ruby development files"]=t
#!/usr/bin/env bash
test_description='hooks'
#!/usr/bin/env bash
test_description='hooks'
+. ./test-lib.sh || exit 1
HOOK_DIR=${MAIL_DIR}/.notmuch/hooks
HOOK_DIR=${MAIL_DIR}/.notmuch/hooks
#!/usr/bin/env bash
test_description="argument parsing"
#!/usr/bin/env bash
test_description="argument parsing"
+. ./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
test_begin_subtest "sanity check"
$TEST_DIRECTORY/arg-test pos1 --keyword=one --string=foo pos2 --int=7 --flag=one --flag=three > OUTPUT
#!/usr/bin/env bash
test_description="emacs test function sanity"
#!/usr/bin/env bash
test_description="emacs test function sanity"
+. ./test-lib.sh || exit 1
test_begin_subtest "emacs test function sanity"
test_emacs_expect_t 't'
test_begin_subtest "emacs test function sanity"
test_emacs_expect_t 't'
#!/usr/bin/env bash
test_description="emacs address cleaning"
#!/usr/bin/env bash
test_description="emacs address cleaning"
+. ./test-lib.sh || exit 1
test_begin_subtest "notmuch-test-address-clean part 1"
test_emacs_expect_t '(notmuch-test-address-cleaning-1)'
test_begin_subtest "notmuch-test-address-clean part 1"
test_emacs_expect_t '(notmuch-test-address-cleaning-1)'
#!/usr/bin/env bash
test_description="emacs notmuch-hello view"
#!/usr/bin/env bash
test_description="emacs notmuch-hello view"
+. ./test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs.expected-output
EXPECTED=$TEST_DIRECTORY/emacs.expected-output
#!/usr/bin/env bash
test_description="emacs notmuch-show view"
#!/usr/bin/env bash
test_description="emacs notmuch-show view"
+. ./test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output
#!/usr/bin/env bash
test_description="emacs notmuch-show charset handling"
#!/usr/bin/env bash
test_description="emacs notmuch-show charset handling"
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description="emacs tree view interface"
#!/usr/bin/env bash
test_description="emacs tree view interface"
+. ./test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/tree.expected-output
EXPECTED=$TEST_DIRECTORY/tree.expected-output
#!/usr/bin/env bash
test_description='messages with missing headers'
#!/usr/bin/env bash
test_description='messages with missing headers'
+. ./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
# Notmuch requires at least one of from, subject, or to or it will
# ignore the file. Generate two messages so that together they cover
#!/usr/bin/env bash
test_description="hex encoding and decoding"
#!/usr/bin/env bash
test_description="hex encoding and decoding"
+. ./test-lib.sh || exit 1
test_begin_subtest "round trip"
find $TEST_DIRECTORY/corpus -type f -print | sort | xargs cat > EXPECTED
test_begin_subtest "round trip"
find $TEST_DIRECTORY/corpus -type f -print | sort | xargs cat > EXPECTED
#!/usr/bin/env bash
test_description="date/time parser module"
#!/usr/bin/env bash
test_description="date/time parser module"
+. ./test-lib.sh || exit 1
# Sanity/smoke tests for the date/time parser independent of notmuch
# Sanity/smoke tests for the date/time parser independent of notmuch
#!/usr/bin/env bash
test_description="date:since..until queries"
#!/usr/bin/env bash
test_description="date:since..until queries"
+. ./test-lib.sh || exit 1
# database is constructed properly, even in the presence of
# non-RFC-compliant headers'
# database is constructed properly, even in the presence of
# non-RFC-compliant headers'
+. ./test-lib.sh || exit 1
test_begin_subtest "Use References when In-Reply-To is broken"
add_message '[id]="foo@one.com"' \
test_begin_subtest "Use References when In-Reply-To is broken"
add_message '[id]="foo@one.com"' \
#!/usr/bin/env bash
test_description='"notmuch show"'
#!/usr/bin/env bash
test_description='"notmuch show"'
+. ./test-lib.sh || exit 1
#!/usr/bin/env bash
test_description="database upgrade"
#!/usr/bin/env bash
test_description="database upgrade"
+. ./test-lib.sh || exit 1
dbtarball=database-v1.tar.xz
dbtarball=database-v1.tar.xz
#!/usr/bin/env bash
test_description="database version and feature compatibility"
#!/usr/bin/env bash
test_description="database version and feature compatibility"
+. ./test-lib.sh || exit 1
test_begin_subtest "future database versions abort open"
${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 9999 ""
test_begin_subtest "future database versions abort open"
${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 9999 ""
#!/usr/bin/env bash
test_description="error reporting for library"
#!/usr/bin/env bash
test_description="error reporting for library"
+. ./test-lib.sh || exit 1
backup_database () {
rm -rf notmuch-dir-backup
backup_database () {
rm -rf notmuch-dir-backup
notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
# configure output
notmuch_path=`find_notmuch_path "$TEST_DIRECTORY"`
# configure output
-. $notmuch_path/sh.config
+. $notmuch_path/sh.config || exit 1
if test -n "$valgrind"
then
if test -n "$valgrind"
then
# test_description='Description of this test...
# This test checks if command xyzzy does the right thing...
# '
# test_description='Description of this test...
# This test checks if command xyzzy does the right thing...
# '
+# . ./test-lib.sh || exit 1
+
[ "x$ORIGINAL_TERM" != "xdumb" ] && (
TERM=$ORIGINAL_TERM &&
export TERM &&
[ "x$ORIGINAL_TERM" != "xdumb" ] && (
TERM=$ORIGINAL_TERM &&
export TERM &&
+. ./test-lib-common.sh || exit 1
test_description='the verbosity options of the test framework itself.'
test_description='the verbosity options of the test framework itself.'
+. ./test-lib.sh || exit 1
test_expect_success 'print something in test_expect_success and pass' '
echo "hello stdout" &&
test_expect_success 'print something in test_expect_success and pass' '
echo "hello stdout" &&