]> git.notmuchmail.org Git - notmuch/log
notmuch
4 years agotest: regression test for n_m_get_filenames
David Bremner [Sat, 1 Aug 2020 12:25:53 +0000 (09:25 -0300)]
test: regression test for n_m_get_filenames

Closing the database after the iterator is created is not a problem.

4 years agotest: split header for lib-message tests.
David Bremner [Sat, 1 Aug 2020 12:25:52 +0000 (09:25 -0300)]
test: split header for lib-message tests.

This allows finer control over when to close the database.

4 years agotest: add regression test for n_messages_collect_tags
David Bremner [Sat, 1 Aug 2020 12:25:51 +0000 (09:25 -0300)]
test: add regression test for n_messages_collect_tags

Also test n_messages_destroy.

4 years agolib: return NULL from n_d_get_default_indexopts on error
David Bremner [Sat, 1 Aug 2020 12:25:50 +0000 (09:25 -0300)]
lib: return NULL from n_d_get_default_indexopts on error

This is a rare and probably serious programming error, so better not
to silently return a default value.

4 years agobuild: upload html docs as part of release process
David Bremner [Thu, 16 Jul 2020 11:11:26 +0000 (08:11 -0300)]
build: upload html docs as part of release process

Use a URL https://notmuchmail.org/doc/latest to leave room for a
future more ambitious scheme deploying multiple versions.

This also forces the html docs to built as part of the release
process. In the future this should be updated to tolerate generating a
release without sphinx installed. This needs a new target analogous to
build-info and build-man that does nothing if sphinx is not installed.

4 years agotest: drop use of db_ending
David Bremner [Thu, 30 Jul 2020 00:01:30 +0000 (21:01 -0300)]
test: drop use of db_ending

This will allow the dropping of the test for the default ending from
configure.

4 years agotest: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test
David Bremner [Thu, 30 Jul 2020 00:01:29 +0000 (21:01 -0300)]
test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test

Inspired by the suggestion of

         id:20200727154108.16269-3-congdanhqx@gmail.com

to drop the configuration test for the default backend. This version
is hopefully robust against backend changes.

4 years agotest: destroy thread from closed database
David Bremner [Fri, 24 Jul 2020 11:14:06 +0000 (08:14 -0300)]
test: destroy thread from closed database

Check for (non)-crash.

4 years agotest: regression test for n_thread_get_tags
David Bremner [Fri, 24 Jul 2020 11:14:05 +0000 (08:14 -0300)]
test: regression test for n_thread_get_tags

Code is taken from the API docs, with the twist that the underlying
database is closed. Not crashing is the main point.

4 years agotest: add regression tests for oldest and newest dates
David Bremner [Fri, 24 Jul 2020 11:14:04 +0000 (08:14 -0300)]
test: add regression tests for oldest and newest dates

These are strictly to watch for crashes, so don't be too fussy about
the actual timestamps.

4 years agotest: add regression tests for n_t_get_{authors, subject}
David Bremner [Fri, 24 Jul 2020 11:14:03 +0000 (08:14 -0300)]
test: add regression tests for n_t_get_{authors, subject}

This is returning explicitely cached data, so no database access is needed.

4 years agotest: add regression test for n_t_get_messages
David Bremner [Fri, 24 Jul 2020 11:14:02 +0000 (08:14 -0300)]
test: add regression test for n_t_get_messages

This is similar to the case of toplevel messages. Currently everything
is cached, so no database access is necessary. This might change in
the future, but it should not crash in either case.

4 years agotest: add regression tests for n_thread_get_toplevel_messages
David Bremner [Fri, 24 Jul 2020 11:14:01 +0000 (08:14 -0300)]
test: add regression tests for n_thread_get_toplevel_messages

Include a test for the previously omitted non-trivial code path for
notmuch_thread_get_replies.

4 years agotest: add regression test for n_thread_get_total_{messages,files}
David Bremner [Fri, 24 Jul 2020 11:14:00 +0000 (08:14 -0300)]
test: add regression test for n_thread_get_total_{messages,files}

This is returning cached info, so does not need to access the (closed)
database.

4 years agotest: regression test for n_t_get_thread_id
David Bremner [Fri, 24 Jul 2020 11:13:59 +0000 (08:13 -0300)]
test: regression test for n_t_get_thread_id

This is just cached data, so as long as we don't prematurely free
anything, it should be fine.

4 years agotest: regression test for notmuch_query_destroy
David Bremner [Wed, 22 Jul 2020 10:51:27 +0000 (07:51 -0300)]
test: regression test for notmuch_query_destroy

As with other void API entries, not crashing counts as success.

4 years agotest: regression tests for n_q_count_{messages, threads}
David Bremner [Wed, 22 Jul 2020 10:51:26 +0000 (07:51 -0300)]
test: regression tests for n_q_count_{messages, threads}

At least these exceptions are caught.

4 years agotest: regression test for n_q_search_messages
David Bremner [Wed, 22 Jul 2020 10:51:25 +0000 (07:51 -0300)]
test: regression test for n_q_search_messages

Exception handling matches notmuch_query_search_threads, at least for
this case.

4 years agotest: regression test for n_q_search_threads
David Bremner [Wed, 22 Jul 2020 10:51:24 +0000 (07:51 -0300)]
test: regression test for n_q_search_threads

At least this exception is caught.

4 years agotest: add regression test for n_q_add_tag_exclude
David Bremner [Wed, 22 Jul 2020 10:51:23 +0000 (07:51 -0300)]
test: add regression test for n_q_add_tag_exclude

This relies on the change to not tear down the auxilary Xapian
objects, in particular the query parser, when the database is closed.

4 years agotest: regression test for n_q_{set, get}_sort
David Bremner [Wed, 22 Jul 2020 10:51:22 +0000 (07:51 -0300)]
test: regression test for n_q_{set, get}_sort

We just want to make sure accessing the query owned by a closed db
does not cause a crash.

4 years agotest: regression test for set_omit_excluded
David Bremner [Wed, 22 Jul 2020 10:51:21 +0000 (07:51 -0300)]
test: regression test for set_omit_excluded

4 years agotest: regression test for notmuch_query_get_database
David Bremner [Wed, 22 Jul 2020 10:51:20 +0000 (07:51 -0300)]
test: regression test for notmuch_query_get_database

Current functionality is too trivial to really justify a test, but
it's simpler just to test the complete API.

4 years agotest: add regression test for n_q_{create,_get_query_string}
David Bremner [Wed, 22 Jul 2020 10:51:19 +0000 (07:51 -0300)]
test: add regression test for n_q_{create,_get_query_string}

Start a new file of tests, to keep to the (emerging) scheme of one
notmuch_foo group per file

4 years agotest: move notmuch_message_* tests to their own file
David Bremner [Wed, 22 Jul 2020 10:51:18 +0000 (07:51 -0300)]
test: move notmuch_message_* tests to their own file

This is for consistency with the recently added tests for
notmuch_database_*.

4 years agolib: replace use of static_cast for writable databases
David Bremner [Sun, 26 Jul 2020 23:31:36 +0000 (20:31 -0300)]
lib: replace use of static_cast for writable databases

static_cast is a bit tricky to understand and error prone, so add a
second pointer to (potentially the same) Xapian database object that
we know has the right subclass.

4 years agolib: encapsulate the use of notmuch_database_t field 'mode'
David Bremner [Sun, 26 Jul 2020 23:31:35 +0000 (20:31 -0300)]
lib: encapsulate the use of notmuch_database_t field 'mode'

The plan is to change the underlying representation.

4 years agolib: drop two gratuitous assignments to database mode
David Bremner [Sun, 26 Jul 2020 23:31:34 +0000 (20:31 -0300)]
lib: drop two gratuitous assignments to database mode

I'm not sure what the point of modifying that right before destroying
the object is. In a future commit I want to remove that element of the
object, so simplify that task.

4 years agotest: Explicitly state that we want to sign with sender
Jonas Bernoulli [Mon, 27 Jul 2020 15:25:03 +0000 (17:25 +0200)]
test: Explicitly state that we want to sign with sender

Since Emacs 27 'mml-secure-epg-sign' errors out if we don't opt-in to
signing as the sender using 'mml-secure-openpgp-sign-with-sender'.

4 years agotest: Remove misguided emacs testing utilities
Jonas Bernoulli [Mon, 27 Jul 2020 15:25:02 +0000 (17:25 +0200)]
test: Remove misguided emacs testing utilities

The goal of this abstraction was to save space.  But that failed as
the result actually was that four trivial lines got replace with 15
fairly complicated lines.  The opposite of what it was supposed to
do.

Also it made it harder to come up with the fix in the previous commit;
simply grepping for the relevant symbols did not work because they get
constructed at run-time instead of appearing in the source file.

4 years agotest: Deal with Emacs 27 switching to lexical scope by default
Jonas Bernoulli [Mon, 27 Jul 2020 15:25:01 +0000 (17:25 +0200)]
test: Deal with Emacs 27 switching to lexical scope by default

Starting with Emacs 27 undeclared variables in evaluated interactive
code uses lexical scope.  This includes code passed with '--eval' as
we do in the Emacs tests, which also happen to assume dynamic scope.

- This can affect variables defined by libraries that we use.  We
  let-bind such variables to change the behavior of functions which we
  then call with these bindings in effect.  If these libraries are not
  loaded beforehand, then the bindings are lexical and fail to have
  the effect we intended.

  At this time only 'smtpmail' has to be loaded explicitly (for the
  variables let-bound in emacs_deliver_message and emacs_fcc_message).

  'message' doesn't have to be loaded explicitly, because loading
  'notmuch' (in 'run_emacs') already takes care of that, indirectly.

- Our own testing-only variables also have to be declared explicitly.
  We should have done that anyway, but because of how and where these
  variables are used it was very easy to overlook that (i.e. it isn't
  something the byte-compiler ever looks at).  Not so in Emacs 27
  anymore; here this oversight caused four tests to fail.

  The numeric values of these variables get incremented by functions
  that we add to hooks that are run by many tests, not just the tests
  where we actually inspect the value and therefore take care to let-
  bind the values to 0 before we begin.  The global values therefore
  have to be numeric values as well.  I have chosen -100 instead of 0
  as the default in case someone writes a test that inspects the value
  but forgets to let-bind the value.  I hope that the unusual negative
  value that one is going to see in such a case will help debugging
  the issue.

4 years agogitignore: Ignore generated sphinx.config
Jonas Bernoulli [Mon, 27 Jul 2020 15:25:00 +0000 (17:25 +0200)]
gitignore: Ignore generated sphinx.config

4 years agotest: add known broken test for n_d_get_default_indexopts
David Bremner [Sun, 19 Jul 2020 13:11:13 +0000 (10:11 -0300)]
test: add known broken test for n_d_get_default_indexopts

Xapian exceptions are swallowed and turned into default return value.

4 years agolib: fix error return bug with n_d_set_config.
David Bremner [Sun, 19 Jul 2020 12:51:03 +0000 (09:51 -0300)]
lib: fix error return bug with n_d_set_config.

The catch block either needs to return, or the function needs to
return "status". Choose the latter for consistency with
n_d_get_config.

4 years agotest: add known broken test for n_d_set_config
David Bremner [Sun, 19 Jul 2020 12:44:05 +0000 (09:44 -0300)]
test: add known broken test for n_d_set_config

Error status is currently lost.

4 years agotest: add regression test for n_d_get_config
David Bremner [Sun, 19 Jul 2020 12:39:16 +0000 (09:39 -0300)]
test: add regression test for n_d_get_config

Xapian exceptions seem to handled OK, at least for this case.

4 years agolib: add regresion test for n_d_get_all_tags
David Bremner [Sun, 19 Jul 2020 10:57:39 +0000 (07:57 -0300)]
lib: add regresion test for n_d_get_all_tags

Existing error handling seems adequate, if not ideal.

4 years agolib: add regression test for n_d_find_message_by_filename
David Bremner [Sun, 19 Jul 2020 10:43:36 +0000 (07:43 -0300)]
lib: add regression test for n_d_find_message_by_filename

At least this Xapian exception is caught. Make sure it stays that way.

4 years agolib: rename _n_d_create to _n_d_find_or_create
David Bremner [Sun, 19 Jul 2020 10:36:47 +0000 (07:36 -0300)]
lib: rename _n_d_create to _n_d_find_or_create

The error message and name were confusing when called in some "read
only" context.

4 years agotest: add known broken test for notmuch_database_remove_message
David Bremner [Sun, 19 Jul 2020 10:13:06 +0000 (07:13 -0300)]
test: add known broken test for notmuch_database_remove_message

The current error message is a bit confusing; fix in next commit.

4 years agolib: convert relative filenames to absolute in n_d_index_file
David Bremner [Sun, 19 Jul 2020 00:11:28 +0000 (21:11 -0300)]
lib: convert relative filenames to absolute in n_d_index_file

The API docs promise to handle relative filenames, but the code did
not do it.

Also check for files outside the mail root, as implied by the API
description.

This fixes the bug reported at

     id:87sgdqo0rz.fsf@tethera.net

4 years agotest: add known broken test for indexing relative path
David Bremner [Fri, 17 Jul 2020 11:02:14 +0000 (08:02 -0300)]
test: add known broken test for indexing relative path

The current code seems to look for the path relative to the current
working directory, rather than the mail store root.

4 years agotest: regression test for n_d_index_file closed db
David Bremner [Fri, 17 Jul 2020 10:51:24 +0000 (07:51 -0300)]
test: regression test for n_d_index_file closed db

Current exception handling seems OK, at least for this case.

4 years agotest: add regression test for n_d_get_directory
David Bremner [Fri, 17 Jul 2020 10:38:09 +0000 (07:38 -0300)]
test: add regression test for n_d_get_directory

At least this exception is already handled correctly.

4 years agotest: regression test for n_d_get_revision
David Bremner [Thu, 16 Jul 2020 23:04:12 +0000 (20:04 -0300)]
test: regression test for n_d_get_revision

This function only accesses data cached by notmuch, so being closed is
not a problem.

4 years agotest: add regression test for n_d_{begin,end}_atomic
David Bremner [Thu, 16 Jul 2020 22:48:19 +0000 (19:48 -0300)]
test: add regression test for n_d_{begin,end}_atomic

Xapian currently succeeds to begin/end a transaction on a closed database,
or at least does not throw an exception. Make the test robust against
this changing.

4 years agotest: regression test for n_d_upgrade
David Bremner [Thu, 16 Jul 2020 22:34:02 +0000 (19:34 -0300)]
test: regression test for n_d_upgrade

The logic is that if it's acceptable to return SUCCESS for read only
database, it's acceptable for a closed one.

4 years agolib/n_d_needs_upgrade: handle error return from n_d_get_version
David Bremner [Thu, 16 Jul 2020 22:28:22 +0000 (19:28 -0300)]
lib/n_d_needs_upgrade: handle error return from n_d_get_version

Also clarify documentation of error return from n_d_needs_upgrade.

4 years agotest: add known broken test for n_d_needs_upgrade
David Bremner [Thu, 16 Jul 2020 22:22:05 +0000 (19:22 -0300)]
test: add known broken test for n_d_needs_upgrade

It's a bit arbitrary which value to return for errors, but the same
argument as for read only databases applies for errors.

4 years agotest: add regression tests for notmuch database destroy
David Bremner [Thu, 16 Jul 2020 02:05:54 +0000 (23:05 -0300)]
test: add regression tests for notmuch database destroy

Either an open or closed database should be ok to destroy

4 years agotest: regression test for closing a closed database
David Bremner [Thu, 16 Jul 2020 01:59:58 +0000 (22:59 -0300)]
test: regression test for closing a closed database

This does not currently throw an error, and it should stay that way.

4 years agolib/n_d_get_version: catch exceptions and clarify the API
David Bremner [Tue, 14 Jul 2020 22:31:10 +0000 (19:31 -0300)]
lib/n_d_get_version: catch exceptions and clarify the API

notmuch_database_get_version previously returned 0 on some errors, but
did not document this. Luckily 0 is not a valid database version.

4 years agolib: move deallocation of memory from n_d_close to n_d_destroy
David Bremner [Tue, 14 Jul 2020 11:25:28 +0000 (08:25 -0300)]
lib: move deallocation of memory from n_d_close to n_d_destroy

In order to mimic the "best effort" API of Xapian to provide
information from a closed database when possible, do not
destroy the Xapian database object too early.

Because the pointer to a Xapian database is no longer nulled on close,
introduce a flag to track whether the notmuch database is open or not.

4 years agotest: add known broken test for n_d_get_version on closed db
David Bremner [Tue, 14 Jul 2020 00:30:52 +0000 (21:30 -0300)]
test: add known broken test for n_d_get_version on closed db

This should not crash, but it does currently.

4 years agotest: regression tests for n_d_status_string and n_d_get_path
David Bremner [Tue, 14 Jul 2020 00:21:03 +0000 (21:21 -0300)]
test: regression tests for n_d_status_string and n_d_get_path

These do not crash on a closed database, and we want to keep it that
way.

Start a new file of tests as T560-lib-error was starting to get unwieldy.

4 years agolib: fix exception messages for n_m_message_*
David Bremner [Wed, 22 Jul 2020 11:19:28 +0000 (08:19 -0300)]
lib: fix exception messages for n_m_message_*

The original generic handler had an extra '%s' in the format
string. Update tests that failed to catch this because the template to
print status strings checked 'stat', which was not set.

4 years agotest: sanitize line numbers in exception reports
David Bremner [Wed, 22 Jul 2020 11:35:42 +0000 (08:35 -0300)]
test: sanitize line numbers in exception reports

Prevent test suite churn when reported line numbers change.

4 years agoemacs: notmuch-search: avoid wiping out buffer-local variables
Sean Whitton [Wed, 22 Jul 2020 15:11:32 +0000 (08:11 -0700)]
emacs: notmuch-search: avoid wiping out buffer-local variables

4 years agolib: fix return value for n_m_reindex
David Bremner [Thu, 9 Jul 2020 00:17:09 +0000 (21:17 -0300)]
lib: fix return value for n_m_reindex

Also update the documentation for the behaviour of n_m_get_thread_id
that this fix relies on.

4 years agotest: add known broken test for n_m_reindex on closed db
David Bremner [Thu, 9 Jul 2020 00:17:08 +0000 (21:17 -0300)]
test: add known broken test for n_m_reindex on closed db

This is another case where the code should not call INTERNAL_ERROR.

4 years agotest: regression for retrieving closed db from message
David Bremner [Thu, 9 Jul 2020 00:17:07 +0000 (21:17 -0300)]
test: regression for retrieving closed db from message

This is actually one of the few potentially useful things you can do
with a message belonging to a closed database, since in principle you
could re-open the database.

4 years agotest: regression test for destroying message with closed db
David Bremner [Thu, 9 Jul 2020 00:17:06 +0000 (21:17 -0300)]
test: regression test for destroying message with closed db

This should be fine because the message belongs to the
database (talloc context wise).

4 years agotest: regression tests of n_m_freeze and n_m_thaw on closed db
David Bremner [Thu, 9 Jul 2020 00:17:05 +0000 (21:17 -0300)]
test: regression tests of n_m_freeze and n_m_thaw on closed db

Neither of these accesses the database, so should be safe. Add the
tests to catch any changes in exception throwing.

4 years agolib: handle xapian exception in n_m_remove_all_tags
David Bremner [Thu, 9 Jul 2020 00:17:04 +0000 (21:17 -0300)]
lib: handle xapian exception in n_m_remove_all_tags

At least the exception we already catch should be reported properly.

4 years agotest: add broken test for n_m_remove_all_tags
David Bremner [Thu, 9 Jul 2020 00:17:03 +0000 (21:17 -0300)]
test: add broken test for n_m_remove_all_tags

The Xapian exception is actually caught here, but the NULL return is
not dealt with properly.

4 years agotest: add regression test for n_m_maildir_flags_to_tags
David Bremner [Thu, 9 Jul 2020 00:17:02 +0000 (21:17 -0300)]
test: add regression test for n_m_maildir_flags_to_tags

This function currently catches at least the obvious Xapian exceptions
and we want to keep it that way.

4 years agocli/new: replace newly deprecated n_m_has_maildir_flag
David Bremner [Mon, 13 Jul 2020 23:51:07 +0000 (20:51 -0300)]
cli/new: replace newly deprecated n_m_has_maildir_flag

Boolean return values have no out-of-band-values to signal errors. The
change here is that a (somewhat unlikely) fatal error after indexing
will now be caught.

4 years agolib: add notmuch_message_has_maildir_flag_st
David Bremner [Thu, 9 Jul 2020 00:17:01 +0000 (21:17 -0300)]
lib: add notmuch_message_has_maildir_flag_st

Initially the new function is mainly tested indirectly via the
wrapper.

4 years agotest: add regression test for notmuch_message_has_maildir_flag
David Bremner [Thu, 9 Jul 2020 00:17:00 +0000 (21:17 -0300)]
test: add regression test for notmuch_message_has_maildir_flag

This passes the NULL return inside _ensure_maildir_flags does not
break anything. Probably this should be handled more explicitely.

4 years agoconfigure: replace multiple redirects with redirected block
David Bremner [Wed, 15 Jul 2020 12:36:27 +0000 (09:36 -0300)]
configure: replace multiple redirects with redirected block

This belatedly implements Tomi's suggestion from

     id:m25zaukv6u.fsf@guru.guru-group.fi

4 years agobindings/ruby: replacy use of deprecated notmuch_message_get_flag
David Bremner [Sat, 11 Jul 2020 18:30:08 +0000 (15:30 -0300)]
bindings/ruby: replacy use of deprecated notmuch_message_get_flag

Depending on the flag, this actually can return an errror, so raise a
ruby exception if so.

4 years agolib/thread: replace use of deprecated notmuch_message_get_flag
David Bremner [Sat, 11 Jul 2020 18:30:07 +0000 (15:30 -0300)]
lib/thread: replace use of deprecated notmuch_message_get_flag

This adds one more reason why _notmuch_thread_create might return
NULL, but those were not previously enumerated, so no promises are
broken.

4 years agolib/add-message: drop use of deprecated notmuch_message_get_flag.
David Bremner [Sat, 11 Jul 2020 18:30:06 +0000 (15:30 -0300)]
lib/add-message: drop use of deprecated notmuch_message_get_flag.

As a side effect, we revert the switch from notmuch_bool_t to bool
here. This is because those two types are not actually compatible when
passing by reference.

4 years agocli/show: replace deprecated notmuch_message_get_flag
David Bremner [Sat, 11 Jul 2020 18:30:05 +0000 (15:30 -0300)]
cli/show: replace deprecated notmuch_message_get_flag

This can be seen as moving an abort out of the library, into the CLI
where we can both print to stderr and shut the process down without
ill effect.

4 years agocli/search: replace deprecated notmuch_message_get_flag
David Bremner [Sat, 11 Jul 2020 18:30:04 +0000 (15:30 -0300)]
cli/search: replace deprecated notmuch_message_get_flag

Our handling of errors is all or nothing here, but it's an improvement
on the status quo, and it avoids rippling internal API changes.

4 years agolib: catch exceptions in n_m_get_flag, provide n_m_get_flag_st
David Bremner [Sat, 4 Jul 2020 15:18:05 +0000 (12:18 -0300)]
lib: catch exceptions in n_m_get_flag, provide n_m_get_flag_st

It's not very nice to return FALSE for an error, so provide
notmuch_message_get_flag_st as a migration path.

Bump LIBNOTMUCH_MINOR_VERSION because the API is extended.

4 years agoconfigure: make sure WITH_PYTHON_DOCS is initialized
David Bremner [Thu, 16 Jul 2020 18:59:45 +0000 (15:59 -0300)]
configure: make sure WITH_PYTHON_DOCS is initialized

Thanks to pazz for reporting the problem.

4 years agodoc: add new python bindings to main documentation tree.
David Bremner [Sat, 11 Jul 2020 13:20:27 +0000 (10:20 -0300)]
doc: add new python bindings to main documentation tree.

A separate conf.py and doc directory (or will be needed if someone wants
to build the bindings docs separately from notmuch.

4 years agodoc: replace use of environment variables with a generated config
David Bremner [Sat, 11 Jul 2020 13:20:26 +0000 (10:20 -0300)]
doc: replace use of environment variables with a generated config

It is getting unwieldy to pass configuration options on the
sphinx-build command line, and I anticipate further use of
conditionals.

As far as I could tell, execing a string is the idiomatic way to
emulate include in Python.

4 years agolib: use COERCE_STATUS in n_m_{add,remove}_tag
David Bremner [Sun, 5 Jul 2020 13:00:26 +0000 (10:00 -0300)]
lib: use COERCE_STATUS in n_m_{add,remove}_tag

Currently I don't know of a good way of testing this, but at least in
principle a Xapian exception in _notmuch_message_{add,remove}_term
would cause an abort in the library.

4 years agolib: catch Xapian exceptions in n_m_remove_tag
David Bremner [Sun, 5 Jul 2020 13:00:25 +0000 (10:00 -0300)]
lib: catch Xapian exceptions in n_m_remove_tag

The churn here is again mainly re-indentation.

4 years agotest: add broken test for n_m_remove_tag
David Bremner [Sun, 5 Jul 2020 13:00:24 +0000 (10:00 -0300)]
test: add broken test for n_m_remove_tag

Exception will be caught in next commit.

4 years agolib: catch Xapian exceptions in n_m_add_tag
David Bremner [Sun, 5 Jul 2020 13:00:23 +0000 (10:00 -0300)]
lib: catch Xapian exceptions in n_m_add_tag

This is mostly just (horizontal) code movement due to wrapping
everything in a try / catch.

4 years agotest: add known broken test for n_m_add_tag with closed db
David Bremner [Sun, 5 Jul 2020 13:00:22 +0000 (10:00 -0300)]
test: add known broken test for n_m_add_tag with closed db

Exception will be caught in next commit.

4 years agolib: catch Xapian exceptions in n_m_count_files
David Bremner [Sun, 5 Jul 2020 13:00:21 +0000 (10:00 -0300)]
lib: catch Xapian exceptions in n_m_count_files

This will require some care for the caller to check the sign, and not
just add error returns into a running total.

4 years agotest: add known broken test for n_m_count_files
David Bremner [Sun, 5 Jul 2020 13:00:20 +0000 (10:00 -0300)]
test: add known broken test for n_m_count_files

This will be fixed in the next commit.

4 years agolib: catch Xapian exceptions in n_m_get_tags
David Bremner [Sun, 5 Jul 2020 13:00:19 +0000 (10:00 -0300)]
lib: catch Xapian exceptions in n_m_get_tags

This allows the function to return an error value rather than
crashing.

4 years agotest: add known broken test for n_m_get_tags
David Bremner [Sun, 5 Jul 2020 13:00:18 +0000 (10:00 -0300)]
test: add known broken test for n_m_get_tags

This will be fixed in the next commit.

4 years agolib: use LOG_XAPIAN_EXCEPTION in n_m_get_date
David Bremner [Sun, 5 Jul 2020 13:00:17 +0000 (10:00 -0300)]
lib: use LOG_XAPIAN_EXCEPTION in n_m_get_date

This should not change functionality, but does slightly reduce code
duplication. Perhaps more importantly it allows consistent changes to
all of the similar exception handling in message.cc.

4 years agolib: add regression test for n_m_get_date; clarify API
David Bremner [Sun, 5 Jul 2020 13:00:16 +0000 (10:00 -0300)]
lib: add regression test for n_m_get_date; clarify API

This function catches Xapian exceptions. The test is intended to make
sure it stays that way.

4 years agotest: add known broken for n_m_get_flag on closed db
David Bremner [Sat, 4 Jul 2020 14:22:25 +0000 (11:22 -0300)]
test: add known broken for n_m_get_flag on closed db

Exception caught in next commit. Note that FLAG_GHOST is the only one
that triggers the I/O code path.

4 years agolib: catch exceptions in n_m_get_filenames
David Bremner [Sat, 4 Jul 2020 14:09:09 +0000 (11:09 -0300)]
lib: catch exceptions in n_m_get_filenames

This is essentially copied from the change to notmuch_message_get_filename

4 years agotest: add known broken test for n_m_get_filenames
David Bremner [Sat, 4 Jul 2020 14:06:37 +0000 (11:06 -0300)]
test: add known broken test for n_m_get_filenames

This will be fixed in the next commit

4 years agolib/n_m_g_filename: catch Xapian exceptions, document NULL return
David Bremner [Sat, 4 Jul 2020 12:20:31 +0000 (09:20 -0300)]
lib/n_m_g_filename: catch Xapian exceptions, document NULL return

This is the same machinery as applied for

     notmuch_message_get_{thread,message}_id

4 years agolib: add known broken test for notmuch_message_get_filename
David Bremner [Sat, 4 Jul 2020 12:16:30 +0000 (09:16 -0300)]
lib: add known broken test for notmuch_message_get_filename

This will be fixed in the next commit

4 years agolib/n_m_get_replies: doc return, initial regression test
David Bremner [Sat, 4 Jul 2020 12:09:09 +0000 (09:09 -0300)]
lib/n_m_get_replies: doc return, initial regression test

We need to to set a query and retrieve the threads to meaningfully
test this function.

4 years agotest: add regression test for n_m_get_header
David Bremner [Sat, 4 Jul 2020 11:35:08 +0000 (08:35 -0300)]
test: add regression test for n_m_get_header

This function already catches Xapian exceptions, and we want to make
sure it stays that way.

4 years agolib/message: use LOG_XAPIAN_EXCEPTION in n_m_get_header
David Bremner [Sat, 4 Jul 2020 11:33:41 +0000 (08:33 -0300)]
lib/message: use LOG_XAPIAN_EXCEPTION in n_m_get_header

This is just for consistency, and a small reduction in the amount of
boilerplate.

4 years agotest: drop use of assert in closed db tests
David Bremner [Sat, 4 Jul 2020 12:29:41 +0000 (09:29 -0300)]
test: drop use of assert in closed db tests

Instead of printing the same static string for each test, can replace
the assert with something simpler (or at least easier to integrate
into the test suite).

4 years agotest: remove unused backup_database calls
David Bremner [Sat, 4 Jul 2020 11:12:21 +0000 (08:12 -0300)]
test: remove unused backup_database calls

Since these backups are never restored, they should be safe to remove.