Commit graph

664 commits

Author SHA1 Message Date
David Bremner
1de97ee586 test/emacs: force *Messages* buffer to be writable
In emacs 24.4 the messages buffer starts being read-only, which kills
these tests.  This seems to be the point of the variable
inihibit-read-only, which has existed at least since emacs 21.
2014-10-25 10:39:07 +02:00
David Bremner
b4278d4e8e 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.

(cherry picked from commit c34d6bad0f)
2014-10-25 10:39:07 +02:00
Austin Clements
776684c7b6 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.

(cherry picked from commit cbbda62258)

Conflicts:
	test/T380-atomicity.sh
2014-10-25 08:57:20 +02: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
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
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
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