aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2022-01-12test/gpgsm: use --with-colons when calculating fingerprint.David Bremner
As stressed by the gpg documentation, the non-'with-colons' output format is subject to change, and indeed it did in 2.3.x (x<=3). This should make the the test suite more robust against such changes.
2022-01-09Merge branch 'release'David Bremner
2022-01-08python-cffi: returned OwnedMessage objects from Message.repliesDavid Bremner
If we return regular Message objects, python will try to destroy them, and the underlying notmuch object, causing e.g. the crash [1]. [1]: id:87sfu6utxg.fsf@tethera.net
2022-01-08test: add known broken tests for recursive traversal of replies.David Bremner
This reproduces the bug reported at [1]. The second test hints at the solution, making reply return OwnedMessage objects. [1]: id:87sfu6utxg.fsf@tethera.net
2021-12-29Merge branch 'release'David Bremner
2021-12-29lib/open: do not consider .notmuch alone as an existing database.David Bremner
It makes perfect sense for users to want to pre-create .notmuch, e.g. to install hooks, so we should handle the case of a .notmuch directory without an actual xapian database more gracefully.
2021-12-29test/new: add known broken test for missing xapian directory.David Bremner
`notmuch new' should go ahead and create the xapian database if it is missing, even in the case where the parent .notmuch (or equivalent) directory exists.
2021-12-26test: test folder renamesDavid Bremner
In [1] Mark Walters reported a problem with messages being removed from the database when the parent directory was renamed. Jani Nikula proposed [2] these tests but observed This test is not suitable for merging since it's not deterministic. After applying Jani's patch [3], the tests now pass deterministically, and could usefully act as regression tests. [1]: id:87siray6th.fsf@qmul.ac.uk [2]: id:1393191650-28333-1-git-send-email-jani@nikula.org [3]: id:1441445731-4362-2-git-send-email-jani@nikula.org
2021-12-23test: remove directory names from paths in exceptionsDavid Bremner
These cause failures when building out of tree.
2021-12-06test/emacs: mark one test as fixed in newer emacs.David Bremner
The remaining problem in this test is fixed upstream in Emacs 28. While most people are using earlier versions of emacs, the test still provides some documentation of a known bug.
2021-12-04test/new: replace use of gdb in vanishing file testDavid Bremner
Unlike the similar change in T060-new, no symlink creation is needed here.
2021-12-04test/count: replace use of gdb with a LD_PRELOAD shimDavid Bremner
There is a certain amount of boilerplate to pass the call on the original function, so abstract it out as a C preprocessor macro, plus some extra includes in notmuch-test.h
2021-12-04test: move system includes to notmuch-test.hDavid Bremner
This removes some redudant includes, and will also make it easier to introduce "#define _GNU_SOURCE", which must come before all system includes.
2021-12-04lib/config: use g_key_file_get_string to read config valuesDavid Bremner
Unlike the previous g_key_file_get_value, this version processes escape codes for whitespace and \. The remaining two broken tests from the last commit are because "notmuch config get" treats every value as a list, and thus the previously introduces stripping of leading whitespace applies.
2021-12-04test: known broken tests for escape characters in config files.David Bremner
glib generates the following escape characters with their usual meanings: \n, \t, \r, and \\, along with \s for _leading_ spaces. Currently notmuch fails to unescape these on reading the config files. These tests demonstrate this bug; the one new test that passes is because apparently glib only escapes tabs at the beginning of a key.
2021-12-04config: ignore leading/trailing spaces in ';'-delimited listsDavid Bremner
In [1] Ciprian observed that it was easy for users to mistakenly introduce leading and trailing space to new.tags when editing a notmuch config file. This commit strips spaces on either side of the ';' delimiter when splitting. In principle it would be possible to support tags (or other config values) with leading or trailing spaces by processing '\s' escapes in the input string. Currently such processing is not done. [1]: id:CA+Tk8fzjPLaEd3vL1f9ebk_bF_RV8PDTLzDupraTkCLCpJAmCg@mail.gmail.com
2021-12-04test: known broken tests for leading/trailing ws in configDavid Bremner
These tests duplicate the bug/misfeature reported in id:CA+Tk8fzjPLaEd3vL1f9ebk_bF_RV8PDTLzDupraTkCLCpJAmCg@mail.gmail.com
2021-12-04Merge branch 'release'David Bremner
2021-12-04python-cffi: switch to notmuch_database_{open,create}_with_configDavid Bremner
Since release 0.32, libnotmuch provides searching for database and configuration paths. This commit changes the python module notmuch2 to use those facilities. This fixes the bug reported in [1], along with a couple of the deprecation warnings in the python bindings. Database.default_path is deprecated, since it no longer faithfully reflects what libnotmuch is doing, and it is also no longer used in the bindings themselves. This commit choose the default of config=CONFIG.EMPTY (equivalent to passing "" to notmuch_database_open_with_config). This makes the change upward compatible API-wise (at least as far as the test suite verifies), but changing the default to CONFIG.SEARCH would probably be more convenient for bindings users. [1]: id:87h7d4wp6b.fsf@tethera.net
2021-12-04test: add known broken tests for python bindings in split configsDavid Bremner
This reproduces the bug(s) reported in id:87h7d4wp6b.fsf@tethera.net
2021-12-04test: add python-cffi bindings to path for test_pythonDavid Bremner
This will allow testing the new python bindings using test_python, in addition to the current invocation of pytest.
2021-12-03lib/config: don't overwrite database.path if the caller passed itDavid Bremner
If the user passed a path, and we opened it, then we consider that definitive definition of "database.path". This makes libnotmuch respond more gracefully to certain erroneous combinations of NOTMUCH_CONFIG settings and config file contents.
2021-12-03test: add known broken test for conflict with database parameterDavid Bremner
This is arguably user error: having configuration file with bad settings in it (and/or having a bad NOTMUCH_CONFIG environment variable). On the other hand returning a different path than was actually opened is definitely a bug.
2021-12-03test/libconfig: use 'export' for remaining sets of NOTMUCH_CONFIGDavid Bremner
It makes the tests easier to understand if we always use export for environment variables.
2021-12-03rename built_with.sexpr_query to built_with.sexp_queriesDavid Bremner
It is confusing to use two different names (sexp vs sexpr) when compared with the command line option --query=sexp and (furthermore) singular vs plural when compared with the man page title.
2021-10-30lib/load_config: deallocate / NULL database on fatal errorDavid Bremner
This fixes a potential memory leak, and makes the behaviour of notmuch_database_load_config (somewhat) consistent with n_d_{open,create} with config.
2021-10-30lib/load_config: document expectations for db on error, add testsDavid Bremner
This is a bit different than n_d_{open,create}_with_config, since there are several non-zero status codes where we do want to return a non-NULL database structure.
2021-10-30lib/create: fix memory leak, ensure *database=NULL on errorDavid Bremner
This code previously relied on _finish_open to free the notmuch struct on errors (except for the case of database == NULL, which was a potential double free). When we removed those frees from _finish_open, we introduced a (small) memory leak. In this commit, fix the memory leak, and harmonize the on-error behaviour with n_d_open_with_config.
2021-10-30lib/create: document expectations for db on error, add testsDavid Bremner
It seems sensible to harmonize the behaviour with n_d_open_with_config. In this commit we just assert the desired behaviour.
2021-10-30lib/open: fix potential double-free, ensure *database=NULL on errorDavid Bremner
During refactoring for 0.32, the code that set notmuch=NULL on various errors was moved into _finish_open. This meant that the the code which relied on that to set *database to NULL on error was no longer correct. It also introduced a potential double free, since the notmuch struct was deallocated inside _finish_open (via n_d_destroy). In this commit we revert to "allocator frees", and leave any cleanup to the caller of _finish_open. This allows us to get back the behaviour of setting *database to NULL with a small change. Other callers of _finish_open will need free notmuch on errors.
2021-10-30test: add two known broken tests for missing config filesDavid Bremner
The documentation claims that the database will be set to NULL in this case, but it is currently not happening. Based on a reproducer [1] from Austin Ray. [1]: id:20211021190401.imirxau2ewke6e2m@athena
2021-10-27test/libconfig: use 'export' when restoring NOTMUCH_CONFIGDavid Bremner
This is required when NOTMUCH_CONFIG has been unset, and is harmless otherwise.
2021-09-30Merge tag '0.33.2'David Bremner
notmuch 0.33.2 release
2021-09-29test/T355-smime: Use key as exported by gpgsmDavid Bremner
As reported in id:87h7pxiek3.fsf@tethera.net, the previous version of the test is flaky. There is some so-far undebugged interaction between openssl and gpgsm that causes the keys to fail to import. As a potential workaround, use the key as exported by gpgsm, and eliminate openssl from this particular pipeline.
2021-09-11test/emacs: tests for notmuch-{tree,unthreaded} with bad CWDDavid Bremner
These work thanks to the previous wrapping of process creation primitives.
2021-09-11emacs: wrap call-processDavid Bremner
Provide safe working directory
2021-09-11test/emacs: test for notmuch-show with nonexistent CWDDavid Bremner
Somewhat predictably, the other code path in notmuch-call-notmuch--helper also needs to be fixed.
2021-09-11emacs: wrap make-processDavid Bremner
Provide a safe working directory.
2021-09-11test/emacs: test for notmuch-search with nonexistent CWDDavid Bremner
(At least) notmuch-start-notmuch needs to be updated to set a safe working directory.
2021-09-11emacs: wrap call-process-regionDavid Bremner
As with notmuch--process-lines, initial purpose is to provide a safe binding for default-directory. This is enough to make notmuch-hello robust against non-existent or corrupt values default-directory, but probably not other views.
2021-09-11test/emacs: run notmuch-hello with a nonexisting default dirDavid Bremner
This replicates the problem reported in Debian bug #922536.
2021-09-11test/emacs: provide macro test-log-errorDavid Bremner
Because of the way emacs reports errors, a test form can crash and not change the main buffer. To work around this, capture both signalled errors and any other messages.
2021-09-10Merge tag '0.33.1'David Bremner
notmuch 0.33.1 release
2021-09-10lib: use 'localhost' rather than fqdn for default mail address.David Bremner
As discussed in the thread starting at [1], the fully qualified domain name is a bit tricky to get reproducibly, might reveal information people prefer to keep private, and somewhat unlikely to provide reliable mail routing. The new approach of $current_username@localhost is better for the first two considerations, and probably at least as good as a test mail address. [1]: id:87sfyibqhj.fsf@tethera.net
2021-09-08test/emacs: test for functions in notmuch-search-result-format.David Bremner
Based on the commit message in id:20210221151902.2301690-3-dme@dme.org Add the function notmuch-test-result-flags to test-lib.el to avoid repeating it in 3 T*.sh files.
2021-09-04CLI/tag: enable sexp queriesDavid Bremner
We have to rewrite _optimize_tag_query here because it is generating a query string in the infix Xapian syntax. Luckily this is easy to do with the sexp query syntax.
2021-09-04CLI/{count, dump, reindex, reply, show}: enable sexp queriesDavid Bremner
The change in each case is to call notmuch_query_create_with_syntax, relying on the already inherited shared options. As a bonus we get improved error handling from the new query creation API. The remaining subcommand is 'tag', which is a bit trickier.
2021-09-04lib/parse-sexp: apply macrosDavid Bremner
Macros implement lazy evaluation and lexical scope. The former is needed to make certain natural constructs work sensibly (e.g. (tag ,param)) but the latter is mainly future-proofing in case the DSL is is extended to allow local bindings. For technical background, see chapters 6 and 17 of [1] (or some other intermediate programming languages textbook). [1] http://cs.brown.edu/courses/cs173/2012/book/
2021-09-04lib/parse-sexp: support saved s-expression queriesDavid Bremner
It turns out there is not really much code in query-fp.cc useful for supporting the new syntax. The code we could potentially factor out amounts to calling notmuch_database_get_config; both the key construction and the parsing of the results are specific to the query syntax involved.
2021-09-04CLI/config support saving s-expression queriesDavid Bremner
This commit does not enable using saved s-expression queries, only saving and retrieving them from the config file or the database. Use in queries will be enabled in a following commit.