Commit graph

788 commits

Author SHA1 Message Date
David Bremner
23d86773b9 test: use the python interpreter in sh.config
The configure script chooses "python" if both python and python{2,3}
exist exists, so this could change the version of python used to run
the test suite.

The checking for ${NOTMUCH_PYTHON} in the test suite is arguably
over-engineering, since the configure step will fail if it can't find
it.
2015-08-04 09:19:18 +02:00
David Bremner
d9567dd5b5 test: add initial ruby tests
This is pretty much a line by line translation of the existing python
tests, with two new tests for the count API.
2015-06-14 18:00:52 +02:00
David Bremner
32fd74b7aa lib: reject relative paths in n_d_{create,open}_verbose
There are many places in the notmuch code where the path is assumed to be absolute. If someone (TM) wants a project, one could remove these assumptions. In the mean time, prevent users from shooting themselves in the foot.

Update test suite mark tests for this error as no longer broken, and
also convert some tests that used relative paths for nonexistent
directories.
2015-06-12 07:34:50 +02:00
David Bremner
b59ad1a9cc lib: add NOTMUCH_STATUS_PATH_ERROR
The difference with FILE_ERROR is that this is for things that are
wrong with the path before looking at the disk.

Add some 3 tests; two broken as a reminder to actually use this new
code.
2015-06-12 07:34:47 +02:00
David Bremner
783a559968 test: redirect man output to /dev/null
In the case the these tests fail, they generate a bunch of output;
this output is not very interesting because it is just the successful
output of a man page. It does however make it hard to see what tests are actually failing, even with NOTMUCH_TEST_QUIET
2015-06-08 16:42:26 +02:00
David Bremner
ee1f573204 test: make python tests compatible with python3
Making the test suite actually run them with python3 is left for
future work.
2015-06-08 16:41:53 +02:00
David Bremner
243d7e30dc Merge branch 'release'
20.1 plus NEWS fixup
2015-06-02 06:37:59 +02:00
David Bremner
447ad6b498 cli: add standard option processing to config, help and setup
In particular this fixes a recently encountered bug where the
"--config" argument to "notmuch setup" is silently ignored, which the
unpleasant consequence of overwriting the users config file.
2015-06-01 07:32:54 +02:00
J. Lewis Muir
d08af93c65 cli: change "setup" to "set up" where used as a verb
The word "setup" is a noun, not a verb.  Change occurrences of "setup"
where used as a verb to "set up".
2015-05-31 19:14:42 +02:00
David Bremner
5df1b1bb81 test: remove redundant 'file' command from gdb scripts.
Quoting Debian bug 787341

   It failed to build on arm64: the last ten tests in T070-insert
   failed.

   What's happening here is that GDB is segfaulting in response to
   the
   "file" command. GDB on arm64 can be a bit buggy.

   However, the "file" command is redundant here as GDB has already
   got
   the file from the --args on the command line.
2015-05-31 18:56:10 +02:00
David Bremner
294bb6de20 test: move nonexistent directory to something under notmuch's control.
Apparently some systems actually have a directory called /nonexist[ae]nt.
It's hard to fathom a good reason for that, but oh well. As long as we
don't create such a directory inside the notmuch source tree, the new
version should be more robust.
2015-04-08 23:43:55 +09:00
David Bremner
2e9ecb611a test: be consistent about spelling `nonexistent'
Apparently most of the misspellings are my fault.
2015-04-08 23:43:55 +09:00
Tomi Ollila
3d1483df12 test/thread-order: more robust loop exit in case of broken input
When creating $THREADS data it may end of not having 'None' at all
or the numbers in line output yields a loop.

To avoid loop the value in current array index is set to 'None'
so that if the same item is reached again the loop will end.

Also empty string as next array index will end the loop.
2015-04-03 09:27:57 +09:00
David Bremner
703c8f9511 test: make one error output test more robust.
Since notmuch_database_status_string can return NULL, passing it
directly to fputs is not a good idea.
2015-03-29 09:50:01 +02:00
David Bremner
6a99505625 test: add more error reporting tests
This second half of the error reporting tests actually uses the function
notmuch_database_status_string to retrieve the last logged error
2015-03-29 00:34:15 +01:00
David Bremner
736ac26407 lib: replace almost all fprintfs in library with _n_d_log
This is not supposed to change any functionality from an end user
point of view. Note that it will eliminate some output to stderr. The
query debugging output is left as is; it doesn't really fit with the
current primitive logging model. The remaining "bad" fprintf will need
an internal API change.
2015-03-29 00:34:15 +01:00
David Bremner
84d3b15d25 lib: add "verbose" versions of notmuch_database_{open,create}
The compatibility wrapper ensures that clients calling
notmuch_database_open will receive consistent output for now.

The changes to notmuch-{new,search} and test/symbol-test are just to
make the test suite pass.

The use of IGNORE_RESULT is justified by two things. 1) I don't know
what else to do.  2) asprintf guarantees the output string is NULL if
an error occurs, so at least we are not passing garbage back.
2015-03-29 00:34:15 +01:00
David Bremner
83298fa0f8 test: add error reporting tests
This first half of the tests is all that don't need to retrieve the
the error string explicitly from the notmuch database structure.
2015-03-29 00:34:15 +01:00
David Bremner
1e69afe8af test: add support for compiling and running C snippets
This is to limit the copy-pasta involved in running C tests. I decided
to keep things simple and not try to provide an actual C skeleton.

The setting of LD_LIBRARY_PATH is to force using the built libnotmuch
rather than any potential system one.
2015-03-29 00:33:56 +01:00
David Bremner
baf93369f6 test: Add two tests for error output from notmuch_database_open
This is arguably testing the same thing twice, but in the brave new
future where we don't use printf anymore, each subcommand will be
responsible for handling the output on it's own.
2015-03-15 20:27:20 +01:00
David Bremner
c883e632bf CLI: make gpg binary used by libgmime configurable.
Previously we set up a way for the top level notmuch command to choose
which gpg binary was invoked by libgmime. In this commit we add the
(mostly boilerplate) code to allow the notmuch-config command to read
and write this path, and use it in the appropriate struct.

Update tests for new default variable
2015-03-11 08:04:00 +01:00
Jani Nikula
6aeef2ee15 parse-time-string: fix setting and rounding of seconds
If seconds are not specified in the string to be parsed, they're not
set according to the reference time (in the no rounding case) nor
rounded properly (in the rounding up cases). Fix this.

The bug caused searches such as date:10:30..10:30 to match messages
with date exactly 10:30:00 only, and not in range 10:30:00..10:30:59
(inclusive) as documented.

Note that date searches referring "noon" or "5pm" will still be
interpreted as exact to the second.
2015-03-07 10:20:33 +01:00
Jani Nikula
952f46fedc test: extract and flag second rounding tests as broken
Extract and add some more tests relating to rounding seconds into a
separate subtest, and flag it as broken. If seconds are not specified,
the time is not set or rounded according to the interface defined in
parse-time-string/parse-time-string.h. Instead, seconds are always set
to 00 in reality, which is broken.
2015-03-06 21:36:20 +01:00
Jani Nikula
65dee41fb6 test: add some more time tests
Ensure the seconds are set properly.
2015-03-06 21:36:11 +01:00
Jani Nikula
fd80a9cac1 test: improve the time parsing tests
Set the reference time to 12:13:14 instead of 11:11:00 to ensure hours
and minutes are not mixed up, and seconds are really set instead of
defaulted to 00.
2015-03-06 21:35:58 +01:00
Todd
b04bc967f9 Add indexing for the mimetype term
This adds the indexing support for the "mimetype:" term and removes
the broken test flag.  The indexing is probablistic in Xapian terms,
which gives a better experience to end users.  Standard content-types
of the form "foo/bar" are automatically interpreted as phrases in
Xapian due to the embedded slash.

Assume, separate messages with application/pdf and application/x-pdf
are indexed, then:

- mimetype:application/x-pdf will find only the application/x-pdf
- mimetype:application/pdf will find only the application/pdf
- mimetype:pdf will find both of the messages
2015-01-24 16:47:59 +01:00
Todd
0829bd4e5d test: Add failing unit tests for indexed mime types
Adds three failing unit tests for searching of mime-types.

An attempt was made at adding a negative test (i.e. searching for a
non-existent mime-type and ensuring it didn't return a message), but
that test would always pass making it pointless.
2015-01-24 16:47:38 +01:00
Tomi Ollila
7fcd100a2f test: prepare test-lib.sh for possible test system debug session
When something in tests fails one possibility to test is to run
the test script as `bash -x TXXX-testname.sh`. As stderr (fd 2) was
redirected to separate file during test execution also this set -x
(xtrace) output would also go there.
test-lib.sh saves the stderr to fd 7 from where it can be restored,
and bash has BASH_XTRACEFD variable, which is now given the same value
7, making bash to output all xtrade information (consistently) there.

This lib file used to save fd's 1 & 2 to 6 & 7 (respectively) in
test_begin_subtest(), but as those needs to be set *before* XTRACEFD
variable is set those are now saved at the beginning of the lib (once).
This is safe and simple thing to do.
To make xtrace output more verbose PS4 variable was set to contain the
source file, line number and if execution is in function, that function
name. Setting this variable has no effect when not xtracing.

As it is known that fd 6 is redirected stdout, printing status can now
use that fd, instead of saving stdout to fd 5 and use it.
2015-01-19 08:15:39 +01:00
Jesse Rosenthal
62bc1d4717 thread-naming test: Test empty subject names.
We test all empty subjects, and then empty subjects followed by
non-empty subjects (searching both oldest- and newest-first).
2015-01-17 13:49:26 +01:00
Jesse Rosenthal
c0c007dd7f test-lib: Add dummy subject to force empty subject
At the moment, the test-lib fills in any missing headers. This makes
it impossible to test our handling of empty subjects. This will
allow us to use a special dummy subject -- `@FORCE_EMPTY` -- to force
the subject to remain empty.
2015-01-17 13:49:05 +01:00
Jani Nikula
c82a1745ac lib: drop the deprecation message for single-message mbox files
We generally do not support mbox files, but for historical reasons
we've supported single-message mbox files, with a deprecation
message. We've tried dropping the support altogether, but backed out
of it because we'd need to stop indexing them, while keeping support
for previously indexed files. This would be more complicated than
simply supporting single-message mbox files. Therefore, drop the
deprecation message, and just silently accept single-message mboxes.
2015-01-01 16:47:47 +01:00
Jesse Rosenthal
4135a1f8da lib: Use email address instead of empty real name.
Currently, if a From-header is of the form:

    "" <address@example.com>

the empty string will be treated as a valid real-name, and the entry
in the search results will be empty.

The new behavior here is that we treat an empty real-name field as if
it were null, so that the email address will be used in the search
results instead.

Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
2014-12-07 13:36:08 +01:00
Jesse Rosenthal
6c1d626519 test: Add known-broken test for empty author name
We test for whether a quoted empty email address

    "" <address@example.com>

will show up as the address, instead of the empty string. This is
marked as known-broken, since the current behavior is to use the empty
string.

This is a new test file, since handling of unusual email addresses
doesn't seem to fit well in any of our existing tests.

Signed-off-by: Jesse Rosenthal <jrosenthal@jhu.edu>
2014-12-07 13:32:12 +01:00
Tomi Ollila
0d8251dbe2 cli: notmuch address option defaults update
When no --output option were given, change default to display senders
only.

When only --count option is given, display senders (in contrary to not
displaying anything).

Document that --count with --sort=**order** is not supported option
combination.

Clean up some whitespace in the documentation.

One test updated to have --output=count without sender nor recipient
output option.
2014-11-09 10:09:51 +01:00
Michal Sojka
a5a6859197 cli: address: Add --output=count
This output prints how many times was each address encountered during
search.
2014-11-05 23:25:05 +01:00
Michal Sojka
4176e527fc cli: address: Do not output duplicate addresses
This filters out duplicate addresses from address command output.

It also also adds tests for the address command.

The code here is an extended version of a patch from Jani Nikula.
2014-11-05 23:23:01 +01:00
Jesse Rosenthal
0d40b37954 test: Make gen-threads work with python3
python3 doesn't allow dictionaries to be initialized with non-string
keywords. This presents problems on systems in which "python" means
"python3". We instead initalize the dictionary using the dict
comprehension and then update it with the values from the tree. This
will work with both python2 and python3.
2014-11-02 19:43:39 +01:00
Jani Nikula
207f3bf821 test: add tests for --output=messages --duplicate=N
Basic smoke tests for the feature, nothing fancy.
2014-11-02 19:42:28 +01:00
Jani Nikula
ecc4a9a644 cli: Add support for parsing keyword-flag arguments
This allows having multiple --foo=bar --foo=baz options on the command
line, with the corresponding values OR'd together.

[Test added by Michal Sojka]
2014-11-01 08:02:21 +01:00
Jani Nikula
0f35ddcdfc test: use LDFLAGS in test/Makefile.local
Apparently the test binaries are built with minimal LDFLAGS, only
adding dependency specific LDFLAGS as needed. However because some of
the test binaries incorporate notmuch object files, it is necessary to
use the same link flags as notmuch. For example user provided
CFLAGS/CXXFLAGS/LDFLAGS with -fsanitize=undefined fails to build the
test binaries if the flags differ.
2014-10-31 17:51:22 +01:00
David Bremner
7d32b01d78 test: add simple tests for post-insert hook
Most of the existing tests for pre/post-new hook don't seem to apply.
2014-10-28 19:22:00 +01:00
Austin Clements
4e2c351c58 test: Test upgrade to ghost messages feature 2014-10-25 19:42:47 +02:00
Austin Clements
ee476f1e76 lib: Enable ghost messages feature
This fixes the broken thread order test.
2014-10-25 19:31:27 +02:00
David Bremner
ce44657c9e notmuch 0.18.2~rc1 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJUS2vpAAoJEPIClx2kp54svhoL/1kCYjeONhccqb1cyjCVPsC7
 NBGZ48JZNqmDnxrjjz4PgrA9R7h/4R4ViWboCNGFJEbQaPqh89klLa+XiOpaNoyZ
 Y2oP/GrZNXg2TtThehywwWY2w/Q2+bfpyI8C1RnXDuLzvtS6fTpSfGX9+yr7KfUE
 fT56r2V68HHTaTUSFvywKpnRMNnExoa1HT/0EdDRV3v3LqlqALZwgyJAv7hb7EfX
 0a7Q5JChVhQyq+BRq4tKJA2g/n3s54dy3cIBXmSjo8CvOar+GVgrceZ5i1al7Z7x
 D2BDpMfr2qV4fJYapsH+n3fsUhr0LmG651A5A2GdaGUNhLtP28hGPUZpT+ejzTAW
 GOWdlF+PzDCMhdZzqjYQUqN3ROgQsDUcGrwXv+tVv2AoZepSbxyhIeIzU71dD/vx
 5JEP3EVJMwgWbDHKeOzv1+nwzQpMWk8/vxSA9SPN9MBUMkNjaKyrY1YBrX6xtUn0
 l3iglBOdTcqr0uZSVSTU4sODcKtd/w2TlSOSWWnRNA==
 =KuiR
 -----END PGP SIGNATURE-----

Merge tag '0.18.2_rc1'

notmuch 0.18.2~rc1 release

Conflicts:
	NEWS
	debian/changelog
2014-10-25 11:38:18 +02:00
David Bremner
e32bb20099 test: kill '"filename": "signature.asc"' from json output
This starts to appear with emacs24.4, so we can't easily have it in
our expected output.
2014-10-25 10:39:07 +02:00
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
David Bremner
dd8373fb57 test: check for gdb in insert tests
Commits a6cee01 and c48b12f otherwise break the build for people
without gdb.
2014-10-18 08:13:42 +02:00
David Bremner
c48b12f18a test/insert: check that indexing errors are accepted with --keep
This is overkill for the current code path, but should provide some
robustness for future changes in error handling.
2014-10-18 07:58:42 +02:00
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