]> git.notmuchmail.org Git - notmuch/log
notmuch
13 years agoconfigure: Test for flag to set rpath
Carl Worth [Sat, 30 Oct 2010 19:55:09 +0000 (12:55 -0700)]
configure: Test for flag to set rpath

This is better than the previous approach which had a hardcoded Linux-specific
value in the Makefile.

13 years agoconfigure: Test for each compiler warning before enabling it.
Carl Worth [Sat, 30 Oct 2010 19:36:06 +0000 (12:36 -0700)]
configure: Test for each compiler warning before enabling it.

This should allow the build to be much more automatically portable
to compilers with different sets of warning options.

13 years agotest: Test emacs notmuch-hello with no saved searches to display.
Carl Worth [Fri, 29 Oct 2010 22:53:34 +0000 (15:53 -0700)]
test: Test emacs notmuch-hello with no saved searches to display.

Haippily, this works just fine, but we might as well test that.

13 years agotest: Test emacs notmuch-hello when displaying a saved search with 0 results.
Carl Worth [Fri, 29 Oct 2010 22:49:59 +0000 (15:49 -0700)]
test: Test emacs notmuch-hello when displaying a saved search with 0 results.

This test verifies that the bug fix in the previous commit is working.

13 years agoFix problem with notmuch-hello-nice-number
Dirk Hohndel [Fri, 29 Oct 2010 22:49:01 +0000 (15:49 -0700)]
Fix problem with notmuch-hello-nice-number

Without this little patch notmuch fails if asked to display a saved
search that has zero results

Edited-by: David Edmondson <dme@dme.org>: With code that is a little
more "emacsy".

13 years agoemacs: Re-work the implementation of highlighting in notmuch-search-mode.
David Edmondson [Mon, 7 Jun 2010 14:35:10 +0000 (15:35 +0100)]
emacs: Re-work the implementation of highlighting in notmuch-search-mode.

Re-write `notmuch-search-color-line', with the following improvements:
 - create overlays only if they will be needed,
 - merge the properties specified for a tag on top of any matching a
   previous tag.

13 years agodebian: Add emacs autoloads for all top-level notmuch functions.
Carl Worth [Fri, 29 Oct 2010 22:28:18 +0000 (15:28 -0700)]
debian: Add emacs autoloads for all top-level notmuch functions.

With this, users will be able to simply "apt-get install emacs" and
then "emacs -f notmuch" without having to edit ~/.emacs to add a
("require 'notmuch)".

13 years agoemacs: Fix the autoload comments
Carl Worth [Fri, 29 Oct 2010 22:27:01 +0000 (15:27 -0700)]
emacs: Fix the autoload comments

Remove them from non-top-level entry points, (such as the functions to
set notmuch modes and the deprecated notmuch-folder function). And add
one to the notmuch-hello function. Also, add missing documentation
string to notmuch-hello.

13 years agoconfigure: Set XAPIAN_CONFIG to only "xapian-config" by default.
Carl Worth [Fri, 29 Oct 2010 21:49:20 +0000 (14:49 -0700)]
configure: Set XAPIAN_CONFIG to only "xapian-config" by default.

Previously, we preferred a value of "xapian-config-1.1" first. This
was convenient for compiling against Xapian 1.1 while Xapian 1.2 was
unreleased. But now that Xapian 1.2 is realease, and since it ships a
xapian-config, the xapian-config-1.1 value can mask the newer library.

Instead of trying to track the latest xapian-config-1.x in our
configure script let's simply expect the user to set
XAPIAN_CONFIG=xapian-config-1.x in order to compile against an
unreleased Xapian.

13 years agoconfigure: optimize uname finding a bit
Felipe Contreras [Sat, 5 Jun 2010 11:05:15 +0000 (14:05 +0300)]
configure: optimize uname finding a bit

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
13 years agoMakefile: Fix notmuch binary to directly link against Xapian and GMime.
Carl Worth [Fri, 29 Oct 2010 21:25:09 +0000 (14:25 -0700)]
Makefile: Fix notmuch binary to directly link against Xapian and GMime.

Without this, trying to link with the gold linker would fail, (which meant
that notmuch could not be compiled out of the box on recent Fedora, nor
even on Debian when the binutils-gold package is installed).

13 years agoDon't involve the shell in notmuch searches
David Benjamin [Fri, 4 Jun 2010 00:29:32 +0000 (20:29 -0400)]
Don't involve the shell in notmuch searches

The shell isn't needed to interpret any of the arguments, so don't
bother using it at all.

Signed-off-by: David Benjamin <davidben@mit.edu>
13 years agonotmuch-setup.c: Initialize getline(3) response_size to 0
Mike Kelly [Thu, 14 Oct 2010 18:18:19 +0000 (14:18 -0400)]
notmuch-setup.c: Initialize getline(3) response_size to 0

This appears to be necessary on FreeBSD. If this isn't done, we get a
nasty segfault.

See: id:20101013094340.41580a2f@pioto.org

13 years agoDo not call ldconfig when building Debian package
Michal Sojka [Wed, 16 Jun 2010 14:14:18 +0000 (16:14 +0200)]
Do not call ldconfig when building Debian package

Hi,

If I want to build Debian package, it fails with the following message:

    ldconfig: Can't create temporary cache file /etc/ld.so.cache~: Permission denied
    make[1]: *** [install-lib] Error 1

The reason is that I build the package as a non-root user and make
install invokes ldconfig unconditionally. The following patch contains a
workaround, but I think that a more correct solution would be to check
the condition LIBDIR_IN_LDCONFIG directly when make install is invoked
rather than in configure as it is done now.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
13 years agodocumentation: Add the "files" option to the synopsis of "search --output="
Carl Worth [Thu, 28 Oct 2010 19:15:51 +0000 (12:15 -0700)]
documentation: Add the "files" option to the synopsis of "search --output="

This was inadvertently left off when --output=files was recently added
as a new option.

13 years agopython: lambda(p) is not P3k-compliant
Sebastian Spaeth [Thu, 28 Oct 2010 12:37:16 +0000 (14:37 +0200)]
python: lambda(p) is not P3k-compliant

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
13 years agopython: Import explicit including package name
Sebastian Spaeth [Thu, 28 Oct 2010 12:37:15 +0000 (14:37 +0200)]
python: Import explicit including package name

To make python3 happy

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
13 years agotest: Emit a friendly error message if run with bash < 4.0.
Carl Worth [Thu, 28 Oct 2010 19:07:42 +0000 (12:07 -0700)]
test: Emit a friendly error message if run with bash < 4.0.

The bash code in the test suite is using associative arrays which were
only added to bash as of release 4.0.

If the test suite is run with an older bash, we now immediately error
out and explain the situation, (instead of emitting confusing error
messages and failing dozens of tests, which is what happened before
this change).

13 years agotest: Avoid using unreliable, hard-coded thread ID values in test suite.
Carl Worth [Thu, 28 Oct 2010 18:45:50 +0000 (11:45 -0700)]
test: Avoid using unreliable, hard-coded thread ID values in test suite.

Some recently-added tests used hard-coded thread ID values in search
specifications. This is unreliable since the thread IDs depend on the
order in which "notmuch new" encounters new files, (which in turn can
depend on inode ordering within the filesystem).

Fix these by using the new "notmuch search --output=threads" to find the
correct thread IDs given a hard-coded (but reliable) message ID.

13 years agoemacs: Use copy-sequence instead of copy-seq.
Carl Worth [Thu, 28 Oct 2010 17:39:52 +0000 (10:39 -0700)]
emacs: Use copy-sequence instead of copy-seq.

I don't see copy-seq documented within emacs at all, and some users
have encountered failures of the form:

notmuch-show-del-tags-worker: Symbol's function definition is void: copy-seq

This should eliminate that problem.

13 years agonotmuch search: Add a new "notmuch search --output=files"
Carl Worth [Thu, 28 Oct 2010 18:33:55 +0000 (11:33 -0700)]
notmuch search: Add a new "notmuch search --output=files"

Yet another thing that will be extremely handy for scripts.

13 years agonotmuch search: Add a new --output=(summary|threads|messages|tags) option.
Carl Worth [Thu, 28 Oct 2010 18:19:53 +0000 (11:19 -0700)]
notmuch search: Add a new --output=(summary|threads|messages|tags) option.

This can be handy for scripts which need to extract just a thread ID from
a search term, for example.

13 years agolib: Add two functions: notmuch_query_get_query_string and _get_sort
Carl Worth [Thu, 28 Oct 2010 17:30:26 +0000 (10:30 -0700)]
lib: Add two functions: notmuch_query_get_query_string and _get_sort

It can be handy to be able to query these settings from an existing
query object.

13 years agoTODO: Remove several items that have been completed.
Carl Worth [Thu, 28 Oct 2010 16:02:34 +0000 (09:02 -0700)]
TODO: Remove several items that have been completed.

We've done a lot of work recently without also taking care to update
the TODO file to indicate the progress.

13 years agoemacs: Eliminate duplicate From header in replies.
Carl Worth [Thu, 28 Oct 2010 01:44:05 +0000 (18:44 -0700)]
emacs: Eliminate duplicate From header in replies.

The original code was intended to work, but clearly wasn't tested. Use
mail-header (as in existing code) to extract a header from a header alist.

This fixes the duplicate-from-line bug that is exercised by the test
just added to the test suite.

13 years agotest: Add test for reply functionality within emacs.
Carl Worth [Thu, 28 Oct 2010 01:43:09 +0000 (18:43 -0700)]
test: Add test for reply functionality within emacs.

The reply is primarily taken care of by "notmuch reply" which is already
thoroughly tested. But a recent bug is inserting a duplicate From header
in the emacs-based reply. So exercise that bug here.

13 years agonotmuch: Eliminate some const-correctness warnings.
Carl Worth [Thu, 28 Oct 2010 01:07:37 +0000 (18:07 -0700)]
notmuch: Eliminate some const-correctness warnings.

These were introduced as a side-effect of commit
b9eac48c22f53f84ed1d9c1d8ca862a7b638c9ac (shame on me for doing
side-effect commits like that!).

For me, at least, compilation is now warning-free.

13 years agoemacs: Eliminate warning of calling function with excess arguments.
Carl Worth [Thu, 28 Oct 2010 01:04:38 +0000 (18:04 -0700)]
emacs: Eliminate warning of calling function with excess arguments.

Yet another case of "how could this have possibly worked before?!".

I guess we were just getting very lucky with the emacs lisp calling
conventions and what happens with extra arguments, but, ick! Much
better now.

13 years agoemacs: Remove non-interactive call of goto-line
Carl Worth [Thu, 28 Oct 2010 00:58:19 +0000 (17:58 -0700)]
emacs: Remove non-interactive call of goto-line

As the emacs compiler warns, the goto-line function is only intended for
interactive use. Instead use the approach recommended in the goto-line
documentation to avoid this.

13 years agoemacs: Fix to eliminate warning in notmuch-query-map-aux
Carl Worth [Thu, 28 Oct 2010 00:54:38 +0000 (17:54 -0700)]
emacs: Fix to eliminate warning in notmuch-query-map-aux

This is one of those cases where the warning looks absolutely correct,
(complaining about a free variable), but I'm left wondering how the
original code could have worked at all.

From what I can tell, this code wasn't actually being called by any
of the current code in notmuch.

13 years agoemacs: Avoid runtime use of `cl'.
David Edmondson [Thu, 29 Apr 2010 10:33:36 +0000 (11:33 +0100)]
emacs: Avoid runtime use of `cl'.

The GNU Emacs Lisp Reference Manual section D.1 says:

> *  Please don't require the cl package of Common Lisp extensions at
>    run time. Use of this package is optional, and it is not part of
>    the standard Emacs namespace. If your package loads cl at run time,
>    that could cause name clashes for users who don't use that package.
>
>    However, there is no problem with using the cl package at compile
>    time, with (eval-when-compile (require 'cl)). That's sufficient for
>    using the macros in the cl package, because the compiler expands
>    them before generating the byte-code.

Follow this advice, requiring the following changes where `cl' was
used at runtime:

- replace `rassoc-if' in `notmuch-search-buffer-title' with the `loop'
  macro and inline code. At the same time find the longest prefix
  which matches the query rather than simply the last,
- replace `union', `intersection' and `set-difference' in
  `notmuch-show-add-tag' and `notmuch-show-remove-tag' with local code
  to calculate the result of adding and removing a list of tags from
  another list of tags.

13 years agoMove notmuch-fcc-header-setup to message-header-setup-hook.
Rob Browning [Sun, 12 Sep 2010 20:23:38 +0000 (15:23 -0500)]
Move notmuch-fcc-header-setup to message-header-setup-hook.

Call notmuch-fcc-header-setup from message-header-setup-hook rather
than message-send-hook.  This allows you to see what's going to
happen, and to make manual adjustments if desired.  Gnus does
something similar.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
13 years agotest: Update tests with removal of bcc from reply
Jameson Rollins [Thu, 28 Oct 2010 00:34:02 +0000 (17:34 -0700)]
test: Update tests with removal of bcc from reply

Update the tests so that they no longer expect the Bcc header in the
output of "notmuch reply" now that it has been removed.

Edited-by Carl Worth: Simply applying the change to our newly
modularized test suite.

13 years agoRemove bcc header from notmuch reply.
Jameson Rollins [Thu, 28 Oct 2010 00:15:42 +0000 (17:15 -0700)]
Remove bcc header from notmuch reply.

Notmuch reply should not be Bcc'ing the sender by default.  This is
not the appropriate way to save copies of sent mail (which should
probably be handled by an Fcc header[*]) and it doesn't give the user the
option to not be bcc'd.  This is really something that should be
handled by the reader UI.  For instance, emacs message-mode can easily
be configured to add Bcc's if the user wishes.

[*] Carl Worth: The FCC header is now in place by default in the emacs
user-interface (and tested in the test suite) so the Bcc is ready to
be eliminated.

13 years agotest: Add test for fully-roundtripped FCC
Carl Worth [Thu, 28 Oct 2010 00:08:09 +0000 (17:08 -0700)]
test: Add test for fully-roundtripped FCC

We test that the message we sent via (fake) SMTP is included in the mail
index after a "notmuch new". This verifies that the FCC setting indeed
successfully saved the sent message within the notmuch mail store.

13 years agotest: Use an explicit date in the message sent via (fake) SMTP
Carl Worth [Thu, 28 Oct 2010 00:06:26 +0000 (17:06 -0700)]
test: Use an explicit date in the message sent via (fake) SMTP

Simply setting an explicit date is cleaner than letting the current,
(arbitrary), date get generated for the email message and then constantly
filtering that date out of search results.

13 years agoemacs: Explicitly set the From address when composing a new message.
Carl Worth [Wed, 27 Oct 2010 23:58:44 +0000 (16:58 -0700)]
emacs: Explicitly set the From address when composing a new message.

Previously, underlying emacs code was setting this header. Now, we do the
right thing and query the notmuch configuration for the default value here.

13 years agoemacs: Enable FCC (to a directory named "sent") by default.
Carl Worth [Wed, 27 Oct 2010 23:35:53 +0000 (16:35 -0700)]
emacs: Enable FCC (to a directory named "sent") by default.

Now that the FCC code is fixed to use the notmuch database path, we can
actually enable this by default, which should be highly useful for all
new users of notmuch.

13 years agoemacs: Change FCC to be relative to notmuch mail store, not message-directory
Carl Worth [Wed, 27 Oct 2010 23:27:43 +0000 (16:27 -0700)]
emacs: Change FCC to be relative to notmuch mail store, not message-directory

Otherwise, FCC is too hard to use, (user must set it and also set message-
directory variable to match notmuch mail datbase path). As a rule, I'd like
for users of notmuch to not be required to muck around with non-notmuch
mail settings in emacs.

The above is only really possible now thanks to the recent addition of the
"notmuch config get" command which allows emacs to query the currently
configured notmuch database path.

This also now allows an absolute-path FCC to be set if desired.

13 years agonotmuch config: Allow for new "notmuch config set" in addition to get
Carl Worth [Wed, 27 Oct 2010 22:38:16 +0000 (15:38 -0700)]
notmuch config: Allow for new "notmuch config set" in addition to get

It is now possible to set configuration items from the command-line in
a manner quite similar to the support for querying configuration
items.

13 years agonotmuch config: Provide support for querying non-standard configuration values.
Carl Worth [Wed, 27 Oct 2010 20:26:32 +0000 (13:26 -0700)]
notmuch config: Provide support for querying non-standard configuration values.

We might as well be general here, and allow the "notmuch config" command
to query any stored value from the configuration file, (whether or not
the rest of the code actually knows anything about that value).

13 years agonotmuch: Add a new "notmuch config" command for querying configuration.
Carl Worth [Wed, 27 Oct 2010 20:02:17 +0000 (13:02 -0700)]
notmuch: Add a new "notmuch config" command for querying configuration.

So far, we implement only "notmuch config get". It won't be too much
work from here to also implement "notmuch config set".

13 years agoTODO: Note idea for a new "notmuch compose"
Carl Worth [Wed, 27 Oct 2010 17:48:40 +0000 (10:48 -0700)]
TODO: Note idea for a new "notmuch compose"

Which would also allow the recently added test of sending an email
message with the emacs interface to be a little more honest about the
From address.

13 years agotest: Add test that emacs interface actually sends mail.
Carl Worth [Wed, 27 Oct 2010 17:42:46 +0000 (10:42 -0700)]
test: Add test that emacs interface actually sends mail.

Rather than *reall* sending mail here, we instead have a new test
program, smtp-dummy which implements (a small piece of) the
server-side SMTP protocol and saves a mail message to the filename
provided. This gives us reasonable test coverage of a large chunk of
the notmuch+emacs code base (down to talking to an SMTP server with
the final mail contents).

13 years agotest: Set alternate HOME during tests.
Carl Worth [Wed, 27 Oct 2010 17:40:44 +0000 (10:40 -0700)]
test: Set alternate HOME during tests.

We set the HOME environment variable to the test directory to avoid
the tests relying on any configuration files from the test author's
own home directory, (such as ${HOME}/.emacs or similar).

13 years agotest: Fix false failure from the "available tests" test.
Carl Worth [Sat, 23 Oct 2010 01:00:17 +0000 (18:00 -0700)]
test: Fix false failure from the "available tests" test.

We recently added a new sub-directory below test, so we have to
blacklist it explicitly in this test.

13 years agonotmuch search: Fix to handle failure of notmuch_query_search_threads.
Carl Worth [Sat, 23 Oct 2010 00:57:02 +0000 (17:57 -0700)]
notmuch search: Fix to handle failure of notmuch_query_search_threads.

Now that notmuch_query_search_threads can return NULL, (for example,
due to a Xapian exception), we need to handle that case (rather than
just segfault). It's simple enough to just return a non-zero exit
code.

13 years agolib: Fix notmuch_query_search_threads to return NULL on any Xapian exception.
Carl Worth [Sat, 23 Oct 2010 00:55:07 +0000 (17:55 -0700)]
lib: Fix notmuch_query_search_threads to return NULL on any Xapian exception.

Previously, if the underlying search_messages hit an exception and returned
NULL, this function would ignore that and return a non-NULL, (but empty)
threads object. Fix this to properly propagate the error.

13 years agoemacs: Fix quoting of Message-Id to fix test case of Id containing ".."
Carl Worth [Sat, 23 Oct 2010 00:41:40 +0000 (17:41 -0700)]
emacs: Fix quoting of Message-Id to fix test case of Id containing ".."

If Xapian sees unquoted ".." as in id:123..456 then it thinks that's a
range specification. We avoid this problem by instead passing
id:"123..456" to Xapian.

13 years agotest: Add test demonstrating failure in emacs interface when Message-Id has ..
Carl Worth [Sat, 23 Oct 2010 00:28:14 +0000 (17:28 -0700)]
test: Add test demonstrating failure in emacs interface when Message-Id has ..

Thanks to Jameson Rollins for pointing out this bug
(id:87y6g7zr6q.fsf@servo.finestructure.net).

13 years agotest: Add tests for adding/removing tags within emacs interface
Carl Worth [Sat, 23 Oct 2010 00:17:00 +0000 (17:17 -0700)]
test: Add tests for adding/removing tags within emacs interface

Exercising both the notmuch-search and notmuch-show views.

13 years agotest: Add simple tests for navigating notmuch-hello and notmuch-search views
Carl Worth [Sat, 23 Oct 2010 00:02:07 +0000 (17:02 -0700)]
test: Add simple tests for navigating notmuch-hello and notmuch-search views

We simulate the act of selecting the "inbox" saved search from
notmuch-hello and the act of selecting a desired thread from the
notmuch-search results.

The test for the navigation of notmuch-hello is currently marked as
BROKEN since its output is in the opposite order compared to the
'(notmuch-search "tag:inbox")' test. This question of ordering is a
currently open issue on the notmuch mailing list, so we'll let the
test suite reflect that for now.

Finally, this commit also abstracts some common emacs lisp code,
(waiting for the current buffer's process to complete), into a new
notmuch-test-wait function that is made available to anything calling
test_emacs.

13 years agotest: Add a new test_expect_equal_failure
Carl Worth [Sat, 23 Oct 2010 00:01:34 +0000 (17:01 -0700)]
test: Add a new test_expect_equal_failure

Which allows us to have a known-broken test that would otherwise use
test_expect_equal.

13 years agotest: Add tests for emacs notmuch-search and notmuch-show functions.
Carl Worth [Fri, 22 Oct 2010 23:32:38 +0000 (16:32 -0700)]
test: Add tests for emacs notmuch-search and notmuch-show functions.

Moving the expected output into individual files (rather than inline)
to keep the test script much easier to read.

13 years agoemacs: Remove the joke from the first line of the notmuch-hello view.
Carl Worth [Fri, 22 Oct 2010 19:12:22 +0000 (12:12 -0700)]
emacs: Remove the joke from the first line of the notmuch-hello view.

Overuse just makes the joke unfunny.

13 years agotest: Add the most rudimentary testing of the emacs interface.
Carl Worth [Fri, 22 Oct 2010 19:10:15 +0000 (12:10 -0700)]
test: Add the most rudimentary testing of the emacs interface.

So far, this is doing nothing more than adding a corpus of email and
ensuring that the `notmuch-hello' function produces the desired
output.

13 years agotest: Add a new test_emacs function to test-lib.sh
Carl Worth [Fri, 22 Oct 2010 19:05:17 +0000 (12:05 -0700)]
test: Add a new test_emacs function to test-lib.sh

This should be quite handy for doing automated testing of the
emacs-based functionality in notmuch. This function invokes emacs with
the necessary command-line arguments, (to run in batch mode with no
local initialization, to load the notmuch code from the source
directory, and to ensure an 80-column width).

13 years agotest: Fix add_email_corpus function to be quiet.
Carl Worth [Fri, 22 Oct 2010 19:04:41 +0000 (12:04 -0700)]
test: Fix add_email_corpus function to be quiet.

This simply avoids some unneeded noise in the "make test" output.

13 years agoemacs: Fix notmuch-hello to not break when given a very narrow window.
Carl Worth [Fri, 22 Oct 2010 19:03:34 +0000 (12:03 -0700)]
emacs: Fix notmuch-hello to not break when given a very narrow window.

Simply ensure that some subtractions never result in a negative
number, (since emacs complains when asked to create a string with a
negative length).

13 years agoTODO: Add some notes to fix some recently noted problems.
Carl Worth [Wed, 13 Oct 2010 00:40:17 +0000 (17:40 -0700)]
TODO: Add some notes to fix some recently noted problems.

Just don't want to forget about things that people have pointed out.

13 years agoemacs: Fix bug when parsing a subject cotaining: \[[0-9/]\]
Carl Worth [Thu, 23 Sep 2010 20:21:03 +0000 (13:21 -0700)]
emacs: Fix bug when parsing a subject cotaining: \[[0-9/]\]

That is, a subject with a bracketed set of digits (and optionally a
slash), for example "[2010]" would cause the emacs code to misparse
the search results. Fix this by tweaking the regular expression.

13 years agolib: Fix "make install"
Carl Worth [Tue, 21 Sep 2010 16:09:01 +0000 (09:09 -0700)]
lib: Fix "make install"

This has been broken since the addition of the test sub-directory to our
non-recursive make system.

13 years agotest/README: Document add_email_corpus (and add_message/generate_message)
Carl Worth [Mon, 20 Sep 2010 23:41:31 +0000 (16:41 -0700)]
test/README: Document add_email_corpus (and add_message/generate_message)

While adding the documentation here for add_email_corpus I noticed
that the other email-adding functions in test-lib.sh were not yet
documented here, so add all of that documentation.

13 years agotest: Fix the search and dump-restore tests to operator on non-empty mail store.
Carl Worth [Mon, 20 Sep 2010 23:40:35 +0000 (16:40 -0700)]
test: Fix the search and dump-restore tests to operator on non-empty mail store.

We do this with a new add_email_corpus function that establishes a
mail store with 50 messages from the notmuch mailing list.

13 years agotest: Add a corpus of email messages to be used in testing.
Carl Worth [Mon, 20 Sep 2010 23:37:53 +0000 (16:37 -0700)]
test: Add a corpus of email messages to be used in testing.

This is simply 50 messages from the early history of the notmuch mailing
list, (fetched from the public archives).

13 years agotest: Remove useless NOTMUCH variable (in favor of simply "notmuch")
Carl Worth [Mon, 20 Sep 2010 23:13:15 +0000 (16:13 -0700)]
test: Remove useless NOTMUCH variable (in favor of simply "notmuch")

When the NOTMUCH variable was originally invented it was used as an
explicit path to the notmuch binary being tested. Today, the test
suite sets the PATH variable instead, so the NOTMUCH variable always
has a value of simply "notmuch".

We simplifying that by using the constant value rather than the
continual variable reference.

13 years agotest: Remove some dead code in test-lib.sh
Carl Worth [Mon, 20 Sep 2010 23:09:20 +0000 (16:09 -0700)]
test: Remove some dead code in test-lib.sh

These assignements weren't being used at all and were just confusing me,
(the real assignments happen later on in the file).

13 years agotest: Fix PATH-checking test to work with --valgrind
Carl Worth [Mon, 20 Sep 2010 22:07:26 +0000 (15:07 -0700)]
test: Fix PATH-checking test to work with --valgrind

The --valgrind option munges the PATH variable, so un-munge it before
testing that we have PATH pointing to the source directory.

13 years agolib: Fix use-after-free bug.
Carl Worth [Mon, 20 Sep 2010 22:01:52 +0000 (22:01 +0000)]
lib: Fix use-after-free bug.

Thanks to the new git-based test suite, it's easy to run the whole
test suite in valgrind, (simply "make test OPTIONS="--valgrind"), and
doing so showed this obvious use-after-free bug, (triggered by the
thread-order tests).

13 years agotest: Fix to actually report errors (!).
Carl Worth [Mon, 20 Sep 2010 21:39:40 +0000 (14:39 -0700)]
test: Fix to actually report errors (!).

A bug in the results-aggregation code was causing the test suite to report
"all tests passed" even when there were failures, (as long as there were
also no "broken" tests). Fix this.

13 years agotest: Avoid printing "Testing Testing ..."
Carl Worth [Mon, 20 Sep 2010 21:39:06 +0000 (14:39 -0700)]
test: Avoid printing "Testing Testing ..."

The test suite isn't auditioning for a roadie position, after all.

13 years agotest: Print section names, and rename all test sections
Carl Worth [Mon, 20 Sep 2010 21:36:31 +0000 (14:36 -0700)]
test: Print section names, and rename all test sections

Now that we can usefully pass section names via the NOTMUCH_SKIP_TESTS
environment variable, it's useful to actually print those names out
for the user. Then, since we're now printing these names, let's use
nicer names, (not excessively long but also not using abbreviations
like "msg").

13 years agotest: Make the --valgrind option useful, (and drop --verbose).
Carl Worth [Mon, 20 Sep 2010 21:28:13 +0000 (14:28 -0700)]
test: Make the --valgrind option useful, (and drop --verbose).

In order for --valgrind to be useful, we drop noisy additional output of
all of the commands being executed in verbose mode. This makes --verbose
alone quite useless, so we don't document it any more.

Also, add a zlib valgrind suppression that was showing up frequently in the
test suite.

13 years agotest/README: Update to become notmuch-specific rather than git-specific
Carl Worth [Mon, 20 Sep 2010 21:06:38 +0000 (14:06 -0700)]
test/README: Update to become notmuch-specific rather than git-specific

This file was obviously describing the git test suite previously, and
would have been very hard to understand in the context of the notmuch
test suite. HOpefully it's easier to follow now.

13 years agotest: Rename GIT_SKIP_TESTS to NOTMUCH_SKIP_TESTS
Carl Worth [Mon, 20 Sep 2010 20:54:57 +0000 (13:54 -0700)]
test: Rename GIT_SKIP_TESTS to NOTMUCH_SKIP_TESTS

By scanning test-lib.sh for occurrences of "git" or "GIT", I found
that most of those are internal things, (like the GIT_TEST_TEE_STARTED
variable). But GIT_SKIP_TESTS is part of the user-interface to the
test suite, so we rename it to reference notmuch rather than git.

Also, the GIT_TRACE warning is git-specific, so we drop that as well.

13 years agotest: Fix notmuch-test to pass command-line arguments to sub-scripts.
Carl Worth [Mon, 20 Sep 2010 20:45:29 +0000 (13:45 -0700)]
test: Fix notmuch-test to pass command-line arguments to sub-scripts.

The is useful for things like "notmuch-test --valgrind", etc.

13 years agotest: Fix test suite so that --valgrind option works.
Carl Worth [Mon, 20 Sep 2010 20:42:59 +0000 (13:42 -0700)]
test: Fix test suite so that --valgrind option works.

The output is ugly, and we need a better suppressions file, but this
is at least a start.

13 years agotest: Add test to ensure that all available test scripts are run
Carl Worth [Mon, 20 Sep 2010 19:41:10 +0000 (12:41 -0700)]
test: Add test to ensure that all available test scripts are run

Since we are now using an explicit list of tests to run in
notmuch-test we need to be careful that we don't add a new file of
tests and then forget to add it to the list.

13 years agotest: Rename all tests to get rid of the ugly numbers in file names.
Carl Worth [Fri, 17 Sep 2010 22:58:39 +0000 (15:58 -0700)]
test: Rename all tests to get rid of the ugly numbers in file names.

The numbers were meaningless, and they made it hard to find a file of interest.

Instead, we get the ordering we want by adding an explicit list of
tests to run to the notmuch-test script.

13 years agotest: Remove basic testing of broken, fixed, and skipped tests.
Carl Worth [Fri, 17 Sep 2010 22:30:17 +0000 (15:30 -0700)]
test: Remove basic testing of broken, fixed, and skipped tests.

These were interfering with the aggregate statistics reported at the
end of the test-suite run. (Always reporting 1 broken, 1 fixed, and 1
skipped). The correct way to test the test-suite itself would be to
run the test suite externally for these cases, capture the expected
result, and then report that as a PASS test.

But, really, there's almost no value in these tests anyway. It's
almost to the level of testing that 'if false; exit 1; fi' returns
1. That is, there are so many ways that the test suite could be broken
internally, that these minor tests don't really help.

13 years agotest: Fix ordering of tests in t0000-basic.sh
Carl Worth [Fri, 17 Sep 2010 22:28:53 +0000 (15:28 -0700)]
test: Fix ordering of tests in t0000-basic.sh

The basic notmuch tests depend on the test-suite harness working, so
test it first.

13 years agotest: Rework test-suite input to avoid ulti-command strings
Carl Worth [Fri, 17 Sep 2010 22:25:39 +0000 (15:25 -0700)]
test: Rework test-suite input to avoid ulti-command strings

The original git test suite works by concatenating many commands into
a very long string (each separated by &&). This is painful to work
with since it prevents the editor from helping by parsing the shell
script, indenting, colorizing, etc.

Instead, we switch this back to something like the original notmuch
test suite, and add two new functions to test-lib.sh
(test_begin_subtest and test_expect_equal) to support these.

This also fixes the test suite to once again display the diff when a
test fails to generate the expected input.

13 years agotest: Cleanup the test output
Carl Worth [Fri, 17 Sep 2010 20:53:47 +0000 (13:53 -0700)]
test: Cleanup the test output

This makes the new, git-derived test suite report results in a manner
similar to the original notmuch test suite.

Notable changes include:

  * No more initial '*' on every line
  * Only colorize a single word
  * Don't print useless test numbers
  * Use "PASS" in place of "ok"
  * Begin sentences with a capital letter
  * Print test descriptions for each block
  * Separate each block of tests with a blank line
  * Don't summarize counts between each block

13 years agotest: Fix test suite to integrate with our non-recursive Makefile system.
Carl Worth [Fri, 17 Sep 2010 19:10:54 +0000 (12:10 -0700)]
test: Fix test suite to integrate with our non-recursive Makefile system.

This avoids "make test" emitting messages from three (3!) recursive
invocations of make. We change the invocations of the tests themselves
to occur directly from the shell script rather than having the shell
script invoke make again and using wildcards in the Makefile.

13 years agotest: Set all times to UTC
Michal Sojka [Thu, 10 Jun 2010 06:48:04 +0000 (08:48 +0200)]
test: Set all times to UTC

In order to have repeatable test suite, all times in messages are set
to UTC time zone to match the time zone (TZ variable) set in
test-lib.sh.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
13 years agoConvert the actual tests to the new framework
Michal Sojka [Thu, 10 Jun 2010 06:48:03 +0000 (08:48 +0200)]
Convert the actual tests to the new framework

The changes are:
- The notmuch-test was split into several files (t000?-*.sh).
- Removed helper functions which were moved to test-lib.sh
- Replaced every printf with test_expect_success.
- Test commands chained with && (test-lib.sh doesn't use "set -e" in
  order to complete the test suite even if something fails)
- Many variables such as ${MAIL_DIR} were properly quoted as they
  contain spaces.
- Changed quoting patterns in add_message and generate_message (single
  quotes are already used by the test framework).
- ${TEST_DIR} replaced by ${PWD}

QUICK HOWTO:

To run the whole test suite
    make

To run only a single test
   ./t0001-new.sh

To stop on the first error
   ./t0001-new.sh -i
then mail store and database can be inspected in
"trash directory.t0001-new"

To see the output of tests
   ./t0001-new.sh -v

To not remove trash directory at the end:
   ./t0001-new.sh -d

To run all tests verbosely:
   make GIT_TEST_OPTS="-v"

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
13 years agotest: Update helper functions
Michal Sojka [Thu, 10 Jun 2010 06:48:02 +0000 (08:48 +0200)]
test: Update helper functions

Modify the helper functions to work with git-based test suite i.e.
1) Quote arguments where it is necessary.
2) Do not use $NOTMUCH. It is equal to "notmuch" since $PATH is set to
   the build tree.
3) Modify pass_if_equal to fit into the git-based test suite.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
13 years agoUpdate test framework for use with notmuch
Michal Sojka [Thu, 10 Jun 2010 06:48:01 +0000 (08:48 +0200)]
Update test framework for use with notmuch

This removes Git specific things from the test-lib.sh and adds helper
functions for notmuch taken from Carl's notmuch-test script. README is
also slightly modified to reflect the current state.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
13 years agoCopy test framework from Git
Michal Sojka [Thu, 10 Jun 2010 06:48:00 +0000 (08:48 +0200)]
Copy test framework from Git

Git uses a simple and yet powerful test framework, written in shell.
The framework is easy to use for both users and developers so I think
it would help if it is used in notmuch as well.

This is a copy of Git's test framework from commit
b6b0afdc30e066788592ca07c9a6c6936c68cc11 in git repository.

Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
13 years agoemacs: Allow '|' to operate on multiple messages (by means of prefix argument).
Carl Worth [Thu, 16 Sep 2010 22:52:12 +0000 (15:52 -0700)]
emacs: Allow '|' to operate on multiple messages (by means of prefix argument).

We extend the '|' command so that passing a prefix argument, (for
example, "C-u |"), causes it to pipe all open messages in the current
thread rather than just the single, current message.

13 years agonotmuch show: Add documentation of --format=mbox
Carl Worth [Fri, 20 Aug 2010 00:12:52 +0000 (17:12 -0700)]
notmuch show: Add documentation of --format=mbox

Shame on me for adding a feature without documenting it at the same
time.

13 years agoemacs: Fix line-wrapping for help message of notmuch-show mode.
Carl Worth [Thu, 19 Aug 2010 22:09:55 +0000 (15:09 -0700)]
emacs: Fix line-wrapping for help message of notmuch-show mode.

This was previously wrapped for unsubtituted command names. It looks
much better in the notmuch-help (available with '?') if wrapped
according to the length of the substituted command names.

13 years agoAvoid segmentation fault with NOTMUCH_CONFIG=/new/config/file notmuch setup
Carl Worth [Tue, 20 Jul 2010 00:16:18 +0000 (17:16 -0700)]
Avoid segmentation fault with NOTMUCH_CONFIG=/new/config/file notmuch setup

Since commit f41a35e2923b0b3ef2f66e91cd30e20b4c1a336a running a command
such as:

NOTMUCH_CONFIG=/new/config/file notmuch setup

would result in a segmentation fault.

The purpose of that commit was to ensure that an attempt to manipulate
a non-standard database would not inadvertently manipulate the default
database only due to a typo in the NOTMUCH_CONFIG environment
variable. That is, a command like:

NOTMUCH_CONFIG=mistyped-config-filename notmuch tag -new tag:new

shouldn't modify the database at ${HOME}/mail, but should instead
simply report that the mistype configuration filename does not exist.

We fix both cases simultaneously by reporting the error message
whenever the function calling notmuch_config_open is not explicitly
prepared for a default configuration file.

13 years agoNEWS: Document the new "notmuch show --format=mbox" format
Carl Worth [Wed, 9 Jun 2010 03:21:16 +0000 (20:21 -0700)]
NEWS: Document the new "notmuch show --format=mbox" format

I'm trying to get into the habit of maintaining the NEWS file as I go.

13 years agonotmuch show: Add a --format=mbox option
Carl Worth [Wed, 9 Jun 2010 02:45:54 +0000 (19:45 -0700)]
notmuch show: Add a --format=mbox option

We don't love the mbox format, but it's still sometimes the most
practical way to share a collection of messages as a single file.

Here we implement the "mboxrd" variant of the mbox file format. This
variant applies reversible escaping by prefixing a '>' character to
all lines in the email messages matching the regular expression:

"^>*From "

This allows the escaping to be reliably removed. A reader should remove
a '>' from any line matching the regular expression:

"^>>*From "

More details on the mboxrd formats (and others as well) can be found
here:

http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/mail-mbox-formats.html

13 years agoFix minor style issues in show_part_content function.
Carl Worth [Sat, 5 Jun 2010 15:47:13 +0000 (08:47 -0700)]
Fix minor style issues in show_part_content function.

I was recently editing the code in this function and decided to clean
it up a bit.

13 years agoAvoid giving GMime a NULL MIME-stream filter.
Carl Worth [Sat, 5 Jun 2010 15:40:26 +0000 (08:40 -0700)]
Avoid giving GMime a NULL MIME-stream filter.

Micah Anderson reported an issue where a message failed to display in
the emacs interface, (it instead gave an error, "json-read-string: Bad
string format").

Micah tracked this down to the json output from "notmuch show" being
interrupted by a GMime error message:

gmime-CRITICAL **: g_mime_stream_filter_add: assertion
`GMIME_IS_FILTER (filter)

I tracked this down further to notmuch passing a NULL value to
g_mime_stream_filter_add. And this was due to calling
g_mime_filter_charset_new with a value of "unknown-8bit".

So we add a test message withe a Conten-Type of "text/plain;
charset=unknown-8bit" from Micah's message. Then we fix "notmuch show"
to test for NULL before calling g_mime_stream_filter_add. Bug fixed.

13 years agoAdd C-tab binding in notmuch-search mode as well.
Carl Worth [Sat, 5 Jun 2010 00:16:53 +0000 (17:16 -0700)]
Add C-tab binding in notmuch-search mode as well.

We recently added this to notmuch-hello mode so we might as well
support it in this mode as well for consistency.

13 years agomake install: Run ldconfig or install a DT_RUNPATH in binary as appropriate.
Carl Worth [Fri, 4 Jun 2010 23:52:56 +0000 (16:52 -0700)]
make install: Run ldconfig or install a DT_RUNPATH in binary as appropriate.

Various users were confused as to why they couldn't run notmuch
immediately after "make install", (with linker errors saying that
libnotmuch.so could not be found). The errors came from two different
causes:

1. The user had installed to a system library directory, but had not
   yet run ldconfig.

2. The user had installed to some non-system directory, and had not
   set the LD_LIBRARY_PATH variable.

With this change we fix both problems (on Linux) without the user
having to do anything additional. We first use ldconfig to find the
system library directories. If the user is installing to one of these,
then we run ldconfig as part of "make install".

For case (2) we use the -rpath and --enable-new-dtags linker options
to install a DT_RUNPATH entry in the binary. This entry tells the
dynamic linker where to find libnotmuch. Without the
--enable-new-dtags option only a DT_RPATH option would be installed,
(which has the drawback of not allowing any override with the
LD_LIBRARY_PATH variable).

Distributions (such as Debian and Fedora) don't want to see binaries
packaged with a DT_RPATH or DT_RUNPATH entry. This should be avoided
automatically as long as the packages install to standard locations,
(such as /usr/lib).

13 years agoconfigure: Remove space from IFS (using tab as necessary)
Carl Worth [Fri, 4 Jun 2010 23:51:32 +0000 (16:51 -0700)]
configure: Remove space from IFS (using tab as necessary)

The idea here is to more easily support filenames with spaces in them
in various loops. We're about to add a loop over the paths configured
by the dynamic linker. Hopefully, they wouldn't contain spaces, but
one never knows so we might as well be prepared.