test: use $(dirname "$0") for sourcing test-lib.sh

Don't assume the tests are always run from within the source tree.
This commit is contained in:
Jani Nikula 2017-09-25 23:38:19 +03:00 committed by David Bremner
parent 0dd58ea7e7
commit a863de1e43
77 changed files with 77 additions and 77 deletions

View file

@ -14,7 +14,7 @@ then
exit 1
fi
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
################################################################
# Test harness

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="online help"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest 'notmuch --help'
test_expect_success 'notmuch --help'

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch compact"'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message '[subject]=One'
add_message '[subject]=Two'

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='"notmuch config"'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Get string value"
test_expect_equal "$(notmuch config get user.name)" "Notmuch Test Suite"

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='"notmuch setup"'
. ./test-lib.sh || exit 1
. $(dirname "$0")/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)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch new" in several variations'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "No new messages"
output=$(NOTMUCH_NEW --debug)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch count" for messages and threads'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch insert"'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_require_external_prereq gdb

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch search" in several variations'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='various settings for "notmuch search --output="'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch address" in several variants'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch search" by folder: and path: (with variations)'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message '[dir]=bad' '[subject]="To the bone"'
add_message '[dir]=.' '[subject]="Top level"'

View file

@ -18,7 +18,7 @@
# id:3wd4o8wa7fx.fsf@testarossa.amd.com
test_description='that notmuch does not overlap term positions'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message '[to]="a@b.c, x@y.z"'

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='messages with unquoted . in name'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message \
'[from]="Some.Name for Someone <bugs@quoting.com>"' \

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch search" --offset and --limit parameters'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch search, count and show" with excludes in several variations'
. ./test-lib.sh || exit 1
. $(dirname "$0")/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"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='"notmuch tag"'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message '[subject]=One'
add_message '[subject]=Two'

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="--format=json output"
. ./test-lib.sh || exit 1
. $(dirname "$0")/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\""

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="--format=sexp output"
. ./test-lib.sh || exit 1
. $(dirname "$0")/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\""

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="--format=text output"
. ./test-lib.sh || exit 1
. $(dirname "$0")/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\""

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="output of multipart message"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
cat <<EOF > embedded_message_body
Content-Type: multipart/alternative; boundary="==-=-=="

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="naming of threads with changing subject"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Initial thread name (oldest-first search)"
add_message '[subject]="thread-naming: Initial thread subject"' \

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="naming of authors with unusual addresses"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Add author with empty quoted real name"
add_message '[subject]="author-naming: Initial thread subject"' \

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='notmuch show --format=raw'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message
add_message

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="\"notmuch reply\" in several variations"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Basic reply"
add_message '[from]="Sender <sender@example.com>"' \

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="\"notmuch reply --reply-to=sender\" in several variations"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Basic reply-to-sender"
add_message '[from]="Sender <sender@example.com>"' \

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="\"notmuch dump\" and \"notmuch restore\""
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
NOTMUCH_NEW > /dev/null
test_begin_subtest "dump header"

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="handling of uuencoded data"
. ./test-lib.sh || exit 1
. $(dirname "$0")/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

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="threading when messages received out of order"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
# Generate all single-root four message thread structures. We'll use
# this for multiple tests below.

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="author reordering;"
. ./test-lib.sh || exit 1
. $(dirname "$0")/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"'

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="From line heuristics (with multiple configured addresses)"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Magic from guessing (nothing to go on)"
add_message '[from]="Sender <sender@example.com>"' \

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="messages with ridiculously-long message IDs"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Referencing long ID before adding"
generate_message '[subject]="Reference of ridiculously-long message ID"' \

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="encoding issues"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Message with text of unknown charset"
add_message '[content-type]="text/plain; charset=unknown-8bit"' \

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs interface"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs.expected-output

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="Emacs with large search results buffer"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
x=xxxxxxxxxx # 10
x=$x$x$x$x$x$x$x$x$x$x # 100

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs: mail subject to filename"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
# emacs server can't be started in a child process with $(test_emacs ...)
test_emacs '(ignore)' > /dev/null

View file

@ -2,7 +2,7 @@
test_description="maildir synchronization"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
# Create the expected maildir structure
mkdir $MAIL_DIR/cur

View file

@ -5,7 +5,7 @@
# - verification of signatures from expired/revoked keys
test_description='PGP/MIME signature verification and decryption'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
##################################################

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='S/MIME signature verification and decryption'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_gpgsm_home ()
{

View file

@ -9,7 +9,7 @@
test_description='exception symbol hiding'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest 'running test' run_test
mkdir -p ${PWD}/fakedb/.notmuch

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='folder tags removed and added through file renames remain consistent'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "No new messages"
output=$(NOTMUCH_NEW)

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='atomicity'
. ./test-lib.sh || exit 1
. $(dirname "$0")/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

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="python bindings"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_require_external_prereq ${NOTMUCH_PYTHON}

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="ruby bindings"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
test_subtest_missing_external_prereq_["ruby development files"]=t

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='hooks'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
HOOK_DIR=${MAIL_DIR}/.notmuch/hooks

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="argument parsing"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "sanity check"
$TEST_DIRECTORY/arg-test pos1 --keyword=one --boolean --string=foo pos2 --int=7 --flag=one --flag=three > OUTPUT

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs test function sanity"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "emacs test function sanity"
test_emacs_expect_t 't'

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs address cleaning"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "notmuch-test-address-clean part 1"
test_emacs_expect_t '(notmuch-test-address-cleaning-1)'

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs notmuch-hello view"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs.expected-output

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs notmuch-show view"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/emacs-show.expected-output

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs notmuch-show charset handling"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
UTF8_YEN=$'\xef\xbf\xa5'

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="emacs tree view interface"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
EXPECTED=$TEST_DIRECTORY/tree.expected-output

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='messages with missing headers'
. ./test-lib.sh || exit 1
. $(dirname "$0")/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

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="hex encoding and decoding"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "round trip"
find $TEST_DIRECTORY/corpora/default -type f -print | sort | xargs cat > EXPECTED

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="date/time parser module"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
# Sanity/smoke tests for the date/time parser independent of notmuch

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="date:since..until queries"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -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 || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "Use References when In-Reply-To is broken"
add_message '[id]="foo@one.com"' \

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description='"notmuch show"'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="database upgrade"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
dbtarball=database-v1.tar.xz

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="database version and feature compatibility"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest "future database versions abort open"
${TEST_DIRECTORY}/make-db-version ${MAIL_DIR} 9999 ""

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="error reporting for library"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="database revision tracking"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -5,7 +5,7 @@
test_description='test of searching by thread-id'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="library config API"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -19,7 +19,7 @@ test_description='thread breakage during reindexing'
# works properly and attempted fixes to threading issues do not break
# the expected contents of the index.
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
message_a() {
mkdir -p ${MAIL_DIR}/cur

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='named queries'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
QUERYSTR="date:2009-11-18..2009-11-18 and tag:unread"

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="message property API"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="locking"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
if [ "${NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK}" = "0" ]; then
test_subtest_missing_external_prereq_["lock retry support"]=t

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="Emacs Draft Handling"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="DatabaseModifiedError handling"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
# add enough messages to trigger the exception
add_email_corpus

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='regular expression searches'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
test_done

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="parsing of bad dates"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message [date]='"()"'

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="duplicate message ids"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message '[id]="duplicate"' '[subject]="message 1" [filename]=copy1'
add_message '[id]="duplicate"' '[subject]="message 2" [filename]=copy2'

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description="indexing of html parts"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus html

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
test_description="command line arguments"
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_message

View file

@ -1,6 +1,6 @@
#!/usr/bin/env bash
test_description='reindexing messages'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
add_email_corpus

View file

@ -2,7 +2,7 @@
test_description='the verbosity options of the test framework itself.'
. ./test-lib.sh || exit 1
. $(dirname "$0")/test-lib.sh || exit 1
test_begin_subtest 'print something in test_expect_success and pass'
test_expect_success '