Commit graph

2231 commits

Author SHA1 Message Date
Carl Worth
dd544f5dc6 debian/changelog: Add note that notmuch-vim description is in (bug #631974)
This note will automatically cause the bug entry to be closed as fixed when
the next package (including this change) is uploaded.
(cherry picked from commit 04b9ffa56f)
2011-06-29 22:02:58 -03:00
Mark Anderson
d77c7cefe4 Fix folder: coherence issue
Add removal of all ZXFOLDER terms to removal of all XFOLDER terms for
each message filename removal.

The existing filename-list reindexing will put all the needed terms
back in.  Test search-folder-coherence now passes.

Signed-off-by:Mark Anderson <ma.skies@gmail.com>
(cherry picked from commit 8a856e5c38)
2011-06-29 21:58:53 -03:00
Carl Worth
671ffbb766 test: Use increment_mtime rather than sleep
The sleep was to force the directory's mtime to advance between the
previous notmuch new and the subsequent rm;notmuch new.

The current convention is to use the existing increment_mtime function
for this purpose, (which avoids the test suite being slowed down by
calls to sleep).

Thanks to Austin Clements for noticing this undesired sleep.
(cherry picked from commit 55a78d5dbd)
2011-06-29 21:58:39 -03:00
Mark Anderson
c04e6f84d3 test:Folder tags shouldn't match after removal of file in given folder
Test for bug.  Current stemming support for notmuch adds extra terms
to the DB which aren't removed when the file renames are detected.

When folder tags are added to a message, Xapian terms for both XFOLDER
and ZXFOLDER are generated.  When one of the filenames are
renamed/removed, only the XFOLDER tags are removed, leaving it possible
for a match on a folder: tag that was previously but is no longer a
match in the maildir.
(cherry picked from commit 86e0baeb6d)
2011-06-29 21:58:19 -03:00
Mark Anderson
fa0c0d0e66 search --output=files: Output all filenames for each matching message
Messages in the database can have multiple files associated with a
single message-id, but until now only one filename for each message
has been reported by "notmuch search --output=files"

Signed-off-by: Mark Anderson <ma.skies@gmail.com>
(cherry picked from commit d752509abf)
2011-06-29 21:56:57 -03:00
Austin Clements
bb2b33fbb8 new: Improved workaround for mistaken new directories
Currently, notmuch new assumes any directory with a database mtime of
0 is new, but we don't set the mtime until after processing messages
and subdirectories in that directory.  Hence, anything that prevents
the mtime update (such as an interruption or the wall-clock logic
introduced in 8c39e8d6) will cause the next notmuch new to think the
directory is still new.

We work around this by setting the new directory's database mtime to
-1 before scanning anything in the new directory.  This also obviates
the need for the workaround used in 8c39e8d6.
2011-06-29 16:10:41 -07:00
Jameson Graef Rollins
a31ad0bd01 test: document test_expect_equal_file
This test was not properly documented when it was originally added (my
bad).
2011-06-29 15:36:43 -07:00
David Bremner
f4dae4e5a1 lib/Makefile.local: remove leftover debugging output.
The removed "echo $(libnotmuch_modules)" was strictly for debugging.

Thanks to Austin Clements for the hint.
2011-06-29 15:35:47 -07:00
Austin Clements
47afbdfb79 test: Nix increment_mtime.
With the fix for the mtime race, this workaround is no longer
necessary.
2011-06-29 15:26:45 -07:00
Austin Clements
8c39e8d6fb new: Don't update DB mtime if FS mtime equals wall-clock time.
This fixes a race where multiple message deliveries in the same second
with an intervening notmuch new could result in messages being ignored
by notmuch (at least, until a later delivery forced a rescan).
Because mtimes only have second granularity, later deliveries in the
same second won't change the directory mtime, and hence won't trigger
notmuch new to rescan the directory.  This situation can only occur
when notmuch new is being run at the same second as the directory's
modification time, so simply don't update the saved mtime in this
case.

This very race happens all over the test suite, and is currently
compensated for with increment_mtime (and, occasionally, luck).  With
this change, increment_mtime becomes unnecessary.
2011-06-29 15:26:04 -07:00
Pieter Praet
ec1b568929 test: revert non-intentional changes introduced in eb4cf465
eb4cf465 introduces changes which weren't part of the submitted
patch (id:"87liwlip2j.fsf@gmail.com"), presumably made during
resolving merge conflicts.

The first one causes the title of a test to be printed a second time,
in place of the correct title:

  PASS   Message with .. in Message-Id:
  PASS   Message with .. in Message-Id:

instead of:

  PASS   Message with .. in Message-Id:
  PASS   Sending a message via (fake) SMTP

The second one is simply the insertion of a line break, so no harm there.

This commit reverts both changes, as they were clearly accidental.

Signed-off-by: Pieter Praet <pieter@praet.org>
2011-06-29 14:20:57 -07:00
Mark Anderson
8a856e5c38 Fix folder: coherence issue
Add removal of all ZXFOLDER terms to removal of all XFOLDER terms for
each message filename removal.

The existing filename-list reindexing will put all the needed terms
back in.  Test search-folder-coherence now passes.

Signed-off-by:Mark Anderson <ma.skies@gmail.com>
2011-06-29 14:13:16 -07:00
Carl Worth
55a78d5dbd test: Use increment_mtime rather than sleep
The sleep was to force the directory's mtime to advance between the
previous notmuch new and the subsequent rm;notmuch new.

The current convention is to use the existing increment_mtime function
for this purpose, (which avoids the test suite being slowed down by
calls to sleep).

Thanks to Austin Clements for noticing this undesired sleep.
2011-06-29 14:11:38 -07:00
Mark Anderson
86e0baeb6d test:Folder tags shouldn't match after removal of file in given folder
Test for bug.  Current stemming support for notmuch adds extra terms
to the DB which aren't removed when the file renames are detected.

When folder tags are added to a message, Xapian terms for both XFOLDER
and ZXFOLDER are generated.  When one of the filenames are
renamed/removed, only the XFOLDER tags are removed, leaving it possible
for a match on a folder: tag that was previously but is no longer a
match in the maildir.
2011-06-29 14:10:05 -07:00
Carl Worth
04b9ffa56f debian/changelog: Add note that notmuch-vim description is in (bug #631974)
This note will automatically cause the bug entry to be closed as fixed when
the next package (including this change) is uploaded.
2011-06-29 14:08:04 -07:00
Carl Worth
399277d17a TODO: Add note to fix race condition with directory mtime.
I recently discussed fixing this with Austin, but want to record it
here just in case we don't remember to fix it right away.
2011-06-29 14:07:06 -07:00
Dmitry Kurochkin
f74c4bc2f3 test: fix tests after notmuch show output changes related to filenames
Adding the filename propery alongside ID and Content-type.

This makes the test suite pass again after the recent change.
2011-06-28 20:06:20 -07:00
Dmitry Kurochkin
1a27b33f20 Add part filename and content-id in notmuch show output if available.
Before the change, notmuch show output had filename only for
parts with "Content-Disposition: attachment".  But parts with
inline disposition may have filename as well.

The patch makes notmuch show always output filename if available,
independent of Content-Disposition.  Both JSON and text output
formats are changed.

Also, the patch adds Content-id to text output format of notmuch
show.

The main goal of these changes is to have filenames on Emacs
buttons for inline attachments.  In particular, this is very
helpful for inline patches.

Note: text format changes may require updates in clients that use
it.  The changes are:

* text part header format changed from:

    ^Lpart{ ID: 2, Content-type: text/x-diff

  to:

    ^Lpart{ ID: 2, Filename: cool-feature.patch, Content-type: text/x-diff

* attachment format changed from:

    ^Lattachment{ ID: 4, Content-type: application/octet-stream
    Attachment: data.tar.bz2 (application/octet-stream)
    Non-text part: application/octet-stream
    ^Lattachment}

  to:

    ^Lattachment{ ID: 4, Filename: data.tar.bz2, Content-type: application/octet-stream
    Non-text part: application/octet-stream
    ^Lattachment}
2011-06-28 19:19:16 -07:00
Dmitry Kurochkin
a854d06e92 test: use emacsclient(1) for Emacs tests
Before the change, every Emacs test ran in a separate Emacs
instance.  Starting Emacs many times wastes considerable time and
it gets worse as the test suite grows.  The patch solves this by
using a single Emacs server and emacsclient(1) to run multiple
tests.  Emacs server is started on the first test_emacs call and
stopped when test_done is called.  We take care not to leave
orphan Emacs processes behind when test is terminated by whatever
reason: Emacs server runs a watchdog that periodically checks
that the test is still running.

Some tests need to provide user input.  Before the change, this
was done using echo(1) to Emacs stdin.  This no longer works and
instead `standard-input' variable is set accordingly to make
`read' return the appropriate string.
2011-06-28 17:10:55 -07:00
Carl Worth
6ea26cfb81 test: Increment mtime when delivering a message with emacs_deliver_message
Without this, mail messages delivered by emacs_deliver_message might
not be seen by the next invocation of "notmuch new", (which can lead
to test-suite failures if emacs_deliver_message is fast enough).
2011-06-28 17:10:55 -07:00
Mark Anderson
eb4cf465a5 test:Improve test behaviors when --root is used
Change add_email_corpus, emacs_deliver_message and tests to use
$TEST_DIRECTORY instead of '..'.

This improves the behavior of the usage of --root=<dir>, as the
assumption of what '..' means will usually be incorrect.

Document -root option in README and update valgrind to work with
-root.
2011-06-28 16:01:56 -07:00
Dmitry Kurochkin
273d896097 test: generate run_emacs script once on test startup
Instead of generating auxiliary run_emacs script every time
test_emacs is run, do it once in the beginning of the test.

Also, use absolute paths in the script to make it more robust.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
0cc5483a9c test: set variables using let' instead of setq' in Emacs tests
Using `setq' for setting variables in Emacs tests affect other
tests that may run in the same Emacs environment.  Currently it
works because each test is run in a separate Emacs instance.  But
in the future multiple tests will run in a single Emacs instance.
The patch changes all variables to use `let', so the scope of the
change is limited to a single test.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
0417c1fad6 test: use emacs_deliver_message in Emacs SMTP send test
Minor changes to expected results of other Emacs tests were
needed because the message Date header changed.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
5eb6b2767a test: remove some sed(1) calls in Emacs tests
Few Emacs tests used sed(1) to remove unexpected output in the
beginning to avoid getting confused by messages such as "Parsing
/home/cworth/.mailrc... done".  This is no longer needed since
tests are run in a temporary home directory instead of the user's
one.  So remove these sed(1) calls.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
3b24b396c4 test: save buffer content to file instead of printing it in Emacs tests
Before the change, the common Emacs test scheme was to print
buffer content to stdout and redirect it to a file or capture it
in a shell variable.  This does not work if we switch to using
emacsclient(1) for running the tests, because you can not print
to the stdout in this case. (Actually, you can print to stdout
from Emacs server, but you can not capture the output on
emacsclient(1)).

The patch introduces new Emacs test auxiliary functions:
`test-output' and `test-visible-output'.  These functions are
used to save buffer content to a file directly from Emacs.  For
most tests the changes are trivial, because Emacs stdout output
was redirected to a file anyway.  But some tests captured the
output in a shell variable and compare it with the expected
output using test_expect_equal.  These tests are changed to use
files and test_expect_equal_file instead.

Note: even if we do not switch Emacs tests to emacsclient(1), the
patch makes tests cleaner and is an improvement.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
caeb05493d test: wrap and indent test_emacs calls
Most test_emacs calls have long arguments that consist of many
expressions.  Putting them on a single line makes it hard to read
and produces poor diff when they are changed.  The patch puts
every expression in test_emacs calls on a separate line.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
dd75723921 test: cleanup test_emacs
Move auxiliary function definition and configuration from command
line to test-lib.el.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
5806c471de test: do not set `message-signature' in test_emacs
It is no longer needed since tests are run in a temporary home
directory instead of the user's one.
2011-06-28 15:06:47 -07:00
Dmitry Kurochkin
e4fc21e88b test: fix argument order of test_expect_equal_file in few tests
Few Emacs tests had test_expect_equal_file arguments in the wrong
order: the first argument should be the test output and the
second one should be the expected.
2011-06-28 15:06:47 -07:00
Carl Worth
6b17da10e4 TODO: Clarify note about changing the way the emacs '*' command works.
Additional detail is available in this mail message:

	id:8739itagad.fsf@yoom.home.cworth.org
2011-06-28 12:49:31 -07:00
David Bremner
8d46f05304 libnotmuch: build symbols list without relying on gcc -aux-info.
Carl reports "gcc -aux-info notmuch.aux lib/notmuch.h" does not
generate notmuch.aux for him with Debian gcc 4.6.0-8. A small
modification of the original sed regular expression allows us to work
directly from lib/notmuch.h, rather than preprocessing with gcc.

As with most such simple regex based "parsing", this is quite
sensitive to the input format, and needs that each symbol to be
exported from libnotmuch should

- start with "notmuch_"
- be the first non-whitespace token on the line
- be followed by an open parenthesis.

(Cherry-picked from 51b7ab6968, with conflicts resolved by db)
2011-06-28 16:32:07 -03:00
Carl Worth
e0f8d4c7ab .gitignore: Ignore the notmuch.sym file.
This is a generated file, so will not be under git control.
2011-06-28 12:21:41 -07:00
Mark Anderson
d752509abf search --output=files: Output all filenames for each matching message
Messages in the database can have multiple files associated with a
single message-id, but until now only one filename for each message
has been reported by "notmuch search --output=files"

Signed-off-by: Mark Anderson <ma.skies@gmail.com>
2011-06-28 12:14:19 -07:00
Mark Anderson
c87da6961d test:Expect multiple filenames for message with multiple files
Update the test mail corpus to have two files with the same content to
expose the bug where a single message with multiple filenames only
reports a single filename.

Update expected results for search --output=files to match new
behavior for multiple files corresponding to a single message

Signed-off-by: Mark Anderson <ma.skies@gmail.com>
2011-06-28 12:05:50 -07:00
Carl Worth
e5dafc9051 Makefile: Make emacs compilation depend on global dependencies.
We call these "global_deps" for a reason, after all!

Without this, emacs compilation would proceed even if the configure script
failed, (such as for a missing dependency). That's undesirable as it can
cause the helpful error messages from the configure failure to scroll away.
2011-06-28 11:59:48 -07:00
David Bremner
51b7ab6968 libnotmuch: build symbols list without relying on gcc -aux-info.
Carl reports "gcc -aux-info notmuch.aux lib/notmuch.h" does not
generate notmuch.aux for him with Debian gcc 4.6.0-8. A small
modification of the original sed regular expression allows us to work
directly from lib/notmuch.h, rather than preprocessing with gcc.

As with most such simple regex based "parsing", this is quite
sensitive to the input format, and needs that each symbol to be
exported from libnotmuch should

- start with "notmuch_"
- be the first non-whitespace token on the line
- be followed by an open parenthesis.
2011-06-28 11:59:48 -07:00
David Bremner
891082befa libnotmuch: fix typos in CLEAN setting, add file
- c0961e6 introduced a missing slash between $(dir)$(LIBNAME) and missing
  $(dir) in front of libnotmuch.a
- cdf1c70a created a file $(dir)/notmuch.h.gch and neglected to
  add it to CLEAN
2011-06-28 11:59:48 -07:00
Sebastian Spaeth
e59eaa5ddd python: Do not implicitely call maildir_flags_to_tags etc
In order to remain consistent with the underlying C API, we do not
automatically synchronize notmuch tags and maildir flags anymore.

The underlying functions Message.maildir_flags_to_tags and
Message.tags_to_maildir_flags still exist and are available to the user.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
2011-06-24 08:44:06 +02:00
Dmitry Kurochkin
de1ed86b79 test: remove useless test_emacs call from an emacs FCC test
This was inadvertently left over when debugging an early version of
this commit. -Carl Worth <cworth@cworth.org>
(cherry picked from commit 8bf0c1c3de)
2011-06-23 22:01:35 -03:00
Dmitry Kurochkin
d012827890 Fix wrong-type-argument lisp error in `notmuch-fcc-header-setup'
This error occurs when `notmuch-fcc-dirs' is set to a list.  The error
was in the `notmuch-fcc-dirs' format check which was changed in an
incompatible way from 0.4 to 0.5.

The fix was extracted from a bigger patch series by David
Edmondson id:"1290682750-30283-2-git-send-email-dme@dme.org".

Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
(cherry picked from commit ce08571428)
2011-06-23 22:00:17 -03:00
Carl Worth
72d70ec60f test: Test emacs message composing with various values for notmuch-fcc-dirs
We exercise each of the documented values (nil, a string, and a
list). For the list, we test matching a specific entry, matching a
catch-all regular expression, and no match at all (in which case there
is no FCC set).
(cherry picked from commit 76b54f1898)
2011-06-23 21:58:10 -03:00
David Bremner
68a2c7a8b0 Merge remote-tracking branch 'origin/master' 2011-06-23 21:54:50 -03:00
Dmitry Kurochkin
8bf0c1c3de test: remove useless test_emacs call from an emacs FCC test
This was inadvertently left over when debugging an early version of
this commit. -Carl Worth <cworth@cworth.org>
2011-06-23 17:11:04 -07:00
David Bremner
d6f05fde23 debian: fix installation of notmuch-vim README
There was a leftover override, installing it into the wrong package.
2011-06-23 20:39:29 -03:00
Austin Clements
53c5578c7a Add dir-locals style variables for C++, Elisp, and shell code.
Also, slightly reformat dir-locals.el so that the settings align and
to make it friendlier for future additions.
2011-06-23 16:34:57 -07:00
Pieter Praet
b4c9ee2809 fix sum moar typos [test-case data]
Various typo fixes in some test-case data.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
test-case data.
2011-06-23 15:59:11 -07:00
Pieter Praet
607a73010a fix sum moar typos [error messages]
Various typo fixes in error messages within the source code.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just error messages.
2011-06-23 15:59:03 -07:00
Pieter Praet
432e091924 fix sum moar typos [user-visible documentation in code]
Various typo fixes in documentation within the code that can be made
available to the user, (emacs function help strings, "notmuch help"
output, notmuch man page, etc.).

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
documentation and fixed fix of "comman" to "common" rather than
"command".
2011-06-23 15:58:50 -07:00
Pieter Praet
8bb6f7869c fix sum moar typos [comments in source code]
Various typo fixes in comments within the source code.

Signed-off-by: Pieter Praet <pieter@praet.org>

Edited-by: Carl Worth <cworth@cworth.org> Restricted to just
source-code comments, (and fixed fix of "descriptios" to "descriptors"
rather than "descriptions").
2011-06-23 15:58:39 -07:00