Commit graph

788 commits

Author SHA1 Message Date
Jani Nikula
dc20a0eedc cli/insert: require succesful message indexing for success status
Add --keep option to keep any remaining stuff in index or file. We
could distinguish between failures to index and failures to apply tags
or maildir sync, but for simplicity just have one.
2014-10-18 07:54:25 +02:00
David Bremner
a6cee01b4e test/insert: add known broken tests for indexing failures
These tests are written with the assumption that we want all indexing
failures to be considered as failures by notmuch insert.
2014-10-18 07:51:18 +02:00
Austin Clements
cbbda62258 test: Port atomicity test to Python
Previously, this was implemented using a horrible GDB script (because
there is no such thing as a non-horrible GDB script).  This GDB script
often broke with newer versions of GDB for mysterious reasons.  Port
the test script to GDB's Python API, which makes the code much cleaner
and, hopefully, more stable.
2014-10-05 07:29:18 +02:00
David Bremner
68dd804544 configure: add debug flags by default.
This makes development (in particular the test suite) easier. Those
concerned about the extra diskspace can override the default or use
strip.
2014-10-05 07:27:49 +02:00
David Bremner
5916c4634c test: check for debug symbols in notmuch
In the future, tests may rely on debug symbols being present in
notmuch, so we plan to switch the default flags.

The main purpose of this test is to help explain the perhaps
mysterious failures of other tests which rely on symbols being
present.
2014-10-05 07:24:56 +02:00
Austin Clements
5673fdbdfa emacs: Fix coding system in `notmuch-show-view-raw-message'
This fixes the known-broken test of viewing 8bit messages added by the
previous commit.
2014-09-21 21:23:45 +02:00
Austin Clements
f4cdabccd0 test: New tests for Emacs charset handling
The test of viewing 8bit messages is known-broken.  The rest pass, but
for very fragile reasons.  The next several commits will fix the
known-broken test and make our charset handling robust.
2014-09-21 21:23:45 +02:00
David Bremner
b489267701 test/emacs: globally force the html renderer to html2text
Previously we did this for a single test, but some other proposed
tests ( id:1398105468-14317-3-git-send-email-amdragon@mit.edu ) show
similar breakage when switching renderers.
2014-09-21 21:12:52 +02:00
David Bremner
c34d6bad0f test: simplify T360-symbol-hiding, use nm instead of objdump
After yet another variation in objdump output caused this test to fail
(on a Debian port, no less), I decided whatever putative benefit we
get from looking at the object files instead of the library isn't
worth the maintenence headache.

This version uses nm -P. nm -P should be portable, and fixed format.
It purposely doesn't use the -D argument, since that is non-POSIX and
nm on GNU/Linux seems do the right thing without it.

It still won't work out of the box on e.g. Mac OS/X. I think the right
thing to do there is to move some more configuration information into
sh.config.
2014-09-13 08:49:50 +02:00
Austin Clements
3d39d346d7 cli: Be more helpful when .notmuch-config does not exist
Previously, if the user ran any subcommand that required a
configuration (e.g., notmuch new) but didn't have a configuration,
notmuch would give the rather un-friendly and un-actionable message

  Error reading configuration file .notmuch-config: No such file or directory

Since this condition is expected for new users, this patch adds
specific handling for the file-not-found case to give a message that
is friendly and actionable.
2014-09-07 20:01:01 +02:00
Austin Clements
7876bd72af test: Tests for future version and unknown feature handling 2014-08-30 10:44:17 -07:00
Austin Clements
d06adc52e0 test: Tool to build DB with specific version and features
This will let us test basic version and feature handling.
2014-08-30 10:43:46 -07:00
Austin Clements
344e4c65a4 new: Don't report version after upgrade
The version number has always been pretty meaningless to the user and
it's about to become even more meaningless with the introduction of
"features".  Hopefully, the database will remain on version 3 for some
time to come; however, the introduction of new features over time in
version 3 will necessitate upgrades within version 3.  It would be
confusing if we always tell the user they've been "upgraded to version
3".  If the user wants to know what's new, they should read the news.
2014-08-30 10:40:41 -07:00
Michal Sojka
028c56061e Make parsing of References and In-Reply-To header less error prone
According to RFC2822 References and In-Reply-To headers are supposed
to contain one or more Message-IDs, however older RFC822 allowed
almost any content. When both References and In-Reply-To headers ends
with something else that a Message-ID (see e.g. [1]), the thread
structure presented by notmuch is incorrect. The reason is that
notmuch treats this case as if the email contained no "replyto"
information (see _notmuch_database_link_message_to_parents).

This patch changes the parse_references() function to return the last
valid Message-ID encountered rather than NULL resulting from the last
hunk of text not being the Message-ID.

[1] https://lkml.org/lkml/headers/2014/5/19/864
2014-08-16 17:45:16 -07:00
Michal Sojka
61993923b4 Add test for incorrect threading of messages
This happens when there is some garbage after the last Message-ID in
the References header. See for example
https://lkml.org/lkml/headers/2014/5/19/864.
2014-08-16 17:45:07 -07:00
Austin Clements
c95a398deb test: Include generated dependencies for test sources
Previously the build system was generating automatic header
dependencies for test sources, but only smtp-dummy was in SRCS, so
only its dependencies were being included.  Add all of the test
sources to SRCS so that the root Makefile.local includes their
dependencies.
2014-08-06 09:56:25 -03:00
Austin Clements
e501a16e71 emacs: Expand default saved searches and add shortcut keys
This should help new users off to a better start with the addition of
more sensible saved searches and default shortcut keys.  Most existing
users have probably customized this variable and won't be affected.
2014-08-05 08:07:52 -03:00
Mark Walters
bbbdf0478e dump: make dump take Xapian write lock
Dump currently only takes the read lock. Xapian can cope with some
changes while maintaining a read snapshot but with more changes it
fails. Currently notmuch just gives a xapian error.

To avoid this we take the write lock when dumping. This prevents other
notmuch processes from modifying the xapian database preventing this
error.

Discussion with Olly on irc indicates that this is currently the best
solution: in xapian trunk there may be better possibilities using
snapshots but they need to make it to a release and propogate out to
users before we can switch approach.

Finally, this breaks one use case: pipelines of the form

notmuch dump | ... | notmuch restore

According to Olly this is already very fragile: it will only work on
small databases. One of the tests relies on this behaviour so fix that
to store the dump rather than use a pipe.
2014-07-16 19:33:10 -03:00
Austin Clements
c2bbe9eb6c test: Test thread linking in all possible delivery orders
These tests deliver all possible (single-root) four-message threads in
all possible orders and check that notmuch successfully links them
into threads.  These tests supersede and replace the previous and much
less thorough "T260-thread-order" tests.

There are two variants of the test: one delivers messages that
reference only their immediate parent and the other delivers messages
that reference all of their parents.  The latter test is currently
known-broken.
2014-07-16 07:08:02 -03:00
David Bremner
de262a2026 test: redirect gdb output to a file.
It seems that the normal output redirection in the test suite doesn't
work for gdb, but it's nice to have output in a file for debugging.
2014-07-13 12:36:49 -03:00
David Bremner
eed6c75556 test: make test_emacs call post-command-hook
The unread/read changes will use the post-command-hook. test_emacs
does not call the post-command-hook. This adds a notmuch-test-progn
which takes a list of commands as argument and executes them in turn
but runs the post-command-hook after each one.

The caller can batch operations (ie to stop post-command-hook from
being interleaved) by wrapping the batch of operations inside a progn.

We also explicitly run the post-command-hook before getting the output
from a test; this makes sense as this will be a place the user would
be seeing the information.
2014-07-13 12:33:53 -03:00
Jani Nikula
c2d8236b56 test: use sh.config for configuration 2014-07-13 12:16:06 -03:00
David Bremner
cc2722ba9e Merge branch 'release'
Austin's termpos patches and Felipe's zlib.pc workaround
2014-06-22 06:53:21 -03:00
Austin Clements
dc64ab6720 lib: Separate all phrases indexed by _notmuch_message_gen_terms
This adds a 100 termpos gap between all phrases indexed by
_notmuch_message_gen_terms.  This fixes a bug where terms from the end
of one header and the beginning of another header could match together
in a single phrase and a separate bug where term positions of
un-prefixed terms overlapped.

This fix only affects newly indexed messages.  Messages that are
already indexed won't benefit from this fix without re-indexing, but
the fix won't make things any worse for existing messages.
2014-06-18 18:03:18 -03:00
Austin Clements
c1805576a0 test: Known-broken test for overlapping/adjacent termpos
This adds two known-broken tests and one working test related to the
term positions assigned to terms from different headers or MIME parts.
The first test fails because we don't create a termpos gap between
different headers.  The second test fails because we don't adjust
termpos at all when indexing multiple parts.
2014-06-18 17:56:52 -03:00
Austin Clements
44327ca86d lib: Index name and address of from/to headers as a phrase
Previously, we indexed the name and address parts of from/to headers
with two calls to _notmuch_message_gen_terms.  In general, this
indicates that these parts are separate phrases.  However, because of
an implementation quirk, the two calls to _notmuch_message_gen_terms
generated adjacent term positions for the prefixed terms, which
happens to be the right thing to do in this case, but the wrong thing
to do for all other calls.  Furthermore, _notmuch_message_gen_terms
produced potentially overlapping term positions for the un-prefixed
copies of the terms, which is simply wrong.

This change indexes both the name and address in a single call to
_notmuch_message_gen_terms, indicating that they should be part of a
single phrase.  This masks the problem with the un-prefixed terms
(fixing the two known-broken tests) and puts us in a position to fix
the unintentionally phrases generated by other calls to
_notmuch_message_gen_terms.
2014-06-18 17:55:14 -03:00
Austin Clements
b547830783 test: Add search tests for combined name/address queries
Two of these are currently known-broken.  We index the name and
address parts in two separate calls to _notmuch_message_gen_terms.
Currently this has the effect of placing the term positions of the
prefixed terms from the second call right after those of the first
call, but screws up the term positions of the non-prefixed terms.
2014-06-18 17:54:05 -03:00
Austin Clements
8a443121c6 test: Fix from/to search test queries
Two of the search tests for "from" and "to" queries were clearly
trying to search for prefixed phrases, but forgot to shell quote the
phrases.  Fix this by quoting them correctly.
2014-06-18 17:53:29 -03:00
David Bremner
44e6c52c76 Merge branch 'release'
Merge in a few more commits towards 0.18.1
2014-06-13 23:03:49 -03:00
Jani Nikula
0cc0144875 lib: resurrect support for single-message mbox files
This is effectively a revert of

commit 6812136bf5
Author: Jani Nikula <jani@nikula.org>
Date:   Mon Mar 31 00:21:48 2014 +0300

    lib: drop support for single-message mbox files

The intention was to drop support for indexing new single-message mbox
files (and whether that was a good idea in the first place is
arguable). However this inadvertently broke support for reading
headers from previously indexed single-message mbox files, which is
far worse.

Distinguishing between the two cases would require more code than
simply bringing back support for single-message mbox files.
2014-06-13 22:59:04 -03:00
David Bremner
2d722bf032 test: use --quick when starting emacs.
At least in emacs24, this removes the "site-lisp" directories from the
load path in addition to enforcing --no-site-lisp --no-init-file.

This works around a slightly mysterious bug on Debian that causes
test-lib.el not to load when there is cl-lib.el(c) in some site-lisp
directory.  It should be harmless in general since we really don't
want to load any files from addon packages to emacs.
2014-06-13 22:55:14 -03:00
David Bremner
fe8cd90f97 build: add dataclean
It turns out to be inconvenient to delete the downloaded datafiles with
distclean, so I propose a new target which does that instead.

The closest conventional target is 'maintainer-clean'; the difference
here is that having the original source tarball is not enough to
reconstruct these files.
2014-05-28 09:52:10 -03:00
David Bremner
c67587f003 Merge branch 'release'
bugfix release being built up on release.
2014-05-18 06:37:48 +09:00
David Bremner
a33ec9ce40 test: allow pending break points in atomicity script.
This seems to fix problems with the symbol rename not being defined
at startup on at least OS/X and some Debian Linux architectures.
2014-05-18 06:32:14 +09:00
Charles Celerier
ca34ac1440 test/Makefile.local: Added configured TALLOC_LDFLAGS.
The linking to talloc is hard-coded in the testing Makefile. This patch
causes the linking to talloc to be done according to how TALLOC_LDFLAGS
was configured.

Signed-off-by: Charles Celerier <cceleri@cs.stanford.edu>
2014-05-18 06:31:55 +09:00
Jani Nikula
17234aecc3 test: add have-man and have-compact in test/.gitignore
Sort the file while at it.
2014-05-03 05:49:13 +09:00
David Bremner
320f86c30a test: use test_expect_equal for PATH test, update message
- The old test was quite impossible to debug; the new one shows the difference
  between the two directories, if any.

- "repository" doesn't make sense for out of tree builds. Or tarball
  builds, for that matter.
2014-04-18 07:53:57 +09:00
David Bremner
b8327ab483 test: verify tag backup generated by database upgrade
'pre upgrade dump' is not much of a test, but at least this way we get
somewhat sensible behaviour if it fails.
2014-04-12 07:59:44 -03:00
David Bremner
a7eaa4d84a notmuch-new: backup tags before database upgrade
All we do here is calculate the backup filename, and call the existing
dump routine.

Also take the opportunity to add a message about being safe to
interrupt.
2014-04-12 07:59:44 -03:00
David Bremner
4c62d9366a restore: transparently support gzipped input
We rely completely on zlib to do the right thing in detecting gzipped
input. Since our dump format is chosen to be 7 bit ascii, this should
be fine.
2014-04-12 07:59:44 -03:00
David Bremner
de71c4d734 test: restore with missing final newline
Recent proposed patches for gzipped input had a bug with handling
missing newlines that was not caught by the current test suite
2014-04-12 07:59:44 -03:00
David Bremner
3c13bc0321 dump: support gzipped and atomic output
The main goal is to support gzipped output for future internal
calls (e.g. from notmuch-new) to notmuch_database_dump.

The additional dependency is not very heavy since xapian already pulls
in zlib.

We want the dump to be "atomic", in the sense that after running the
dump file is either present and complete, or not present.  This avoids
certain classes of mishaps involving overwriting a good backup with a
bad or partial one.
2014-04-12 07:59:44 -03:00
Jani Nikula
6812136bf5 lib: drop support for single-message mbox files
We've supported mbox files containing a single message for historical
reasons, but the support has been deprecated, with a warning message
while indexing, since Notmuch 0.15. Finally drop the support, and
consider all mbox files non-email.
2014-04-05 12:52:42 -03:00
Jani Nikula
d7d728a622 test: conditionally test help system depending on configured support
If neither sphinx nor rst2man is available, the notmuch man pages will
not be available. Take this into account in the help system test.
2014-03-26 07:43:36 -03:00
Austin Clements
92c3fd938e emacs: Use whitelist instead of blacklist for term escaping
Previously, the term escaper used a blacklist of characters that
needed escaping.  This blacklist turned out to be somewhat incomplete;
for example, it did not contain non-whitespace ASCII control
characters or Unicode "fancy quotes", both of which do require the
term to be escaped.

Switch to a whitelist of characters that are definitely safe to leave
unquoted.  This fixes the broken test introduced by the previous
patch.
2014-03-25 19:57:06 -03:00
Austin Clements
716af7deb8 test: Add broken test for Emacs boolean term escaping
The current term escaper gets most of these right, but fails to escape
things containing Unicode "fancy quotes" or things containing
non-whitespace control characters.
2014-03-25 19:50:47 -03:00
Jani Nikula
d647a19173 test: conditionally test compact depending on configured support
I still have one machine with old enough Xapian to not have compaction
support. Make the tests check for unsupported compact operation when
compact is not available.
2014-03-25 18:51:06 -03:00
David Bremner
68c2c5d31c test: use $(srcdir) instead of . as include path
This is needed for out of tree builds. The functional change is the
modification of extra_cflags; the other changes are cosmetic.
2014-03-25 08:32:10 -03:00
Mark Walters
941e172724 emacs: show: mark tags changed since buffer loaded
This allows (and requires) the original-tags to be passed along with
the current-tags to be passed to notmuch-tag-format-tags. This allows
the tag formatting to show added and deleted tags.By default a removed
tag is displayed with strike-through in red (if strike-through is not
available, eg on a terminal, inverse video is used instead) and an
added tag is displayed underlined in green.

If the caller does not wish to use the new feature it can pass
current-tags for both arguments and, at this point, we do exactly that
in the three callers of this function.

Note, we cannot tidily allow original-tags to be optional because we would
need to distinguish nil meaning "we are not specifying original-tags"
from nil meaning there were no original-tags (an empty list).

We use this in subsequent patches to make it clear when a message was
unread when you first loaded a show buffer (previously the unread tag
could be removed before a user realised that it had been unread).

The code adds into the existing tag formatting code. The user can
specify exactly how a tag should be displayed normally, when deleted,
or when added.

Since the formatting code matches regexps a user can match all deleted
tags with a ".*" in notmuch-tag-deleted-formats.  For example setting
notmuch-tag-deleted-formats to '((".*" nil)) tells notmuch not to show
deleted tags at all.

All the variables are customizable; however, more complicated cases
like changing the face depending on the type of display will require
custom lisp.

Currently this overrides notmuch-tag-deleted-formats for the tests
setting it to '((".*" nil)) so that they get removed from the display
and, thus, all tests still pass.
2014-03-24 19:48:04 -03:00
David Bremner
533639b143 doc: build man pages into hierarchy, fix help test.
It turns out there was a reason the old man pages were stored in a man
compatible hierarchy, namely so that we could run man on them before
installing.

Hardcode doc build location into test suite.  This isn't ideal, but
let's unbreak the test suite for now.
2014-03-18 07:39:12 -03:00
David Bremner
8413582b6e test: add machinery to download and verify databases
Note that it is intentional that the checksum file is not
downloaded. The intent is to check those into git.
2014-03-11 19:51:22 -03:00
David Bremner
b660642101 test: commit database checksum, ignore actual databases
The checksum file is used by the test infrastructure to verify the downloaded
test database is the one we had in mind.  Note that this test is
rather strict, and the the checksum file needs to be recommitted when
the database is regenerated.

add a pattern .gitignore to ignore the actual databases
2014-03-11 19:51:22 -03:00
Jani Nikula
50345d1263 test: add database upgrade test from format version 1 to 2
Test the upgrade from probabilistic to boolean folder: terms, and
addition of path: terms.

The test depends on the pre-built test corpus and database tarball and
checksum file being in place. If it's not, the test is skipped. The
mechanism to fetch the test database will be added later.

At the time of writing, a working test database and checksum file is
available at

   http://notmuchmail.org/releases/test-databases/

It has been noted that some non-GNU environments make lack
sha256sum. We leave this portability issue for a followup patch.
2014-03-11 19:51:22 -03:00
Jani Nikula
f93fab3683 test: add tests for the new boolean folder: and path: prefixes
Additional tests for the boolean folder: and path: prefixes using the
full corpus.
2014-03-11 19:51:22 -03:00
Jani Nikula
1fa8e40561 lib: make folder: prefix literal
In xapian terms, convert folder: prefix from probabilistic to boolean
prefix, matching the paths, relative from the maildir root, of the
message files, ignoring the maildir new and cur leaf directories.

folder:foo matches all message files in foo, foo/new, and foo/cur.

folder:foo/new does *not* match message files in foo/new.

folder:"" matches all message files in the top level maildir and its
new and cur subdirectories.

This change constitutes a database change: bump the database version
and add database upgrade support for folder: terms. The upgrade also
adds path: terms.

Finally, fix the folder search test for literal folder: search, as
some of the folder: matching capabilities are lost in the
probabilistic to boolean prefix change.
2014-03-11 19:51:22 -03:00
Jani Nikula
2a865351dd test: make insert test use the path: prefix
This is a more strict test for the insert test.
2014-03-11 19:51:22 -03:00
Jani Nikula
ded713c39d test: rearrange the test corpus into subfolders, fix tests
We will need this for improved folder search tests, but having some
folders should exercise our code paths better anyway.

Modify the relevant test accordingly to make it pass.

This reorganization triggers a bug in the test suite, namely that it
expects the output of --output=files to be in a certain order. So we
add the fix for that into the same commit.

This mainly involves sorting, although the case --duplicate=$n
requires more subtlety.
2014-03-11 19:50:12 -03:00
Jani Nikula
7630f300ba test: add notmuch_search_files_sanitize and use it
We do this in a lot of places, so make it a helper in the test-lib.
2014-03-11 19:22:52 -03:00
David Bremner
8c37821a0d test: add utility function to sort a json list
So far we only need this one place, but it's a bit messy to inline
2014-03-11 19:22:52 -03:00
Jani Nikula
6d0a17c46e cli: sanitize tabs and newlines to spaces in notmuch search
Sanitize tabs and newlines to spaces rather than question marks in
--output=summary --format=text output.

This will also hide any difference in unfolding a header that has been
folded with a tab. Our own header parser replaces tabs with spaces,
while gmime would retain the tab.
2014-03-09 10:12:52 -03:00
Tomi Ollila
e79d2fc993 support for generating decreasing dates in bash 4.0 and 4.1
The printf builtin "%(fmt)T" specifier (which allows time values
to use strftime-like formatting) is introduced in bash 4.2.

Trying to execute this in pre-4.2 bash will fail -- and if this
happens execute the fallback piece of perl code to do the same thing.
2014-03-09 10:09:51 -03:00
Tomi Ollila
d8ba7bee7d test: NOTMUCH_SKIP_TESTS accepts test names with or without Tddd- prefix
The test names assigned to NOTMUCH_SKIP_TESTS variable can now be given
with or without the Tddd- prefix for tester convenience:

The test name without Tddd -prefix stays constant even when test filenames
are renumbered.

The test name with Tddd -prefix is printed out when tests run.
2014-03-09 10:09:26 -03:00
David Bremner
b21f0f6802 test: don't use $(dir) in recipes.
According the semantics of make, the expansion of $(dir) in recipes
uses dynamic scope, i.e. the value at the time the recipe is run. This
means if test/Makefile.local is not the last sub-makefile included,
all heck breaks loose.
2014-03-09 10:02:57 -03:00
Austin Clements
81ede90597 test: Print the number of the test along with its name
Previously, we stripped the "Tnnn-" part from the test name when
printing its description at the beginning of each test.  However, this
makes it difficult to find the source script for a test (e.g., when a
test fails).  Put this prefix back.
2014-03-06 07:46:48 -04:00
Jani Nikula
07fdac912f test: add tests for invalid new.tags
Similar tests for both notmuch new and insert.
2014-03-06 07:42:37 -04:00
Austin Clements
c0cc47506f test: Simplify CLEAN list construction
Construct as much of the CLEAN list from TEST_BINARIES as possible,
rather than duplicating this information by hand.
2014-02-25 20:53:54 -04:00
Jed Brown
718d58ade0 emacs: update alist for mail-archive.com API change
Searching by Message-Id no longer works via the old mail-archive.com
API, though I have contacted them in hopes that they restore it to
prevent dead links.  Anyway, the new API is cleaner.

Acked-by: Austin Clements <amdragon@MIT.EDU>
2014-02-16 18:55:24 -04:00
Jani Nikula
3e1d7f6476 test: add basic tests for notmuch new --quiet option
This does not cover all the possible paths notmuch new could output
stuff, but it's better than nothing.
2014-01-27 08:42:08 -04:00
David Bremner
ecbb29e8ce notmuch-show: detect NULL pointer returned from notmuch_query_search_threads
We want to return an error status, not 0 or (worse) segfault.
2014-01-24 20:24:11 -04:00
David Bremner
5c526d1737 test: add known broken test exit code of notmuch show
This test catches a segfault on a syntactically invalid query. It also
catches a problem with my initial fix, which still returned 0.
2014-01-24 20:19:50 -04:00
Tomi Ollila
86e24eab8a test: leave T\d\d\d- in variable $this_test and introduce $this_test_bare
Script `notmuch-test` expects the results file have T\d\d\d- part
intact so the results files (and some test output files) are now
name as such.
Without this change `notmuch-test` will exit in case the test
script it was executing exited with nonzero value.

The T\d\d\d- part is dropped in new variable $this_test_bare which is
used in progress informational messages and when loading .el files in
emacs tests (whenever $this_test_bare.el exists).
2014-01-18 14:40:11 -04:00
David Bremner
ae47d617a7 test: add test for syntax of emacs test library
If there is a syntax error in the emacs test library, it causes other
tests to hang or crash without a useful error message.

This test could be eliminated if the error reporting for emacs tests
was somehow improved.
2014-01-13 14:31:15 -04:00
Tomi Ollila
a755c9d6a9 test: renamed test scripts to format T\d\d\d-name.sh
All test scripts to be executed are now named as T\d\d\d-name.sh,
numers in increments of 10.

This eases adding new tests and developers to see which are test scripts
that are executed by test suite and in which order.
2014-01-13 14:16:46 -04:00
Tomi Ollila
84719b08f7 test: basic: drop 'ensure all available tests are run'
When naming test scripts in format 'T\d\d\d-name.sh' the list of
tests to run are created dynamically. This makes test

'Ensure that all available tests will be run by notmuch-test'

in test/basic obsolete.
2014-01-13 14:16:35 -04:00
Mark Walters
719391f09a emacs: tree remove comma separator tags
Previously the tags on each line in tree view were separarted by ", "
not just " ". This is different from show and search views.

This patch removes this comma. This is a large patch as essentially
every line of each of the expected outputs in the tree tests needs
updating.

Apart from aesthetic reasons this simplifies the switch to
notmuch-tag-format-tags in the next patch.
2014-01-13 14:12:29 -04:00
David Bremner
79b6b0190b uploaded to Debian unstable
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.15 (GNU/Linux)
 
 iQGcBAABCAAGBQJS0yuYAAoJEPIClx2kp54s6HAL/RbxzE1sHhjRHwq8j2aTskGZ
 Qd02bgQSxJN2eIE1SzTc0XKCJkY13R1ZZ0cEgsgrBQg9OIlyYFZYcReD6Cg0CFUk
 BGH+RSrfULMuzo2Q9c69JkpVJXPOBl0Jp37a91+a3WwbCZSFNaxRqSWLaqt7ZYJW
 ucYWPHAo32c7Fwe+4obXXzoB7ZClDCyv/3R4EZ93gTUbePKKRSs3MUGv81v0HBXF
 jgdZuUs63b8eGJyFyWazOY6mlenCB9tS2UwcSnRl2JzWcxfPk/2HEhKUs8DAwwc1
 pa14uwzCNYyxlYPUJnyt8aoFZC9/YIgxlA8emrUEgnSyBDoRupO1g9RP/CRtzs1X
 92g/asrq6lKIziU0mx9qGp+Dm4++SfU7OekTamSYTKCsqrKHBbe1KavG6SGUzIto
 BZ6g/QXdpGuPvYfBRs51kzLnl9+IP9lTHGiD4u/Njz9GcCA5PuIq4Vygwmi3vF1r
 RApE3d8QpkNcLSKzuR9Kb7N3N2OWbqNJCuArNsvxJw==
 =Y3L3
 -----END PGP SIGNATURE-----

Merge tag 'debian/0.17-3'

uploaded to Debian unstable
2014-01-12 19:56:25 -04:00
David Bremner
b4f3be53c8 test/emacs: replace the use of process-attributes with signal-process
In some environments (at least Hurd), process-attributes is
unimplimented and always returns nil.  This ends up causing test
failures (see e.g. id:87a9ffofsc.fsf@zancas.localnet).

Historically and according to POSIX 1003.1-2001, a signal of 0 can be
used to check the validity of a pid. This seems less heinous than
parsing the output of ps(1).
2014-01-12 17:08:14 -04:00
Jani Nikula
58dfc87721 insert: respect maildir.synchronize_flags
Don't synchronize maildir flags if the user doesn't want it.
2014-01-03 07:13:00 -04:00
Jani Nikula
b00a62b3d9 test: notmuch insert with maildir.synchronize_flags=false
Known broken, notmuch insert does not respect the config option.
2014-01-03 07:12:47 -04:00
Mark Walters
191f41cfec test: tree: pick remnants removed
Some no longer needed traces of pick remain in the emacs-tree
test. Remove these.
2014-01-03 07:12:08 -04:00
David Bremner
47b9314eee notmuch 0.17~rc4 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.15 (GNU/Linux)
 
 iQGcBAABCAAGBQJSv30MAAoJEPIClx2kp54s5KcL+wX3z4NjIOKcTUVEUI0A97JK
 RaGpm+TNSJjfiJSwzDPLm93S7Q+DGfPPTuAWUL69fJlDYvGRRlZfsVSLTq/YLPOz
 cfz9laTp+gqEF9aDGCa/1vZdfmP6ojXOvm24LiRo/LGS9t6OQUts4Ia1zzsNzFJT
 hBblll2sk21c//biD8wLfBj6vKwXNmQAiNiPl1sYbhGjTSPe1pnvPoe4DuhJHk5A
 +V6bq8xRGMGRDayOCsYDoKlYT89IlcHAFQLQiaxNJQ+diopNsK2w4rWJhQr9xkvV
 Ps9wySt48Smlw4wkDUswiBy8K9xrnVZ/pKPzCl4M/ObLBgYXD2Z6m8el+3KKXVk3
 i9PUyrjtaUURvtZJphTdCPX8qr4DMWPhf0hmOH8AO7BpVG9DAXkB3GBEI9Gy/9yR
 RaeuJEYIO8EbQ3cX8bQexU+ZzQTohZyBVSj5BuRgHzFrySGhRSxzb4W1ESqieEiS
 b6/71t/8WH1K3WPol2HeId38BGC6X8J6mnVINfbGeA==
 =z/ep
 -----END PGP SIGNATURE-----

Merge tag '0.17_rc4'

notmuch 0.17~rc4 release
2013-12-28 21:45:19 -04:00
Austin Clements
ef7b77ea3b test: Fix transient error in 'new' test
This fixes a non-deterministic failure in "Ignore files and
directories specified in new.ignore (multiple occurrences)".  The test
assumed that all directories would be scanned, even though nothing
updated the mtime of ${MAIL_DIR}.  It *usually* worked nevertheless
because the tests run quickly enough that the directory mtime is
usually the same as the current time, so notmuch new does not update
the mtime in the database (because more changes could occur in the
same second).  However, when it occasionally did update the mtime in
the database, the notmuch new call in this test would (correctly) skip
"pass 2" of scanning ${MAIL_DIR}, causing it to skip the following
expected lines:

  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/.git
  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/.ignored_hidden_file
  (D) add_files_recursive, pass 2: explicitly ignoring ${MAIL_DIR}/ignored_file

This patch fixes this problem by touching ${MAIL_DIR} to ensure it
gets scanned and by rearranging the test to ensure the directories are
touched immediately before the main notmuch new call in the test.
2013-12-28 09:19:51 -04:00
David Bremner
30cde97ba8 test: remove call to notmuch-hello from emacs_deliver_message
There is an obscure bug in notmuch-hello that very occasionally causes
emacs_deliver_message to fail. Since it it doesn't serve any actual
purpose in the function we delete it, and leave tracking down the the
bug for another day.
2013-12-22 20:44:45 +08:00
David Bremner
513a36d105 test: add emacs_fcc_message that does not use smtp-dummy
Most of the tests previously using emacs_deliver_message do not use
the actual transmitted message, so we replace it with a simpler (and
presumably more reliable function) that only saves (and indexes) an
fcc copy of the message.
2013-12-22 20:44:44 +08:00
Tomi Ollila
88e6a2995a test: implement and document NOTMUCH_TEST_QUIET variable usage
When NOTMUCH_TEST_QUIET environment variable is set to non-null value
messages when new test script starts and when test PASSes are disabled.
This eases picking the cases when tests FAIL (as those are still printed).
2013-12-09 23:29:11 +08:00
Tomi Ollila
f05e7f3ce5 test: print empty line at the beginning of test script, not at end
In preparation for quiet mode print empty line before writing the
test description. This is done now in function designed for it --
it will also be called when test fails.
2013-12-09 23:25:41 +08:00
Tomi Ollila
5985438e05 test: resolve basename "$0" .sh once for all in test-lib.sh
test-lib.sh sometimes did equivalent of `basename "$0" .sh`, sometimes
skipping the basename part and sometimes .sh part. This worked as
we never had path components in $0 (more than ./) nor .sh ending.

Now the equivalent of `basename "$0" .sh` is done once and used
everywhere. In the future we may have .sh suffix in test names
-- removing those is a good idea.
2013-12-09 23:25:28 +08:00
David Bremner
b421f00a05 test: give unique timestamps to messages
The choice of decreasing timestamps is a hack which reduces the number
of existing tests which fail.  This can be changed to increasing
if/when somebody wants update another 47 tests.
2013-12-09 21:20:28 +08:00
David Bremner
72ff135ac3 test: sanitize dates in emacs, raw, and text output
add a new function notmuch_date_sanitize for rfc822-ish things. Add
date sanitization to notmuch_show_sanitize_all and use it more places.

This is all in aid of a transition to unique timestamps on messages.
2013-12-09 21:20:27 +08:00
David Bremner
18921be2e9 test: sanitize Date and timestamp fields in json
Eventually we want test messages to have distinct dates to avoid
reproducability problems. This sanitization will prevent some test
failures when that change is made.

Replace the use of a local function in maildir-sync with
notmuch_json_show_sanitize
2013-12-09 21:20:27 +08:00
David Bremner
20f78709fa test: pass expected output through json_sanitize in 2 places
This makes the tests more robust against changes in the
sanitization rules.
2013-12-09 21:20:15 +08:00
David Bremner
456799d514 test/crypto: disable gpg version printing
This was causing test failures because version strings varied in
length between GNU/Linux and GNU/KFreeBSD. One can also imagine
different versions of gnupg causing the same failure.
2013-11-28 07:02:15 -04:00
David Bremner
2560996b7e test: replace $PWD with YYY in emacs & emacs-show tests
When executed command line is written to *Notmuch errors* buffer,
shell-quote-argument will backslash-escape any char that is not in
"POSIX filename characters" (i.e. matching "[^-0-9a-zA-Z_./\n]").

Currently in two emacs tests shell has expanded $PWD as part of
emacs variable, which will later be fed to #'shell-quote-argument
and finally written to ERROR file. If $PWD contained non-POSIX
filename characters, data in ERROR file will not match $PWD when
later comparing in shell. Therefore, in these two particular cases
the escaped $PWD is replaced with YYY in ERROR file and expected
content is adjusted accordingly.
2013-11-23 20:25:29 -04:00
Austin Clements
96c0ce28f8 emacs: Fix search tagging races
This fixes races in thread-local and global tagging in notmuch-search
(e.g., "+", "-", "a", "*", etc.).  Previously, these would modify tags
of new messages that arrived after the search.  Now they only operate
on the messages that were in the threads when the search was
performed.  This prevents surprises like archiving messages that
arrived in a thread after the search results were shown.

This eliminates `notmuch-search-find-thread-id-region(-search)'
because these functions strongly encouraged racy usage.

This fixes the two broken tests added by the previous patch.
2013-11-08 20:52:00 -04:00
Austin Clements
23fb842e04 emacs: Add known-broken tests for search tagging races
These tests check that both thread-local and global search tagging
operations are race-free.  They are currently known-broken because
they aren't race-free.
2013-11-08 20:46:53 -04:00
Austin Clements
abeac48522 search: Add stable queries to thread search results
These queries will match exactly the set of messages currently in the
thread, even if more messages later arrive.  Two queries are provided:
one for matched messages and one for unmatched messages.

This can be used to fix race conditions with tagging threads from
search results.  While tagging based on a thread: query can affect
messages that arrived after the search, tagging based on stable
queries affects only the messages the user was shown in the search UI.

Since we want clients to be able to depend on the presence of these
queries, this ushers in schema version 2.
2013-11-08 20:43:29 -04:00
Austin Clements
730b8f61e0 emacs: Use notmuch tag --batch for large tag queries
(Unfortunately, it's difficult to first demonstrate this problem with
a known-broken test because modern Linux kernels have argument length
limits in the megabytes, which makes Emacs really slow!)
2013-11-08 20:35:13 -04:00
Austin Clements
c7e18288ae test: Fix missing erase-buffer in emacs test
The first subprocess error exit code test assumed the *Notmuch errors*
buffer would be empty.  Rather than assuming, make it so.
2013-11-08 20:18:24 -04:00
Mark Walters
10bf1b7400 test: tree: remove require from tests
Now tree is included by default we don't need to "require it" in the
test.
2013-11-07 07:52:22 -04:00
Mark Walters
7d7c702d72 emacs: tree: remove test for emacs from tree test
Now the test is in mainline we can remove the check that emacs exists.
2013-11-07 07:43:45 -04:00
Mark Walters
81b2ad57f0 test: move emacs-tree test into mainline
We move the emacs-tree test and associated files into the main test
directory and add the test to the list in notmuch-test.
2013-11-07 07:40:28 -04:00
Jani Nikula
54e7f1777d cli: add compact --backup=DIRECTORY option, don't backup by default
It's the user's decision. The recommended way is to do a database dump
anyway. Clean up the relevant printfs too.
2013-11-07 06:58:58 -04:00
David Bremner
425e73e146 test: fix compact backup / restore test
It was looking in completely the wrong place for the backup and the
(test) xapian database. Unfortunately test_begin_subtest hides the
relevant errors.
2013-11-06 17:49:23 -04:00
Ben Gamari
1eecfbd51a test: Add compact test
Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
2013-10-31 07:48:04 -03:00
Mark Walters
99d474c484 emacs: show: use interactive instead of current-prefix-arg
Currently notmuch-show looks at the prefix-arg directly via
current-prefix-arg. This changes it to use the interactive
specification.

One test (for elide-toggle functionality) set the prefix arg
directly. Update this test to set the new argument directly.
2013-10-19 22:42:49 -03:00
Mark Walters
48231337b7 test: set mail host in emacs_deliver
One test (reply to encrypted message in the crypto test) recently
started failing on some systems. The failure I saw were two extra
lines of the form
<87d2nbc5xg.fsf@host.i-did-not-set--mail-host-address--so-tickle-me>

The test pipes the output through

grep -v -e '^In-Reply-To:' -e '^References:'

which would normally these two ids but it does not, in this case,
because they are so long they get put on a separate line in the output.

To fix this we set mail-host-address for emacs deliver. example.com
seems a sensible address to use. This is short enough that we don't
get the line breaks above and the tests then all pass.
2013-10-14 08:23:07 -03:00
Jani Nikula
71521f06b0 lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init()
As explained by Jeffrey Stedfast, the author of GMime, quoted in [1]:

> Passing the GMIME_ENABLE_RFC2047_WORKAROUNDS flag to g_mime_init()
> *should* solve the decoding problem mentioned in the thread. This
> flag should be safe to pass into g_mime_init() without any bad side
> effects and my unit tests do test that code-path.

The thread being referred to is [2].

[1] id:87bo56viyo.fsf@nikula.org
[2] id:08cb1dcd-c5db-4e33-8b09-7730cb3d59a2@gmail.com
2013-09-14 14:13:43 -03:00
Jani Nikula
59e311d9af test: add known broken tests for known broken RFC 2047 encodings
Some common broken RFC 2047 encodings that we currently let gmime
parse strictly. We could tell gmime to be forgiving in what it accepts
as RFC 2047 encoding, making these tests pass.
2013-09-14 14:10:21 -03:00
Tomi Ollila
fae15296ec test: unset 'xpg_echo' bash shell option
When 'xpg_echo' bash shell option is unset (usually the default)
echo builtin does not expand backslash-escape sequences by default
(i.e. '\n' is echoed as '\n' instead of newline). Not all bash
installations have this feature we depend on activated by default.

Note that the feature is bash (and GNU /bin/echo) specific. It is used
as it is convenient. If portability is needed (elsewhere) use printf(1)
(also often available as a shell builtin).
2013-09-08 22:42:12 -03:00
Tomi Ollila
11a3805464 test: exit with nonzero value when not all tests completed successfully
If any of the tests in our test system is not passing the execution
of the test suite completes with nonzero exit value.

It is better to rely on the exit value of the test system instead
of some arbitrary strings in test output (or use both).
2013-09-08 22:40:57 -03:00
Jani Nikula
2f7cfcd320 test: improve insert test reliability by checking message-id instead of count
There isn't a reported issue this would fix. Spotted by reading the
test.
2013-09-03 20:49:46 -03:00
Jani Nikula
8ffc60e989 test: add more maildir flag syncing related tests to insert
Specifically test maildir flag syncing with insert.
2013-09-03 20:46:01 -03:00
Louis Rilling
a9b2135c75 tags_to_maildir_flags: Don't rename if no flags change
notmuch_message_tags_to_maildir_flags() unconditionally moves messages from
maildir directory "new/" to maildir directory "cur/", which makes messages lose
their "new" status in the MUA. However some users want to keep this "new"
status after, for instance, an auto-tagging of new messages.

However, as Austin mentioned and according to the maildir specification,
messages living in "new/" are not allowed to have flags, even if mutt allows it
to happen. For this reason, this patch prevents moving messages from "new/" to
"cur/", only if no flags have to be changed. It's hopefully enough to satisfy
mutt (and maybe other MUAs showing the "new" status) users checking the "new"
status.

Changelog:
* v2: Fix bool type as well as NULL returned despite having no errors (Austin
      Clements)
* v4: Tag the related test (contributed by Michal Sojka) as working

Signed-off-by: Louis Rilling <l.rilling@av7.net>

[Condition for keeping messages in new/ was extended to satisfy all
 tests from the previous patch. -Michal Sojka]

[Added by David Bremner, to keep the tests passing at each commit]

update insert tests for new maildir synchronization rules

As of id:1355952747-27350-4-git-send-email-sojkam1@fel.cvut.cz
we are more conservative about moving messages from ./new to ./cur.
This updates the insert tests to match
2013-09-03 20:41:51 -03:00
Michal Sojka
4229966dce test: Add some missing maildir synchronization tests
As mentioned by Jani Nikula in id:87vcccp4y3.fsf@nikula.org, some cases
of maildir synchronization are not covered by our tests. Let's add the
missing tests.
2013-09-03 20:36:12 -03:00
Michal Sojka
0b46d0fd2e test: Adding non-maildir tags does not move message from new to cur
Some MUA's like mutt show the difference between "new" emails living in maildir
directory new/, and "old" emails living in maildir directory cur/. However
notmuch tag unconditionally moves selected messages from new/ to cur/, even if
no maildir synchronized tag is changed.

While maildir specification forbids messages with tags living in new/, there is
no need to move messages to cur/ when no maildir synchronized tag is changed.
Thus notmuch can remain transparent with respect to other MUA's.

[ Edited commit log to better describe the intended changes, and tag the
  test as broken until the actual changes are implemented -- Louis Rilling ]

Signed-off-by: Louis Rilling <l.rilling@av7.net>

[ Converted to use test_subtest_known_broken, David Bremner ]
2013-09-03 20:33:17 -03:00
Tomi Ollila
dd8ea3203c test: test notmuch show --include-html option
Test new --include-html option added to notmuch show command with
json output message parts containing text in latin1 and utf8 format.
2013-08-27 07:57:59 -03:00
Jani Nikula
09f8ef3e3d test: test notmuch count --output=files
Add tests for notmuch count --output=files option.
2013-08-24 11:44:12 +02:00
Jani Nikula
820a88eaaa test: test notmuch search --duplicate=N
Add test for notmuch search --duplicate=N option.
2013-08-24 11:42:18 +02:00
Austin Clements
e41cd1c518 test: Canonicalize RFC 2047 encoding and charset
RFC 2047 states that the encoding and charset in an encoded word are
case-insensitive, so force them to lower case in the reply test.  This
fixes an issue caused by GMime versions (somewhere between 2.6.10 and
2.6.16), which changed the capitalization of the encoding.
2013-08-20 09:14:25 +02:00
Austin Clements
dc51bf0ad4 reply: Use RFC 2822/MIME wholly for text format template
Previously, reply's default text format used an odd mix of RFC 2045
MIME encoding for the reply template's body and some made-up RFC
2822-like UTF-8 format for the headers.  The intent was to present the
headers to the user in a nice, un-encoded format, but this assumed
that whatever ultimately sent the email would RFC 2047-encode the
headers, while at the same time the body was already RFC 2045 encoded,
so it assumed that whatever sent the email would *not* re-encode the
body.

This can be fixed by either producing a fully decoded UTF-8 reply
template, or a fully encoded MIME-compliant RFC 2822 message.  This
patch does the latter because it is

a) Well-defined by RFC 2822 and MIME (while any UTF-8 format would be
   ad hoc).

b) Ready to be piped to sendmail.  The point of the text format is to
   be minimal, so a user should be able to pop up the template in
   whatever editor they want, edit it, and push it to sendmail.

c) Consistent with frontend capabilities.  If a frontend has the
   smarts to RFC 2047 encode the headers before sending the mail, it
   probably has the smarts to RFC 2047 decode them before presenting
   the template to a user for editing.

Also, as far as I know, nothing automated consumes the reply text
format, so changing this should not cause serious problems.  (And if
anything does still consume this format, it probably gets these
encoding issues wrong anyway.)
2013-08-17 09:06:08 +02:00
Austin Clements
6cdab6e0b7 reply: Remove extraneous space from generated References
Previously, the References header code seemed to assume
notmuch_message_get_header would return NULL if the header was not
present, but it actually returns "".  As a result of this, it was
inserting an unnecessary space when concatenating an empty or missing
original references header with the new reference.

This shows up in only two tests because the text reply format later
passes the whole reply template through g_mime_filter_headers, which
has the side effect of stripping out this extra space.
2013-08-17 09:05:44 +02:00
Austin Clements
ad7bb423fb reply: Test replying to messages with RFC 2047-encoded headers 2013-08-17 09:04:07 +02:00
Austin Clements
a7696844f0 test: Make symbol-test depend on libnotmuch.so
Without this
$ make -j test
intermittently fails and
$ make clean; make test/symbol-test
always fails (not that anybody would do the latter).
2013-08-15 11:35:30 +02:00
Peter Wang
9a64b2df29 test: test insert --create-folder option
Add tests for notmuch insert --create-folder option.
2013-07-04 00:08:16 -03:00
Peter Wang
0c4b8aa736 test: test insert --folder option
Add tests for notmuch insert --folder option.
2013-07-01 12:23:09 -03:00
Peter Wang
7e3a7ed62f test: add tests for insert
Add tests for new 'insert' command.
2013-06-29 19:29:02 -03:00
Austin Clements
43251ab653 emacs: Use S-exp format everywhere
This switches `notmuch-mua-reply' and `notmuch-query-get-threads' to
the S-exp format.  These were the last two uses of the JSON format in
the Emacs frontend.
2013-06-24 22:57:13 -07:00
Tomi Ollila
8d863c9e87 revert: Removed top level --stderr= option
While looked good on paper, its attempted use caused confusion, complexity,
and potential for information leak when passed through wrapper scripts.
For slimmer code and to lessen demand for maintenance/support the set of
commits which added top level --stderr= option is now reverted.
2013-06-24 22:52:59 -07:00
Tomi Ollila
2593df5271 test/basic: replaced find -perm +111 with portable alternative
The find option syntax `-perm +111` is deprecated gnu find feature.
The replacement `( -perm -100 -o -perm -10 -o -perm 1 )` should also
work outside of the GNU domain.
2013-06-24 22:49:51 -07:00
Austin Clements
89efd5717a emacs: Use streaming S-expr parser for search
In addition to being the Right Thing to do, this noticeably improves
the time taken to display the first page of search results, since it's
roughly an order of magnitude faster than the JSON parser.
Interestingly, it does *not* significantly improve the time to
completely fill a large search buffer because for large search
buffers, the cost of creating author invisibility overlays and
inserting text (which slows down with more overlays) dominates.
However, the time required to display the first page of results is
generally more important to the user experience.
2013-06-01 09:00:40 -03:00
Austin Clements
08fde50bf3 emacs: Use async process helper for search
Previously, search started the async notmuch process directly.  Now,
it uses `notmuch-start-notmuch'.  This simplifies the process sentinel
a bit and means that we no longer have to worry about errors
interleaved with the JSON output.

We also update the tests of Emacs error handling, since the error
output is now separated from the search results buffer.
2013-06-01 08:56:16 -03:00
Austin Clements
7eaf698e23 test: Remove extraneous Emacs error handling test
We now check error handling more carefully in the last test in
test/emacs and we're about to add more error handling tests.  (This
was also a strange place for this test, since it had nothing to do
with large search buffers.)
2013-06-01 08:53:19 -03:00
Austin Clements
1546387d72 emacs: Simplify MIME part command implementation
This unifies the part button actions and the underlying part action
functions into single interactive command that simply applies to the
part containing point using the just-added part p-list text property
instead of button properties.  Since all part actions can be performed
by applying the appropriate mm function to an mm-handle, this patch
abstracts out the creation of mm handles, making the implementations
of the part commands trivial.  This also eliminates our special
handling for part save in favor of using the appropriate mm function.

This necessarily modifies the way we handle the default part button
action, but in a way that does not change the meaning of the
notmuch-show-part-button-default-action defcustom.

Since these commands are no longer specific to buttons, this patch
eliminates the extra metadata stored with each button.  This also
eliminates one rather special-purpose macro for a collection of
general purpose part handling utilities.
2013-05-31 22:01:02 -03:00
Tomi Ollila
ff598e4fdd test: added --stderr=FILE tests
--stderr=FILE tests were added to test/help-test as it is the one
doing most global option testing. Also, it was simplest to test
this new option using `notmuch help` command.
2013-05-29 20:01:38 -03:00
Peter Wang
42102e0b3f test: add tests for search --exclude=all
Test the new search --exclude=all option.
2013-05-13 21:32:46 -03:00
Aaron Ecay
cf8aaafbad lib/database.cc: change how the parent of a message is calculated
Presently, the code which finds the parent of a message as it is being
added to the database assumes that the first Message-ID-like substring
of the In-Reply-To header is the parent Message ID.  Some mail clients,
however, put stuff other than the Message-ID of the parent in the
In-Reply-To header, such as the email address of the sender of the
parent.  This can fool notmuch.

The updated algorithm prefers the last Message ID in the References
header.  The References header lists messages oldest-first, so the last
Message ID is the parent (RFC2822, p. 24).  The References header is
also less likely to be in a non-standard
syntax (http://cr.yp.to/immhf/thread.html,
http://www.jwz.org/doc/threading.html).  In case the References header
is not to be found, fall back to the old behavior.

V2 of this patch, incorporating feedback from Jani and (indirectly)
Austin.
2013-05-13 21:29:13 -03:00
Aaron Ecay
983d5e1df2 test: add tests for the handling of References and In-Reply-To headers
These tests are known_broken, the following commit fixes them.

amended per

	id:87txmi1zq3.fsf@nikula.org
	id:87vc6yalo7.fsf@zancas.localnet
2013-05-13 21:27:01 -03:00
Jani Nikula
9641fe1ce7 cli: config: fix config file save when the file does not exist
The use of realpath(3) in
commit 58ed67992d
Author: Jani Nikula <jani@nikula.org>
Date:   Sun Apr 7 20:15:03 2013 +0300

    cli: config: do not overwrite symlinks when saving config file

broke config file save when the file does not exist, which results in
'notmuch setup' always failing to create a new config file.

Fix by checking ENOENT from realpath(3).
2013-05-12 07:46:44 -03:00
Jani Nikula
2c64c2e0eb test: add basic test for notmuch setup
And annotate with test_subtest_known_broken. Hooray.
2013-05-12 07:46:23 -03:00
Jani Nikula
58ed67992d cli: config: do not overwrite symlinks when saving config file
Use realpath to canonicalize the config path before writing.

Previously 'notmuch setup' and 'notmuch config set' overwrote the
config file even if it was a symbolic link.
2013-04-14 18:38:07 -03:00
Jani Nikula
7defbcdcec test: add some config file tests
Test the --config=FILE option, and add a broken test for writing
config file through a symbolic link.
2013-04-14 18:35:02 -03:00
Jani Nikula
360c3c8607 test: notmuch count --batch and --input options 2013-04-01 09:38:48 -04:00
Jani Nikula
6b405143d7 test: notmuch tag --remove-all 2013-03-30 18:34:22 -04:00
Jani Nikula
e76f6517de cli: config: make notmuch_config_open() "is new" parameter input only
We now have a notmuch_config_is_new() function to query whether a
config was created or not. Change the notmuch_config_open() is_new
parameter into boolean create_new to determine whether the function
should create a new config if one doesn't exist. This reduces the
complexity of the API.
2013-03-07 09:39:12 -04:00
Aaron Ecay
ed5150d2df test/README: mention the test_expect_equal_json and *sanitize* functions
also fix one typo
2013-03-07 09:38:26 -04:00
David Bremner
16aa65ba25 Merge branch 'release'
add in NEWS from 0.15.2

Conflicts:
	NEWS
2013-02-18 20:33:48 -04:00
Tomi Ollila
0d8d11d338 test/test-lib.sh: separate signaled exit
When execution of tests is interrupted by signal coming outside of the
test system itself, output just one line "interrupted by signal <num>"
message to standard output. This distinguishes the case from internal
exit and reduces noise.
2013-02-18 20:17:17 -04:00
Tomi Ollila
3a15602d8e test/test-lib.sh: use $test_subtest_name in all tests
Set the variable '$test_subtest_name' in all functions which starts
a new test and use that variable in all functions that output
test results.

Additionally output the latest '$test_subtest_name' in case of
abnormal exit, to avoid confusion.
2013-02-18 20:17:05 -04:00
David Bremner
f021a06288 test: delay watchdog checks in emacs.
Instead of checking immediately for the watched process, delay a
minute, or in the case that process-attributes returns nil, for two
minutes.  This is intended to cope with the case that
process-attributes is unimplimented, and returns always returns nil.
In this case, the watchdog check is the same as the two minute limit
imposed by timeout.
2013-01-29 19:17:07 -04:00
Tomi Ollila
a12f810a00 test/test-lib.sh: use vt100 as dtach terminal if TERM dumb or unset/empty
The TERM environment variable is set to 'dumb' when running tests, but
the original value of it is stored for echoing colors and running emacs
(somewhat interactively) in detached session. Emacs requires some
terminal control sequences to be available for interactive operation.
In case original TERM is (also) 'dumb' (or unset/empty) emacs cannot
run interactively. To fix this problem dtach (and emacs as it's child
process) is run with TERM=vt100 in case original TERM was unset, empty
or 'dumb'. This way there is a chance to run emacs tests with different
user terminals and potentially find problems there.
2013-01-24 06:59:21 -04:00