summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2021-06-08test: check openssl prequisite for add_gpgsm_homeDavid Bremner
This is a fix for the test failures reported by Dan Čermák [1]. It is more robust to check for the prerequisite inside the function that uses it, rather than in every test file that calls the function. [1]: id:87k0n4fqgm.fsf@tethera.net
2021-05-22lib/n_d_index_file: re-use thread-id of existing messageDavid Bremner
This prevents the message document getting multiple thread-id terms when there are multiple files with the same message-id. This change shifts some thread ids, requiring adjustments to other tests.
2021-05-22test: add known broken test for duplicate thread-id termsDavid Bremner
According to my bijection, this bug has been present since commit 411675a6ce in 2017. It is not completely clear what harm it causes in regulary use, but it (at least) makes notmuch crash when compiled with -DDEBUG_DATABASE_SANITY.
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-05-15emacs: restore tag-changes and query bindings for tag hooksKyle Meyer
notmuch-before-tag-hook and notmuch-after-tag-hook are supposed to have access to two dynamic variables, tag-changes and query, but these were lost with the switch to lexical binding in fc4cda07 (emacs: use lexical-bindings in all libraries, 2021-01-13). Add a variant of Emacs's dlet (not available until Emacs 28) and use it in notmuch-tag to expose tag-changes and query to the hooks.
2021-05-15test: add known broken tests for notuch-{before,after}-tag-hookDavid Bremner
These tests illustrate the bug reported in id:87v97ytd2s.fsf@fastmail.fm
2021-05-12lib/notmuch_database_reopen: reload some database metadataDavid Bremner
In some uses of reopen, new documents and threads maybe have been added, and e.g. compaction may have changed the uuid.
2021-05-12test: change database from within pre-new hookMichael J Gruber
Due to the change in the config system, notmuch keeps a notmuch database open when it would not do so before. Consequently, it can miss changes to the database which are done from a hook (while notmuch holds the databse in read only mode). When notmuch itself writes to the database after that it uses wrong assumptions about the last used doc id etc. Demonstrate this by triggering an assertion. (This new test succeeds with notmuch 0.31.4.) Signed-off-by: Michael J Gruber <git@grubix.eu> Amended-by: db. Check for both messages
2021-05-10test: test explicit configuration of backup directoryDavid Bremner
Including the relative path that was broken until a recent commit.
2021-05-10test: test relative paths for database.hook_dirDavid Bremner
2021-05-10lib/config: expand relative paths when reading from databaseDavid Bremner
This makes the treatment of relative paths consistent between the database and config files.
2021-05-10test: add known broken test for relative setting of mail_rootDavid Bremner
The behaviour should not change depending on where the configuration is stored.
2021-05-10lib/config: canonicalize paths relative to $HOME.David Bremner
Prior to 0.32, notmuch had the (undocumented) behaviour that it expanded a relative value of database.path with respect to $HOME. In 0.32 this was special cased for database.path but broken for database.mail_root, which causes problems for at least notmuch-new when database.path is set to a relative path. The change in T030-config.sh reflects a user visible, but hopefully harmless behaviour change; the expanded form of the paths will now be printed by notmuch config.
2021-05-10test: add known broken test for relative database path in newDavid Bremner
This test highlights a bug introduced in 0.32. The new split between path and mail_root does not properly canonicalize relative paths in the latter.
2021-04-26test: hide message from moreutils parallel.David Bremner
The argument --version confuses moreutils parallel, but this is OK, because its confusing does not include printing "GNU"
2021-04-24test: check for GNU parallel with --version optionsTobias Backer Dirks
The lastest versions of GNU parallel no longer make mention of GNU within their help output. This causes the test script to mistakenly use the moreutils parallel execution. In order to fix this, while maintaining compatibility with previous versions of GNU parallel, --version should be used. Signed-off-by: Tobias Backer Dirks <omgitsaheadcrab@gmail.com>
2021-04-24test: replace notmuch_passwd_sanitize with python versionDavid Bremner
Apparently the -f option to hostname is not portable, and in fact it does not seem to always behave reasonably in e.g. a chroot. Python code originally due to Tomi [1], modified by yours truly. [1]: id:m2lf9fbkug.fsf@guru.guru-group.fi
2021-04-18test-lib: unset XDG_CONFIG_HOMEĐoàn Trần Công Danh
lib/open.cc:_load_key_file will only open xdg-config files in $XDG_CONFIG_HOME if it's defined, $HOME/.config will be considered if and only if XDG_CONFIG_HOME not defined. Let's unset said variable before running the test.
2021-04-16test: put shim at end of LD_PRELOAD pathDavid Bremner
Certain tools like the address-sanitizer fail if they are not the first LD_PRELOADed library. It does not seem to matter for our shims, as long as they are loaded before libnotmuch.
2021-04-06CLI/config: remove calls to notmuch_config_open from top levelDavid Bremner
This will allow simplifying the subcommand interface. Change the internal API to notmuch_config_open to not tie it to the implementation of subcommands in notmuch.c. It also fixes a previously broken test, since notmuch_config_open does not understand the notion of the empty string as a config file name.
2021-03-27CLI/config: support set/get with split configurationDavid Bremner
There are two small code changes. The main one is to retrieve the possibly updated config file name found during the database opening call. The second change is to allow empty config file names, as a (currently broken) way of specifying that configuration should only be taken from the database.
2021-03-27CLI+lib: detect missing database in split configurations.David Bremner
Eventually we want to do all opening of databases in the top level (main function). This means that detection of missing databases needs to move out of subcommands. It also requires updating the library to use the new NO_DATABASE status code.
2021-03-27CLI/config: default to storing all config in external filesDavid Bremner
Previously the fact that some configuration options were only stored in the database (and thus editing the config file had no effect) was a source of user confusion. This was fixed with the series ending at d9af0af1646. On the other hand, the underlying partition of config options into those stored by default in the database and those stored in the config file remained. This is also confusing, since now some invocations of "notmuch config set" modify the config file, and others silently modify the database instead. With this commit, it is up to the user to decide which configuration to modify. A new "--database" option is provided for notmuch config to enable modifying the configuration information in the database; otherwise the default is to update an external config file.
2021-03-27CLI/config: use notmuch_database_reopenDavid Bremner
This allows `notmuch config` to use the common configuration information carried by the notmuch_database_t opened at the top level.
2021-03-27CLI/config: migrate notmuch_config_open to new configDavid Bremner
notmuch_config_open will be preserved in the medium term for use by the commands that are manipulating the config file directly (config and setup)
2021-03-27CLI/config: switch "notmuch config list" to merged configDavid Bremner
Use the database opened at the top level rather than opening another notmuch_database_t. Test output changes because keys are now listed in alphabetical order, and because a missing database is no longer an error.
2021-03-27test/setup: check file output instead of notmuch config listDavid Bremner
This allows verification of comments added to new / updated config file.
2021-03-27CLI/config: use merged config for "config get"David Bremner
This commit starts the conversion of notmuch-config.c functionality (as opposed to just interface) to the new config framework. The change to T030-config is because of the move of the canonicalization database paths from the notmuch_config_t accessor to the internal function _choose_database_path.
2021-03-27lib/config: set default for primary user emailDavid Bremner
This is mainly copying code from the CLI into the lib. The CLI copy will be deleted in a later commit.
2021-03-27lib/config: set defaults for user full nameDavid Bremner
This just copies code from from the CLI into the library. New test infrastructure is needed because apparently we have never tested this code path.
2021-03-27lib/config: add config_pairs iteratorsDavid Bremner
The layer of shims here seems a bit wasteful compared to just calling the corresponding string map functions directly, but it allows control over the API (calling with notmuch_database_t *) and flexibility for future changes.
2021-03-27lib/config: add notmuch_config_get_values_stringDavid Bremner
This is to support the less common (at least in the notmuch codebase) case of accessing a ;-delimited list config value with an arbitrary string key.
2021-03-27lib: provide notmuch_database_load_configDavid Bremner
This is mainly targetted at notmuch-config.c, or similar applications that don't necessarily need both a configuration file and a database to exist.
2021-03-27test: convert random-corpus to use n_d_open_with_configDavid Bremner
Remove one more usage of notmuch_config_get_database_path
2021-03-20CLI/new: use configuration variable for backup directoryDavid Bremner
The stat is essentially replaced by the mkdir for error detection purposes. This changes the default location for backups to make things tidier, even in non-split configurations. Hopefully there is not too many user scripts relying on the previous location. Because the default location may not exist, replace the use of stat for error detection with a call to mkdir.
2021-03-20lib/config: add configuration variable for backup directoryDavid Bremner
Like the hook directory, we primarily need a way to communicate this directory between various components, but we may as well let the user configure it. Most of the diff is generalizing choose_hook_dir to work for both backup and hook directories.
2021-03-20lib/open: fix hook directory calculation in split configurationDavid Bremner
Choose sibling directory of xapian database, as .notmuch may not exist. libgen.h is already used in debugger.c, so it is not a new dependency / potential portability problem.
2021-03-20lib/compact: enable split configDavid Bremner
This promotes _choose_xapian_path from static to extern linkage in order to share between open.cc and database.cc.
2021-03-20CLI/insert: support split database and mail rootDavid Bremner
The new test is in T055-path-config because it uses the helper function split_config, and because it seems easier to put the database path related tests in one place.
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-20CLI/new: support split database and mail locationDavid Bremner
This adds new state variable for the mail root, and uses it most places db_path was used. The notable exception is dumps from backups. The latter will be dealt with properly in a future commit.
2021-03-20lib/open: check for split configuration when creating database.David Bremner
The main functionality will be tested when notmuch-new is converted to support split configuration. Here only the somewhat odd case of split mail root which is actually symlinked to the database path is tested.
2021-03-20lib: support splitting mail from database location.David Bremner
Introduce a new configuration value for the mail root, and use it to locate mail messages in preference to the database.path (which previously implied the mail messages were also in this location. Initially only a subset of the CLI is tested in a split configuration. Further changes will be needed for the remainder of the CLI to work in split configurations.
2021-03-20lib/open: Use check for existing database by trial openingDavid Bremner
This is a bit heavyweight for now, but it will make more sense when we check multiple locations for the Xapian database.
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-03-19lib/open: support NOTMUCH_DATABASE environment variableDavid Bremner
The additional code is trivial, but making sure we get the priority of various options correct takes a few tests.
2021-03-19CLI/show: complete conversion to new configuration framework.David Bremner
In order to open the database in main() for this command, we may need to re-open it in the (possibly less common) case where crypto options require write access.
2021-03-18CLI/new: drop the write lock to run the pre-new hook.David Bremner
This fixes a bug reported in [1]. In principle it could be possible avoid one of these reopens, but it complicates the logic in main with respect to creating new databases. [1]: id:9C1993DF-84BD-4199-A9C8-BADA98498812@bubblegen.co.uk
2021-03-18test: Add tests for write access to database from hooks.David Bremner
Recent changes to configuration handling meant the pre-new hook was run while the database was open read only, limiting what could be done in the hook. Add some known broken tests for this problem, as well as a regression test for write access from the post-new hook.
2021-03-18lib: support reopening databases for write access.David Bremner
In the future Xapian will apparently support this more conveniently for the cases other than READ_ONLY => READ_ONLY Conceptually this function seems to fit better in lib/open.cc; database.cc is still large enough that moving the function makes sense.