aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2015-12-13 08:39:11 -0400
committerDavid Bremner <david@tethera.net>2015-12-13 08:39:11 -0400
commite3cd357fdddd2d8d29e8eea0b40a1043c46f1791 (patch)
treeb0e4f0549fc1216439e4593b73206c7923995ad4 /test
parentad5b7434978ed98b1eb832b77684869f5d02594a (diff)
parent1432a4f946e0f236179b53ac71d03764da725f33 (diff)
Merge tag 'debian/0.21-3' into jessie-backports
uploaded to unstable
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.local10
-rw-r--r--test/README9
-rwxr-xr-xtest/T000-basic.sh2
-rwxr-xr-xtest/T010-help-test.sh6
-rwxr-xr-xtest/T020-compact.sh2
-rwxr-xr-xtest/T030-config.sh2
-rwxr-xr-xtest/T040-setup.sh2
-rwxr-xr-xtest/T050-new.sh72
-rwxr-xr-xtest/T060-count.sh32
-rwxr-xr-xtest/T070-insert.sh4
-rwxr-xr-xtest/T080-search.sh2
-rwxr-xr-xtest/T090-search-output.sh2
-rwxr-xr-xtest/T095-address.sh146
-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.sh21
-rwxr-xr-xtest/T370-search-folder-coherence.sh2
-rwxr-xr-xtest/T380-atomicity.sh2
-rwxr-xr-xtest/T390-python.sh10
-rwxr-xr-xtest/T395-ruby.sh86
-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.sh6
-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.sh60
-rwxr-xr-xtest/T570-revision-tracking.sh93
-rwxr-xr-xtest/aggregate-results.sh5
-rw-r--r--test/random-corpus.c19
-rw-r--r--test/symbol-test.cc35
-rw-r--r--test/test-lib-common.sh14
-rw-r--r--test/test-lib.sh36
-rwxr-xr-xtest/test-verbose2
69 files changed, 609 insertions, 157 deletions
diff --git a/test/Makefile.local b/test/Makefile.local
index 2331ceb1..2b186914 100644
--- a/test/Makefile.local
+++ b/test/Makefile.local
@@ -56,7 +56,17 @@ TEST_BINARIES := $(TEST_BINARIES:.cc=)
test-binaries: $(TEST_BINARIES)
test: all test-binaries
+ifeq ($V,)
+ @echo 'Use "$(MAKE) V=1" to print test headings and PASSIng results.'
+ @env NOTMUCH_TEST_QUIET=1 ${test_src_dir}/notmuch-test $(OPTIONS)
+else
+# The user has explicitly enabled quiet execution.
+ifeq ($V,0)
+ @env NOTMUCH_TEST_QUIET=1 ${test_src_dir}/notmuch-test $(OPTIONS)
+else
@${test_src_dir}/notmuch-test $(OPTIONS)
+endif
+endif
check: test
diff --git a/test/README b/test/README
index daf41600..e54e36b7 100644
--- a/test/README
+++ b/test/README
@@ -117,6 +117,13 @@ Note that some tests in the existing test suite rely on previous test
items, so you cannot arbitrarily skip any test and expect the
remaining tests to be unaffected.
+Currently we do not consider skipped tests as build failures. For
+maximum robustness, when setting up automated build processes, you
+should explicitely skip tests, rather than relying on notmuch's
+detection of missing prerequisites. In the future we may treat tests
+unable to run because of missing prerequisites, but not explicitely
+skipped by the user, as failures.
+
Writing Tests
-------------
The test script is written as a shell script. It should start with
@@ -138,7 +145,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 caf8bdb0..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'
@@ -12,9 +12,9 @@ if [ $NOTMUCH_HAVE_MAN -eq 1 ]; then
test_expect_success 'notmuch help tag' 'notmuch help tag'
else
test_expect_success 'notmuch --help tag (man pages not available)' \
- 'test_must_fail notmuch --help tag'
+ 'test_must_fail notmuch --help tag >/dev/null'
test_expect_success 'notmuch help tag (man pages not available)' \
- 'test_must_fail notmuch help tag'
+ 'test_must_fail notmuch help tag >/dev/null'
fi
test_done
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 e6c3291f..81cf2fad 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -1,27 +1,27 @@
#!/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)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "No new mail."
test_begin_subtest "Single new message"
generate_message
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 1 new message to the database."
test_begin_subtest "Multiple new messages"
generate_message
generate_message
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 2 new messages to the database."
test_begin_subtest "No new messages (non-empty DB)"
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "No new mail."
@@ -31,7 +31,7 @@ mkdir "${MAIL_DIR}"/def
mkdir "${MAIL_DIR}"/ghi
generate_message [dir]=def
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 1 new message to the database."
@@ -42,7 +42,7 @@ mv "${MAIL_DIR}"/ghi "${MAIL_DIR}"/abc
rm "${MAIL_DIR}"/def/*
generate_message [dir]=abc
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 1 new message to the database."
@@ -54,7 +54,7 @@ mkdir -p "$(dirname "$tmp_msg_filename")"
mv "$gen_msg_filename" "$tmp_msg_filename"
notmuch new > /dev/null
mv "$tmp_msg_filename" "$gen_msg_filename"
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 1 new message to the database."
@@ -63,15 +63,18 @@ test_begin_subtest "Renamed message"
generate_message
notmuch new > /dev/null
mv "$gen_msg_filename" "${gen_msg_filename}"-renamed
-output=$(NOTMUCH_NEW)
-test_expect_equal "$output" "No new mail. Detected 1 file rename."
+output=$(NOTMUCH_NEW --debug)
+test_expect_equal "$output" "(D) add_files_recursive, pass 2: queuing passed file ${gen_msg_filename} for deletion from database
+No new mail. Detected 1 file rename."
test_begin_subtest "Deleted message"
rm "${gen_msg_filename}"-renamed
-output=$(NOTMUCH_NEW)
-test_expect_equal "$output" "No new mail. Removed 1 message."
+output=$(NOTMUCH_NEW --debug)
+test_expect_equal "$output" "(D) add_files_recursive, pass 3: queuing leftover file ${gen_msg_filename}-renamed for deletion from database
+No new mail. Removed 1 message."
+
test_begin_subtest "Renamed directory"
@@ -84,16 +87,17 @@ notmuch new > /dev/null
mv "${MAIL_DIR}"/dir "${MAIL_DIR}"/dir-renamed
-output=$(NOTMUCH_NEW)
-test_expect_equal "$output" "No new mail. Detected 3 file renames."
+output=$(NOTMUCH_NEW --debug)
+test_expect_equal "$output" "(D) add_files_recursive, pass 2: queuing passed directory ${MAIL_DIR}/dir for deletion from database
+No new mail. Detected 3 file renames."
test_begin_subtest "Deleted directory"
-
rm -rf "${MAIL_DIR}"/dir-renamed
-output=$(NOTMUCH_NEW)
-test_expect_equal "$output" "No new mail. Removed 3 messages."
+output=$(NOTMUCH_NEW --debug)
+test_expect_equal "$output" "(D) add_files_recursive, pass 2: queuing passed directory ${MAIL_DIR}/dir-renamed for deletion from database
+No new mail. Removed 3 messages."
test_begin_subtest "New directory (at end of list)"
@@ -102,7 +106,7 @@ generate_message [dir]=zzz
generate_message [dir]=zzz
generate_message [dir]=zzz
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 3 new messages to the database."
@@ -110,8 +114,9 @@ test_begin_subtest "Deleted directory (end of list)"
rm -rf "${MAIL_DIR}"/zzz
-output=$(NOTMUCH_NEW)
-test_expect_equal "$output" "No new mail. Removed 3 messages."
+output=$(NOTMUCH_NEW --debug)
+test_expect_equal "$output" "(D) add_files_recursive, pass 3: queuing leftover directory ${MAIL_DIR}/zzz for deletion from database
+No new mail. Removed 3 messages."
test_begin_subtest "New symlink to directory"
@@ -122,7 +127,7 @@ mv "${MAIL_DIR}" "${TMP_DIRECTORY}"/actual_maildir
mkdir "${MAIL_DIR}"
ln -s "${TMP_DIRECTORY}"/actual_maildir "${MAIL_DIR}"/symlink
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 1 new message to the database."
@@ -132,13 +137,13 @@ external_msg_filename="${TMP_DIRECTORY}"/external/"$(basename "$gen_msg_filename
mkdir -p "$(dirname "$external_msg_filename")"
mv "$gen_msg_filename" "$external_msg_filename"
ln -s "$external_msg_filename" "$gen_msg_filename"
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 1 new message to the database."
test_begin_subtest "Broken symlink aborts"
ln -s does-not-exist "${MAIL_DIR}/broken"
-output=$(NOTMUCH_NEW 2>&1)
+output=$(NOTMUCH_NEW --debug 2>&1)
test_expect_equal "$output" \
"Error reading file ${MAIL_DIR}/broken: No such file or directory
Note: A fatal error was encountered: Something went wrong trying to read or write a file
@@ -152,7 +157,7 @@ generate_message [dir]=two/levels
generate_message [dir]=two/levels
generate_message [dir]=two/levels
-output=$(NOTMUCH_NEW)
+output=$(NOTMUCH_NEW --debug)
test_expect_equal "$output" "Added 3 new messages to the database."
@@ -160,10 +165,11 @@ test_begin_subtest "Deleted two-level directory"
rm -rf "${MAIL_DIR}"/two
-output=$(NOTMUCH_NEW)
-test_expect_equal "$output" "No new mail. Removed 3 messages."
+output=$(NOTMUCH_NEW --debug)
+test_expect_equal "$output" "(D) add_files_recursive, pass 3: queuing leftover directory ${MAIL_DIR}/two for deletion from database
+No new mail. Removed 3 messages."
-test_begin_subtest "Support single-message mbox (deprecated)"
+test_begin_subtest "Support single-message mbox"
cat > "${MAIL_DIR}"/mbox_file1 <<EOF
From test_suite@notmuchmail.org Fri Jan 5 15:43:57 2001
From: Notmuch Test Suite <test_suite@notmuchmail.org>
@@ -172,7 +178,7 @@ Subject: Test mbox message 1
Body.
EOF
-output=$(NOTMUCH_NEW 2>&1)
+output=$(NOTMUCH_NEW --debug 2>&1)
test_expect_equal "$output" "Added 1 new message to the database."
# This test requires that notmuch new has been run at least once.
@@ -196,7 +202,7 @@ Subject: Test mbox message 2
Body 2.
EOF
-output=$(NOTMUCH_NEW 2>&1)
+output=$(NOTMUCH_NEW --debug 2>&1)
test_expect_equal "$output" \
"Note: Ignoring non-mail file: ${MAIL_DIR}/.git/config
Note: Ignoring non-mail file: ${MAIL_DIR}/.ignored_hidden_file
@@ -263,23 +269,23 @@ OLDCONFIG=$(notmuch config get new.tags)
test_begin_subtest "Empty tags in new.tags are forbidden"
notmuch config set new.tags "foo;;bar"
-output=$(NOTMUCH_NEW 2>&1)
+output=$(NOTMUCH_NEW --debug 2>&1)
test_expect_equal "$output" "Error: tag '' in new.tags: empty tag forbidden"
test_begin_subtest "Tags starting with '-' in new.tags are forbidden"
notmuch config set new.tags "-foo;bar"
-output=$(NOTMUCH_NEW 2>&1)
+output=$(NOTMUCH_NEW --debug 2>&1)
test_expect_equal "$output" "Error: tag '-foo' in new.tags: tag starting with '-' forbidden"
test_expect_code 1 "Invalid tags set exit code" \
- "NOTMUCH_NEW 2>&1"
+ "NOTMUCH_NEW --debug 2>&1"
notmuch config set new.tags $OLDCONFIG
test_begin_subtest "Xapian exception: read only files"
chmod u-w ${MAIL_DIR}/.notmuch/xapian/*.DB
-output=$(NOTMUCH_NEW 2>&1 | sed 's/: .*$//' )
+output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' )
chmod u+w ${MAIL_DIR}/.notmuch/xapian/*.DB
test_expect_equal "$output" "A Xapian exception occurred opening database"
diff --git a/test/T060-count.sh b/test/T060-count.sh
index da86c8cc..3fec94e8 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
@@ -93,5 +93,35 @@ notmuch count --output=messages >>EXPECTED
notmuch count --output=messages tag:inbox >>EXPECTED
test_expect_equal_file EXPECTED OUTPUT
+backup_database
+test_begin_subtest "error message for database open"
+dd if=/dev/zero of="${MAIL_DIR}/.notmuch/xapian/postlist.DB" count=3
+notmuch count '*' 2>OUTPUT 1>/dev/null
+output=$(sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' OUTPUT)
+test_expect_equal "${output}" "A Xapian exception occurred opening database"
+restore_database
+
+cat <<EOF > count-files.gdb
+set breakpoint pending on
+break count_files
+commands
+shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.DB
+continue
+end
+run
+EOF
+
+backup_database
+test_begin_subtest "error message from query_search_messages"
+gdb --batch-silent --return-child-result -x count-files.gdb \
+ --args notmuch count --output=files '*' 2>OUTPUT 1>/dev/null
+cat <<EOF > EXPECTED
+notmuch count: A Xapian exception occurred
+A Xapian exception occurred performing query
+Query string was: *
+EOF
+sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' < OUTPUT > OUTPUT.clean
+test_expect_equal_file EXPECTED OUTPUT.clean
+restore_database
test_done
diff --git a/test/T070-insert.sh b/test/T070-insert.sh
index 74f19552..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
@@ -188,7 +188,7 @@ notmuch config set new.tags $OLDCONFIG
# DUPLICATE_MESSAGE_ID is not tested here, because it should actually pass.
for code in OUT_OF_MEMORY XAPIAN_EXCEPTION FILE_NOT_EMAIL \
- READ_ONLY_DATABASE UPGRADE_REQUIRED; do
+ READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; do
gen_insert_msg
cat <<EOF > index-file-$code.gdb
set breakpoint pending on
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..a194faf3 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
@@ -145,4 +145,148 @@ cat <<EOF >EXPECTED
EOF
test_expect_equal_file OUTPUT EXPECTED
+test_begin_subtest "--deduplicate=no --sort=oldest-first --output=sender"
+notmuch address --deduplicate=no --sort=oldest-first --output=sender '*' >OUTPUT
+cat <<EOF >EXPECTED
+Mikhail Gusarov <dottedmag@dottedmag.net>
+Mikhail Gusarov <dottedmag@dottedmag.net>
+Carl Worth <cworth@cworth.org>
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Mikhail Gusarov <dottedmag@dottedmag.net>
+Alex Botero-Lowry <alex.boterolowry@gmail.com>
+Carl Worth <cworth@cworth.org>
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Mikhail Gusarov <dottedmag@dottedmag.net>
+Mikhail Gusarov <dottedmag@dottedmag.net>
+Keith Packard <keithp@keithp.com>
+Keith Packard <keithp@keithp.com>
+Keith Packard <keithp@keithp.com>
+Jan Janak <jan@ryngle.com>
+Jan Janak <jan@ryngle.com>
+Jan Janak <jan@ryngle.com>
+Israel Herraiz <isra@herraiz.org>
+Adrian Perez de Castro <aperez@igalia.com>
+Aron Griffis <agriffis@n01se.net>
+Ingmar Vanhassel <ingmar@exherbo.org>
+Alex Botero-Lowry <alex.boterolowry@gmail.com>
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Stewart Smith <stewart@flamingspork.com>
+Stewart Smith <stewart@flamingspork.com>
+Keith Packard <keithp@keithp.com>
+Keith Packard <keithp@keithp.com>
+Keith Packard <keithp@keithp.com>
+Stewart Smith <stewart@flamingspork.com>
+Jjgod Jiang <gzjjgod@gmail.com>
+Jan Janak <jan@ryngle.com>
+Rolland Santimano <rollandsantimano@yahoo.com>
+Alexander Botero-Lowry <alex.boterolowry@gmail.com>
+Jjgod Jiang <gzjjgod@gmail.com>
+Alexander Botero-Lowry <alex.boterolowry@gmail.com>
+Alexander Botero-Lowry <alex.boterolowry@gmail.com>
+Keith Packard <keithp@keithp.com>
+Alexander Botero-Lowry <alex.boterolowry@gmail.com>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Carl Worth <cworth@cworth.org>
+Chris Wilson <chris@chris-wilson.co.uk>
+Olivier Berger <olivier.berger@it-sudparis.eu>
+François Boulogne <boulogne.f@gmail.com>
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "--deduplicate=no --sort=newest-first --output=sender --output=recipients"
+notmuch address --deduplicate=no --sort=newest-first --output=sender --output=recipients path:foo/new >OUTPUT
+cat <<EOF >EXPECTED
+Mikhail Gusarov <dottedmag@dottedmag.net>
+notmuch@notmuchmail.org
+Mikhail Gusarov <dottedmag@dottedmag.net>
+notmuch@notmuchmail.org
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+notmuch@notmuchmail.org
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "--deduplicate=address --output=sender --output=recipients"
+notmuch address --deduplicate=address --output=sender --output=recipients '*' | sort >OUTPUT
+cat <<EOF >EXPECTED
+"Discussion about the Arch User Repository (AUR)" <aur-general@archlinux.org>
+Adrian Perez de Castro <aperez@igalia.com>
+Alexander Botero-Lowry <alex.boterolowry@gmail.com>
+Allan McRae <allan@archlinux.org>
+Aron Griffis <agriffis@n01se.net>
+Carl Worth <cworth@cworth.org>
+Chris Wilson <chris@chris-wilson.co.uk>
+François Boulogne <boulogne.f@gmail.com>
+Ingmar Vanhassel <ingmar@exherbo.org>
+Israel Herraiz <isra@herraiz.org>
+Jan Janak <jan@ryngle.com>
+Jjgod Jiang <gzjjgod@gmail.com>
+Keith Packard <keithp@keithp.com>
+Lars Kellogg-Stedman <lars@seas.harvard.edu>
+Mikhail Gusarov <dottedmag@dottedmag.net>
+Olivier Berger <olivier.berger@it-sudparis.eu>
+Rolland Santimano <rollandsantimano@yahoo.com>
+Stewart Smith <stewart@flamingspork.com>
+notmuch@notmuchmail.org
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+generate_message '[from]="Foo Bar <foo.bar@example.com>"'
+generate_message '[from]="Foo Bar <Foo.Bar@Example.Com>"'
+generate_message '[from]="Foo Bar <foo.bar@example.com>"'
+generate_message '[from]="Bar <Foo.Bar@Example.Com>"'
+generate_message '[from]="Foo <foo.bar@example.com>"'
+generate_message '[from]="<foo.bar@example.com>"'
+generate_message '[from]="foo.bar@example.com"'
+generate_message '[from]="Baz <foo.bar+baz@example.com>"'
+generate_message '[from]="Foo Bar <foo.bar+baz@example.com>"'
+generate_message '[from]="Baz <foo.bar+baz@example.com>"'
+notmuch new > /dev/null
+
+test_begin_subtest "--deduplicate=no --output=sender"
+notmuch address --deduplicate=no --output=sender from:example.com | sort >OUTPUT
+cat <<EOF >EXPECTED
+Bar <Foo.Bar@Example.Com>
+Baz <foo.bar+baz@example.com>
+Baz <foo.bar+baz@example.com>
+Foo <foo.bar@example.com>
+Foo Bar <Foo.Bar@Example.Com>
+Foo Bar <foo.bar+baz@example.com>
+Foo Bar <foo.bar@example.com>
+Foo Bar <foo.bar@example.com>
+foo.bar@example.com
+foo.bar@example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "--deduplicate=mailbox --output=sender --output=count"
+notmuch address --deduplicate=mailbox --output=sender --output=count from:example.com | sort -n >OUTPUT
+cat <<EOF >EXPECTED
+1 Bar <Foo.Bar@Example.Com>
+1 Foo <foo.bar@example.com>
+1 Foo Bar <Foo.Bar@Example.Com>
+1 Foo Bar <foo.bar+baz@example.com>
+2 Baz <foo.bar+baz@example.com>
+2 Foo Bar <foo.bar@example.com>
+2 foo.bar@example.com
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "--deduplicate=address --output=sender --output=count"
+notmuch address --deduplicate=address --output=sender --output=count from:example.com | sort -n >OUTPUT
+cat <<EOF >EXPECTED
+3 Baz <foo.bar+baz@example.com>
+7 Foo Bar <foo.bar@example.com>
+EOF
+test_expect_equal_file OUTPUT EXPECTED
+
test_done
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 d2b5d1f5..4ec0ea65 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -9,18 +9,19 @@
test_description='exception symbol hiding'
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
-run_test(){
- result=$(LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" $TEST_DIRECTORY/symbol-test 2>&1)
-}
+test_begin_subtest 'running test' run_test
+mkdir -p ${PWD}/fakedb/.notmuch
+( LD_LIBRARY_PATH="$TEST_DIRECTORY/../lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" \
+ $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent \
+ 2>&1 | sed "s,${PWD},CWD,g") > OUTPUT
-output="A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian'
-caught No chert database found at path \`./nonexistent'"
-
-mkdir -p fakedb/.notmuch
-
-test_expect_success 'running test' run_test
+cat <<EOF > EXPECTED
+A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
+caught No chert database found at path \`CWD/nonexistent'
+EOF
+test_expect_equal_file EXPECTED OUTPUT
test_begin_subtest 'checking output'
test_expect_equal "$result" "$output"
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 3f03a2e3..4726bc36 100755
--- a/test/T390-python.sh
+++ b/test/T390-python.sh
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
test_description="python bindings"
-. ./test-lib.sh
+. ./test-lib.sh || exit 1
+
+test_require_external_prereq ${NOTMUCH_PYTHON}
add_email_corpus
@@ -11,7 +13,7 @@ db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
q_new = notmuch.Query(db, 'tag:inbox')
q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
for t in q_new.search_threads():
- print t.get_thread_id()
+ print (t.get_thread_id())
EOF
notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
test_expect_equal_file OUTPUT EXPECTED
@@ -23,7 +25,7 @@ db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
q_new = notmuch.Query(db, 'tag:inbox')
q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)
for m in q_new.search_messages():
- print m.get_message_id()
+ print (m.get_message_id())
EOF
notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
test_expect_equal_file OUTPUT EXPECTED
@@ -32,7 +34,7 @@ test_begin_subtest "get non-existent file"
test_python <<EOF
import notmuch
db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)
-print db.find_message_by_filename("i-dont-exist")
+print (db.find_message_by_filename("i-dont-exist"))
EOF
test_expect_equal "$(cat OUTPUT)" "None"
diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
new file mode 100755
index 00000000..d5cade8f
--- /dev/null
+++ b/test/T395-ruby.sh
@@ -0,0 +1,86 @@
+#!/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
+fi
+
+add_email_corpus
+
+test_begin_subtest "compare thread ids"
+test_ruby <<"EOF"
+require 'notmuch'
+$maildir = ENV['MAIL_DIR']
+if not $maildir then
+ abort('environment variable MAIL_DIR must be set')
+end
+@db = Notmuch::Database.new($maildir)
+@q = @db.query('tag:inbox')
+@q.sort = Notmuch::SORT_OLDEST_FIRST
+for t in @q.search_threads do
+ print t.thread_id, "\n"
+end
+EOF
+notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "compare message ids"
+test_ruby <<"EOF"
+require 'notmuch'
+$maildir = ENV['MAIL_DIR']
+if not $maildir then
+ abort('environment variable MAIL_DIR must be set')
+end
+@db = Notmuch::Database.new($maildir)
+@q = @db.query('tag:inbox')
+@q.sort = Notmuch::SORT_OLDEST_FIRST
+for m in @q.search_messages do
+ print m.message_id, "\n"
+end
+EOF
+notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "get non-existent file"
+test_ruby <<"EOF"
+require 'notmuch'
+$maildir = ENV['MAIL_DIR']
+if not $maildir then
+ abort('environment variable MAIL_DIR must be set')
+end
+@db = Notmuch::Database.new($maildir)
+result = @db.find_message_by_filename('i-dont-exist')
+print (result == nil)
+EOF
+test_expect_equal "$(cat OUTPUT)" "true"
+
+test_begin_subtest "count messages"
+test_ruby <<"EOF"
+require 'notmuch'
+$maildir = ENV['MAIL_DIR']
+if not $maildir then
+ abort('environment variable MAIL_DIR must be set')
+end
+@db = Notmuch::Database.new($maildir)
+@q = @db.query('tag:inbox')
+print @q.count_messages(),"\n"
+EOF
+notmuch count --output=messages tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "count threads"
+test_ruby <<"EOF"
+require 'notmuch'
+$maildir = ENV['MAIL_DIR']
+if not $maildir then
+ abort('environment variable MAIL_DIR must be set')
+end
+@db = Notmuch::Database.new($maildir)
+@q = @db.query('tag:inbox')
+print @q.count_threads(),"\n"
+EOF
+notmuch count --output=threads tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_done
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..f5cea421 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
@@ -8,6 +8,10 @@ test_begin_subtest "Absolute date range"
output=$(notmuch search date:2010-12-16..12/16/2010 | notmuch_search_sanitize)
test_expect_equal "$output" "thread:XXX 2010-12-16 [1/1] Olivier Berger; Essai accentué (inbox unread)"
+test_begin_subtest "Absolute date range with 'same' operator"
+output=$(notmuch search date:2010-12-16..! | notmuch_search_sanitize)
+test_expect_equal "$output" "thread:XXX 2010-12-16 [1/1] Olivier Berger; Essai accentué (inbox unread)"
+
test_begin_subtest "Absolute time range with TZ"
notmuch search date:18-Nov-2009_02:19:26-0800..2009-11-18_04:49:52-06:00 | notmuch_search_sanitize > OUTPUT
cat <<EOF >EXPECTED
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 c99b17ed..c280939c 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -1,17 +1,7 @@
#!/usr/bin/env bash
test_description="error reporting for library"
-. ./test-lib.sh
-
-backup_database () {
- rm -rf notmuch-dir-backup
- cp -pR ${MAIL_DIR}/.notmuch notmuch-dir-backup
-}
-restore_database () {
- rm -rf ${MAIL_DIR}/.notmuch
- cp -pR notmuch-dir-backup ${MAIL_DIR}/.notmuch
-}
-
+. ./test-lib.sh || exit 1
add_email_corpus
@@ -35,7 +25,7 @@ Error: Cannot open a database for a NULL path.
EOF
test_expect_equal_file EXPECTED OUTPUT
-test_begin_subtest "Open nonexistent database"
+test_begin_subtest "Open relative path"
test_C <<'EOF'
#include <stdio.h>
#include <notmuch.h>
@@ -49,7 +39,43 @@ EOF
cat <<'EOF' >EXPECTED
== stdout ==
== stderr ==
-Error opening database at ./nonexistent/foo/.notmuch: No such file or directory
+Error: Database path must be absolute.
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "Create database in relative path"
+test_C <<'EOF'
+#include <stdio.h>
+#include <notmuch.h>
+int main (int argc, char** argv)
+{
+ notmuch_database_t *db;
+ notmuch_status_t stat;
+ stat = notmuch_database_create ("./nonexistent/foo", &db);
+}
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+== stderr ==
+Error: Database path must be absolute.
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+test_begin_subtest "Open nonexistent database"
+test_C ${PWD}/nonexistent/foo <<'EOF'
+#include <stdio.h>
+#include <notmuch.h>
+int main (int argc, char** argv)
+{
+ notmuch_database_t *db;
+ notmuch_status_t stat;
+ stat = notmuch_database_open (argv[1], 0, 0);
+}
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+== stderr ==
+Error opening database at CWD/nonexistent/foo/.notmuch: No such file or directory
EOF
test_expect_equal_file EXPECTED OUTPUT
@@ -70,21 +96,21 @@ Error: Cannot create a database for a NULL path.
EOF
test_expect_equal_file EXPECTED OUTPUT
-test_begin_subtest "Create database in non-existant directory"
-test_C <<'EOF'
+test_begin_subtest "Create database in nonexistent directory"
+test_C ${PWD}/nonexistent/foo<<'EOF'
#include <stdio.h>
#include <notmuch.h>
int main (int argc, char** argv)
{
notmuch_database_t *db;
notmuch_status_t stat;
- stat = notmuch_database_create ("./nonexistent/foo", &db);
+ stat = notmuch_database_create (argv[1], &db);
}
EOF
cat <<'EOF' >EXPECTED
== stdout ==
== stderr ==
-Error: Cannot create database at ./nonexistent/foo: No such file or directory.
+Error: Cannot create database at CWD/nonexistent/foo: No such file or directory.
EOF
test_expect_equal_file EXPECTED OUTPUT
diff --git a/test/T570-revision-tracking.sh b/test/T570-revision-tracking.sh
new file mode 100755
index 00000000..0936011a
--- /dev/null
+++ b/test/T570-revision-tracking.sh
@@ -0,0 +1,93 @@
+#!/usr/bin/env bash
+test_description="database revision tracking"
+
+. ./test-lib.sh || exit 1
+
+add_email_corpus
+
+test_begin_subtest "notmuch_database_get_revision"
+test_C ${MAIL_DIR} <<'EOF'
+#include <stdio.h>
+#include <string.h>
+#include <notmuch.h>
+int main (int argc, char** argv)
+{
+ notmuch_database_t *db;
+ notmuch_status_t stat;
+ unsigned long revision;
+ const char *uuid;
+
+ unsigned long rev;
+
+ stat = notmuch_database_open (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY, &db);
+ if (stat)
+ fputs ("open failed\n", stderr);
+ revision = notmuch_database_get_revision (db, &uuid);
+ printf("%s\t%lu\n", uuid, revision);
+}
+EOF
+notmuch_uuid_sanitize < OUTPUT > CLEAN
+cat <<'EOF' >EXPECTED
+== stdout ==
+UUID 53
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED CLEAN
+
+grep '^[0-9a-f]' OUTPUT > INITIAL_OUTPUT
+
+test_begin_subtest "output of count matches test code"
+notmuch count --lastmod '*' | cut -f2-3 > OUTPUT
+test_expect_equal_file INITIAL_OUTPUT OUTPUT
+
+test_begin_subtest "modification count increases"
+before=$(notmuch count --lastmod '*' | cut -f3)
+notmuch tag +a-random-tag-8743632 '*'
+after=$(notmuch count --lastmod '*' | cut -f3)
+result=$(($before < $after))
+test_expect_equal 1 ${result}
+
+notmuch count --lastmod '*' | cut -f2 > UUID
+
+test_expect_success 'search succeeds with correct uuid' \
+ "notmuch search --uuid=$(cat UUID) '*'"
+
+test_expect_success 'uuid works as global option ' \
+ "notmuch --uuid=$(cat UUID) search '*'"
+
+test_expect_code 1 'uuid works as global option II' \
+ "notmuch --uuid=this-is-no-uuid search '*'"
+
+test_expect_code 1 'search fails with incorrect uuid' \
+ "notmuch search --uuid=this-is-no-uuid '*'"
+
+test_expect_success 'show succeeds with correct uuid' \
+ "notmuch show --uuid=$(cat UUID) '*'"
+
+test_expect_code 1 'show fails with incorrect uuid' \
+ "notmuch show --uuid=this-is-no-uuid '*'"
+
+test_expect_success 'tag succeeds with correct uuid' \
+ "notmuch tag --uuid=$(cat UUID) +test '*'"
+
+test_expect_code 1 'tag fails with incorrect uuid' \
+ "notmuch tag --uuid=this-is-no-uuid '*' +test2"
+
+test_begin_subtest 'lastmod:0.. matches everything'
+total=$(notmuch count '*')
+modtotal=$(notmuch count lastmod:0..)
+test_expect_equal "$total" "$modtotal"
+
+test_begin_subtest 'lastmod:1000000.. matches nothing'
+modtotal=$(notmuch count lastmod:1000000..)
+test_expect_equal 0 "$modtotal"
+
+test_begin_subtest 'exclude one message using lastmod'
+lastmod=$(notmuch count --lastmod '*' | cut -f3)
+total=$(notmuch count '*')
+notmuch tag +4EFC743A.3060609@april.org id:4EFC743A.3060609@april.org
+subtotal=$(notmuch count lastmod:..$lastmod)
+result=$(($subtotal == $total-1))
+test_expect_equal 1 "$result"
+
+test_done
diff --git a/test/aggregate-results.sh b/test/aggregate-results.sh
index b016edb9..63228546 100755
--- a/test/aggregate-results.sh
+++ b/test/aggregate-results.sh
@@ -82,7 +82,10 @@ if [ "$skipped" != "0" ]; then
echo "$skipped $tests skipped."
fi
-if [ $success -gt 0 -a $fixed -eq 0 -a $failed -eq 0 -a $skipped -eq 0 ]
+# Note that we currently do not consider skipped tests as failing the
+# build.
+
+if [ $success -gt 0 -a $fixed -eq 0 -a $failed -eq 0 ]
then
exit 0
else
diff --git a/test/random-corpus.c b/test/random-corpus.c
index 790193d2..d74271d9 100644
--- a/test/random-corpus.c
+++ b/test/random-corpus.c
@@ -114,6 +114,25 @@ random_utf8_string (void *ctx, size_t char_count)
return buf;
}
+/* stubs since we cannot link with notmuch.o */
+const notmuch_opt_desc_t notmuch_shared_options[] = {
+ { 0, 0, 0, 0, 0 }
+};
+
+char *notmuch_requested_db_uuid = NULL;
+
+void
+notmuch_process_shared_options (unused (const char *dummy))
+{
+}
+
+int
+notmuch_minimal_options (unused (const char *subcommand),
+ unused (int argc),
+ unused (char **argv))
+{
+ return 0;
+}
int
main (int argc, char **argv)
diff --git a/test/symbol-test.cc b/test/symbol-test.cc
index f17ddc85..7454838b 100644
--- a/test/symbol-test.cc
+++ b/test/symbol-test.cc
@@ -3,23 +3,28 @@
#include <xapian.h>
#include <notmuch.h>
+int main (int argc, char** argv)
+{
+ notmuch_database_t *notmuch;
+ char *message = NULL;
-int main() {
- notmuch_database_t *notmuch;
- char *message = NULL;
+ if (argc != 3)
+ return 1;
- if (notmuch_database_open_verbose ("fakedb", NOTMUCH_DATABASE_MODE_READ_ONLY, &notmuch, &message))
- if (message) {
- fputs (message, stderr);
- free (message);
- }
+ if (notmuch_database_open_verbose (argv[1], NOTMUCH_DATABASE_MODE_READ_ONLY,
+ &notmuch, &message)) {
+ if (message) {
+ fputs (message, stderr);
+ free (message);
+ }
+ }
- try {
- (void) new Xapian::WritableDatabase("./nonexistent", Xapian::DB_OPEN);
- } catch (const Xapian::Error &error) {
- printf("caught %s\n", error.get_msg().c_str());
- return 0;
- }
+ try {
+ (void) new Xapian::WritableDatabase (argv[2], Xapian::DB_OPEN);
+ } catch (const Xapian::Error &error) {
+ printf("caught %s\n", error.get_msg().c_str());
+ return 0;
+ }
- return 1;
+ return 1;
}
diff --git a/test/test-lib-common.sh b/test/test-lib-common.sh
index f99ed111..5eb618c1 100644
--- a/test/test-lib-common.sh
+++ b/test/test-lib-common.sh
@@ -34,13 +34,25 @@ find_notmuch_path ()
done
}
+backup_database () {
+ test_name=$(basename $0 .sh)
+ rm -rf notmuch-dir-backup."$test_name"
+ cp -pR ${MAIL_DIR}/.notmuch notmuch-dir-backup."${test_name}"
+}
+
+restore_database () {
+ test_name=$(basename $0 .sh)
+ rm -rf ${MAIL_DIR}/.notmuch
+ cp -pR notmuch-dir-backup."${test_name}" ${MAIL_DIR}/.notmuch
+}
+
# Test the binaries we have just built. The tests are kept in
# test/ subdirectory and are run in 'trash directory' subdirectory.
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 486d1c43..126911fb 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 &&
@@ -487,7 +488,7 @@ emacs_deliver_message ()
(message-goto-body)
(insert \"${body}\")
$@
- (message-send-and-exit))"
+ (notmuch-mua-send-and-exit))"
# In case message was sent properly, client waits for confirmation
# before exiting and resuming control here; therefore making sure
@@ -522,7 +523,7 @@ emacs_fcc_message ()
(message-goto-body)
(insert \"${body}\")
$@
- (message-send-and-exit))" || return 1
+ (notmuch-mua-send-and-exit))" || return 1
notmuch new >/dev/null
}
@@ -621,9 +622,9 @@ test_expect_equal_json () {
# The test suite forces LC_ALL=C, but this causes Python 3 to
# decode stdin as ASCII. We need to read JSON in UTF-8, so
# override Python's stdio encoding defaults.
- output=$(echo "$1" | PYTHONIOENCODING=utf-8 python -mjson.tool \
+ output=$(echo "$1" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
|| echo "$1")
- expected=$(echo "$2" | PYTHONIOENCODING=utf-8 python -mjson.tool \
+ expected=$(echo "$2" | PYTHONIOENCODING=utf-8 $NOTMUCH_PYTHON -mjson.tool \
|| echo "$2")
shift 2
test_expect_equal "$output" "$expected" "$@"
@@ -719,6 +720,11 @@ notmuch_date_sanitize ()
sed \
-e 's/^Date: Fri, 05 Jan 2001 .*0000/Date: GENERATED_DATE/'
}
+
+notmuch_uuid_sanitize ()
+{
+ sed 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/UUID/g'
+}
# End of notmuch helper functions
# Use test_set_prereq to tell that a particular prerequisite is available.
@@ -1153,14 +1159,13 @@ test_python() {
export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
export PYTHONPATH=$TEST_DIRECTORY/../bindings/python
- # Some distros (e.g. Arch Linux) ship Python 2.* as /usr/bin/python2,
- # most others as /usr/bin/python. So first try python2, and fallback to
- # python if python2 doesn't exist.
- cmd=python2
- [[ ${test_missing_external_prereq_[python2]} == t ]] && cmd=python
-
(echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \
- | $cmd -
+ | $NOTMUCH_PYTHON -
+}
+
+test_ruby() {
+ export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
+ MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
}
test_C () {
@@ -1224,14 +1229,14 @@ test_init_ () {
}
-. ./test-lib-common.sh
+. ./test-lib-common.sh || exit 1
emacs_generate_script
# Use -P to resolve symlinks in our working directory so that the cwd
# in subprocesses like git equals our $PWD (for pathname comparisons).
-cd -P "$test" || error "Cannot setup test environment"
+cd -P "$test" || error "Cannot set up test environment"
if test "$verbose" = "t"
then
@@ -1320,5 +1325,4 @@ test_declare_external_prereq emacs
test_declare_external_prereq ${TEST_EMACSCLIENT}
test_declare_external_prereq gdb
test_declare_external_prereq gpg
-test_declare_external_prereq python
-test_declare_external_prereq python2
+test_declare_external_prereq ${NOTMUCH_PYTHON}
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" &&