aboutsummaryrefslogtreecommitdiff
path: root/test/T560-lib-error.sh
AgeCommit message (Collapse)Author
2022-09-03lib/open: create database path in some casesDavid Bremner
There is some duplication of code here, but not all of the locations valid to find a database make sense to create. Furthermore we nead two passes, so the control flow in _choose_database_path would get a bit convoluted.
2022-09-03lib/open: return non-SUCCESS on missing database pathDavid Bremner
This simplifies the logic of creating the directory path when it doesn't exist.
2022-06-25test: add known broken test for notmuch_tags_valid (NULL)David Bremner
This should return false, but currently segfaults. Start a new file for tags library API related tests. This is maybe overkill, but new C boilerplate which doesn't corrupt the database is needed anyway.
2022-05-29test: replace deprecated use of notmuch_database_createDavid Bremner
Like notmuch_database_open, we need to conditionally print the error message.
2022-05-29test: replace deprecated use of notmuch_database_openDavid Bremner
This is a bit more involved than replacing the use of notmuch_database_open_verbose, as we have to effectively inline the definition of notmuch_database_open.
2022-05-29test: replace deprecated use of notmuch_database_open_verboseDavid Bremner
We need to do it some day, and it is a bit annoying to read deprecation messages in broken tests.
2021-05-15lib/open: restore default database path of $HOME/mailDavid Bremner
Although this default worked for "notmuch config get", it didn't work most other places. Restore the previous functionality, with the wrinkle that XDG locations will shadow $HOME/mail if they exist. This fixes a bug reported by Jack Kamm in id:87eeefdc8b.fsf@gmail.com
2021-03-20lib/open: support XDG_DATA_HOME as a fallback database location.David Bremner
This changes some error reporting, either intentionally by reporting the highest level missing directory, or by side effect from looking in XDG locations when given null database location.
2021-03-20lib/open: reuse directory checks from n_d_c_with_configDavid Bremner
Make checks more uniform between creating new databases and opening existing ones.
2021-02-06lib: introduce notmuch_database_create_with_configDavid Bremner
This takes a config path parameter, and can use that to decide the new database location.
2020-08-01test: drop use of db_endingDavid Bremner
This will allow the dropping of the test for the default ending from configure.
2020-07-29test: move notmuch_message_* tests to their own fileDavid Bremner
This is for consistency with the recently added tests for notmuch_database_*.
2020-07-22lib: rename _n_d_create to _n_d_find_or_createDavid Bremner
The error message and name were confusing when called in some "read only" context.
2020-07-22lib: fix exception messages for n_m_message_*David Bremner
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.
2020-07-20lib: fix return value for n_m_reindexDavid Bremner
Also update the documentation for the behaviour of n_m_get_thread_id that this fix relies on.
2020-07-20test: add known broken test for n_m_reindex on closed dbDavid Bremner
This is another case where the code should not call INTERNAL_ERROR.
2020-07-20test: regression for retrieving closed db from messageDavid Bremner
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.
2020-07-20test: regression test for destroying message with closed dbDavid Bremner
This should be fine because the message belongs to the database (talloc context wise).
2020-07-20test: regression tests of n_m_freeze and n_m_thaw on closed dbDavid Bremner
Neither of these accesses the database, so should be safe. Add the tests to catch any changes in exception throwing.
2020-07-20lib: handle xapian exception in n_m_remove_all_tagsDavid Bremner
At least the exception we already catch should be reported properly.
2020-07-20test: add broken test for n_m_remove_all_tagsDavid Bremner
The Xapian exception is actually caught here, but the NULL return is not dealt with properly.
2020-07-20test: add regression test for n_m_maildir_flags_to_tagsDavid Bremner
This function currently catches at least the obvious Xapian exceptions and we want to keep it that way.
2020-07-20lib: add notmuch_message_has_maildir_flag_stDavid Bremner
Initially the new function is mainly tested indirectly via the wrapper.
2020-07-20test: add regression test for notmuch_message_has_maildir_flagDavid Bremner
This passes the NULL return inside _ensure_maildir_flags does not break anything. Probably this should be handled more explicitely.
2020-07-18lib: catch exceptions in n_m_get_flag, provide n_m_get_flag_stDavid Bremner
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.
2020-07-14lib: catch Xapian exceptions in n_m_remove_tagDavid Bremner
The churn here is again mainly re-indentation.
2020-07-14test: add broken test for n_m_remove_tagDavid Bremner
Exception will be caught in next commit.
2020-07-14lib: catch Xapian exceptions in n_m_add_tagDavid Bremner
This is mostly just (horizontal) code movement due to wrapping everything in a try / catch.
2020-07-14test: add known broken test for n_m_add_tag with closed dbDavid Bremner
Exception will be caught in next commit.
2020-07-14lib: catch Xapian exceptions in n_m_count_filesDavid Bremner
This will require some care for the caller to check the sign, and not just add error returns into a running total.
2020-07-14test: add known broken test for n_m_count_filesDavid Bremner
This will be fixed in the next commit.
2020-07-14lib: catch Xapian exceptions in n_m_get_tagsDavid Bremner
This allows the function to return an error value rather than crashing.
2020-07-14test: add known broken test for n_m_get_tagsDavid Bremner
This will be fixed in the next commit.
2020-07-14lib: add regression test for n_m_get_date; clarify APIDavid Bremner
This function catches Xapian exceptions. The test is intended to make sure it stays that way.
2020-07-13test: add known broken for n_m_get_flag on closed dbDavid Bremner
Exception caught in next commit. Note that FLAG_GHOST is the only one that triggers the I/O code path.
2020-07-13lib: catch exceptions in n_m_get_filenamesDavid Bremner
This is essentially copied from the change to notmuch_message_get_filename
2020-07-13test: add known broken test for n_m_get_filenamesDavid Bremner
This will be fixed in the next commit
2020-07-13lib/n_m_g_filename: catch Xapian exceptions, document NULL returnDavid Bremner
This is the same machinery as applied for notmuch_message_get_{thread,message}_id
2020-07-13lib: add known broken test for notmuch_message_get_filenameDavid Bremner
This will be fixed in the next commit
2020-07-13lib/n_m_get_replies: doc return, initial regression testDavid Bremner
We need to to set a query and retrieve the threads to meaningfully test this function.
2020-07-13test: add regression test for n_m_get_headerDavid Bremner
This function already catches Xapian exceptions, and we want to make sure it stays that way.
2020-07-13test: drop use of assert in closed db testsDavid Bremner
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).
2020-07-13test: remove unused backup_database callsDavid Bremner
Since these backups are never restored, they should be safe to remove.
2020-07-03lib/message: catch exception in n_m_get_thread_idDavid Bremner
This allows us to return an error value from the library.
2020-07-03test: add known broken test for n_m_get_thread_id on closed dbDavid Bremner
This will be fixed in the next commit.
2020-07-03lib: catch error from closed db in n_m_get_message_idDavid Bremner
By catching it at the library top level, we can return an error value.
2020-07-03test: add known broken test for error handling on closed databaseDavid Bremner
Based on id:87d05je1j6.fsf@powell.devork.be
2017-10-20test: use $(dirname "$0") for sourcing test-lib.shJani Nikula
Don't assume the tests are always run from within the source tree.
2017-08-23database: add n_d_index_file (deprecates n_d_add_message)Daniel Kahn Gillmor
We need a way to pass parameters to the indexing functionality on the first index, not just on reindexing. The obvious place is in notmuch_database_add_message. But since modifying the argument list would break both API and ABI, we needed a new name. I considered notmuch_database_add_message_with_params(), but the functionality we're talking about doesn't always add a message. It tries to index a specific file, possibly adding a message, but possibly doing other things, like adding terms to an existing message, or failing to deal with message objects entirely (e.g. because the file didn't contain a message). So i chose the function name notmuch_database_index_file. I confess i'm a little concerned about confusing future notmuch developers with the new name, since we already have a private _notmuch_message_index_file function, and the two do rather different things. But i think the added clarity for people linking against the future libnotmuch and the capacity for using index parameters makes this a worthwhile tradeoff. (that said, if anyone has another name that they strongly prefer, i'd be happy to go with it) This changeset also adjusts the tests so that we test whether the new, preferred function returns bad values (since the deprecated function just calls the new one). We can keep the deprecated n_d_add_message function around as long as we like, but at the next place where we're forced to break API or ABI we can probably choose to drop the name relatively safely. NOTE: there is probably more cleanup to do in the ruby and go bindings to complete the deprecation directly. I don't know those languages well enough to attempt a fix; i don't know how to test them; and i don't know the culture around those languages about API additions or deprecations.
2017-03-22lib: replace deprecated n_q_count_messages with status returning versionDavid Bremner
This function was deprecated in notmuch 0.21. We re-use the name for a status returning version, and deprecate the _st name. One or two remaining uses of the (removed) non-status returning version fixed at the same time