summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
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.
2021-03-18test/setup: add check for config exists, but no database.David Bremner
This code path is not currently tested, and will need updating if the location of the xapian database changes.
2021-03-18test: add known broken test for long directory bugDavid Bremner
In [1] Gregor Zattler explained the results of his hard work tracking down a bug in notmuch with long directories. This test duplicates the bug. [1]: id:20210317194728.GB5561@no.workgroup
2021-03-13test: run uncrustifyuncrustify
This is the result of running: $ uncrustify --replace --config ../devel/uncrustify.cfg *.cc *.c *.h in the test directory.
2021-03-12test: clean up some extra whitespace.David Bremner
The extra space is mainly just untidy.
2021-03-12test: T020-compact.sh: fix work directory locationTomi Ollila
Fix use of $TEST_DIRECTORY ($NOTMUCH_BUILDDIR/test/) with use of $TMP_DIRECTORY ($NOTMUCH_BUILDDIR/test/tmp.T020-compact/ in case of T020-compact.sh) as root directory where to write test files and directories.
2021-02-18Merge tag '0.31.4'David Bremner
notmuch 0.31.4 release
2021-02-18test: Fix race condition in T568-lib-thread.shDavid Bremner
The assignment of thread-ids is (apparently) non-deterministic in a way that mostly seems to show up on multicore machines. In my tests the number is different from that previously assumed by this test about 15% of the time on a 50 thread (25 core) Xeon. Since message id's are fixed, use a message known to be in the thread of interest to pick out the correct thread-id.
2021-02-15python: convert shebangs to python3Daniel Kahn Gillmor
This is the last bit of "python" left in the notmuch codebase. https://www.python.org/dev/peps/pep-0394/#recommendation encourages "third-party distributors" to use more-specific shebang lines. I'm not certain that the notmuch project itself is a "third-party contributor" but I think this is a safe way to encourage people to use python3 when they're developing notmuch. We already have python3 explicitly elsewhere in the codebase for developers (in nmbug). Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2021-02-06CLI: use configured hook directoryDavid Bremner
This enables support for hooks outside the database directory. It relies strongly on configuration information being usable between closing the database and destroying it.
2021-02-06lib/open: set HOOK_DIR on openDavid Bremner
This is a simple two step path search. Most error checking is deferred until running the hooks.
2021-02-06lib/config: add HOOK_DIRDavid Bremner
The hook directory configuration needs to be kept in synch with the other configuration information, so add scaffolding to support this at database opening time.
2021-02-06cli/new: convert to new config frameworkDavid Bremner
In addition to the same type of changes as converting other subcommands, add the possibility of creating a database at the top level. It would probably make sense to use this for insert as well.
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.
2021-02-06lib/config: add NOTMUCH_CONFIG_NEW_IGNOREDavid Bremner
This will be needed by (at least) the conversion of notmuch-new.c to the new config framework