aboutsummaryrefslogtreecommitdiff
path: root/test/T070-insert.sh
AgeCommit message (Collapse)Author
2022-09-03test: rename indexing corpusDavid Bremner
The corpus is not really suitable for general indexing test since the sole message is ignored (and will most likely continue to be ignored) by notmuch-new.
2022-07-05test: use notmuch_json_show_sanitize more placesDavid Bremner
This makes the tests more robust against changing output formats, by allowing us to centralize fixes in the sanitization function. It is not appropriate for all cases, in particular it is unneeded when using test_json_nodes, and unhelpful when testing filenames.
2022-02-19CLI/insert: escape envelope fromDavid Bremner
The idea is to do as little parsing and modification of the delivered message as possible. Luckily the position of the "envelope header" lets us escape it by replacing the first 5 characters of the stream with a regular header name (with ':').
2022-02-19test: add known broken test for insert with mbox as inputDavid Bremner
It seems reasonable that notmuch should try to avoid delivering messages in formats it cannot index.
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-05-17test: trivial style cleanupsFelipe Contreras
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-03-12test: clean up some extra whitespace.David Bremner
The extra space is mainly just untidy.
2021-02-06CLI/insert: convert to new config framework.David Bremner
The new talloc context is needed to run the hook at the very end of the function. That in turn is needed so that this process gives up the write lock on the database.
2020-09-04test: fix syntax errors in erroring calls to notmuch insertDavid Bremner
notmuch insert does not currently support passing a filename for the input, so all of these tests have an extra error in addition to the one being tested for. Currently this does not make a difference because the error being tested for is caught before the error of an extra command line argument. In the future it might make a difference, and in any case it is confusing.
2019-06-29test: replace use of gdb with LD_PRELOAD shims in T070-insert.shDavid Bremner
This removes the dependency of this test script on gdb, and considerably speeds up the running of the tests. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-26cli/show: emit new whole-message crypto status outputDaniel Kahn Gillmor
This allows MUAs that don't want to think about per-mime-part cryptographic status to have a simple high-level overview of the message's cryptographic state. Sensibly structured encrypted and/or signed messages will work fine with this. The only requirement for the simplest encryption + signing is that the message have all of its encryption and signing protection (the "cryptographic envelope") in a contiguous set of MIME layers at the very outside of the message itself. This is because messages with some subparts signed or encrypted, but with other subparts with no cryptographic protection is very difficult to reason about, and even harder for the user to make sense of or work with. For further characterization of the Cryptographic Envelope and some of the usability tradeoffs, see here: https://dkg.fifthhorseman.net/blog/e-mail-cryptography.html#cryptographic-envelope
2018-03-24cli/insert: add --world-readable flagDaniel Kahn Gillmor
In some cases (e.g. when building a publicly-visible e-mail archive) it doesn't make any sense to restrict visibility of the message to the current user account. This adds a --world-readable boolean option for "notmuch insert", so that those who want to archive their mail publicly can feed their archiver with: notmuch insert --world-readable Other local delivery agents (postfix's local, and dovecot's lda) all default to delivery in mode 0600 rather than relying on the user's umask, so this fix doesn't change the default. Also, this does not override the user's umask. if the umask is already set tight, it will not become looser as the result of passing --world-readable. Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2017-11-08test: test notmuch insert --folder=""Jani Nikula
Test insert into top level folder.
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-08-22insert: strip trailing / in folder pathYuri Volchkov
This patch fixes the "Insert message into folder with trailing /" test. The problem was insufficient path canonization. From database's point of view, "Sent" and "Sent/" are different folders. If user runs (note the last '/'): notmuch insert --folder=maildir/Sent/ < test.msg notmuch will create an extra XDIRECTORY record for the folder 'Sent/'. This means that database will have _TWO_ records for _ONE_ physical folder: 'Sent' and 'Sent/'. However, the 'notmuch new' command will update only records related to the first one (the correct one). Now, if user moved the email file (e.g. from 'Sent/new' to 'Sent/cur'), 'notmuch new' will add a record about the new file, but will not delete the old record. Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
2017-08-20test: insert into the folder with trailing /Yuri Volchkov
From database's point of view, "Drafts" and "Drafts/" are different folders Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com> Amended: add test_subtest_known_broken (db)
2017-03-09test: require test_begin_subtest before test_expect_codeJani Nikula
Unify the subtests by requiring test_begin_subtest before test_expect_code. (Similar change for test_expect_success has already been done.) This increases clarity in the test scripts by having a separate line for the start of the subtest with the heading, and makes it possible to simplify the test infrastructure by making all subtests similar.
2017-02-26cli/show: list all filenames of a message in the formatted outputJani Nikula
Instead of just having the first filename for the message, list all duplicate filenames of the message as a list in the formatted outputs. This bumps the format version to 3.
2017-01-27test: wrap 'wc -l' results in arithmetic evaluation to strip whitespaceTomi Ollila
Some new unwrapped 'wc -l's have been added since Jani's 60e79e3a9f1c8
2017-01-08test: allow user to choose which gdb to run tests withTomi Ollila
The variable used for selecting gdb is TEST_GDB, consistent with TEST_CC and TEST_EMACS{,CLIENT}.
2016-12-07cli/insert: return EX_TEMPFAIL for some errorsDavid Bremner
Attempt to distinguish between errors indicating misconfiguration or programmer error, which we consider "permanent", in the sense that automatic retries are unlikely to be useful, and those indicating transient error conditions. We consider XAPIAN_EXCEPTION transient because it covers the important special case of locking failure.
2016-12-07test: gdb insert: redirect input inside gdb scriptTomi Ollila
Running `gdb command < input` is not as reliable way to give input to the command (some installations of gdb consume it). Use "set args" gdb command to have input redirected at gdb 'run' time.
2016-08-09test: make gdb even quieterDavid Bremner
gdb sometimes writes warnings to stdout, which we don't need/want, and for some reason --batch-silent isn't enough to hide. So in this commit we write them to a log file, which is probably better for debugging anyway. To see an illustrative test failure before this change, run % make % touch notmuch-count.c % cd test && ./T060-count.sh
2015-08-07test: make script exit (1) if it "fails" to source (.) a fileTomi Ollila
The files (test) scripts source (with builtin command `.`) provides information which the scripts depend, and without the `source` to succeed allowing script to continue may lead to dangerous situations (e.g. rm -rf "${undefined_variable}"/*). At the end of all source (.) lines construct ' || exit 1' was added; In our case the script script will exit if it cannot find (or read) the file to be sourced. Additionally script would also exits if the last command of the sourced file exited nonzero.
2015-06-12lib: add NOTMUCH_STATUS_PATH_ERRORDavid Bremner
The difference with FILE_ERROR is that this is for things that are wrong with the path before looking at the disk. Add some 3 tests; two broken as a reminder to actually use this new code.
2015-05-31test: remove redundant 'file' command from gdb scripts.David Bremner
Quoting Debian bug 787341 It failed to build on arm64: the last ten tests in T070-insert failed. What's happening here is that GDB is segfaulting in response to the "file" command. GDB on arm64 can be a bit buggy. However, the "file" command is redundant here as GDB has already got the file from the --args on the command line.
2014-10-18test: check for gdb in insert testsDavid Bremner
Commits a6cee01 and c48b12f otherwise break the build for people without gdb.
2014-10-18test/insert: check that indexing errors are accepted with --keepDavid Bremner
This is overkill for the current code path, but should provide some robustness for future changes in error handling.
2014-10-18cli/insert: require succesful message indexing for success statusJani Nikula
Add --keep option to keep any remaining stuff in index or file. We could distinguish between failures to index and failures to apply tags or maildir sync, but for simplicity just have one.
2014-10-18test/insert: add known broken tests for indexing failuresDavid Bremner
These tests are written with the assumption that we want all indexing failures to be considered as failures by notmuch insert.
2014-03-11test: make insert test use the path: prefixJani Nikula
This is a more strict test for the insert test.
2014-03-06test: add tests for invalid new.tagsJani Nikula
Similar tests for both notmuch new and insert.
2014-01-13test: renamed test scripts to format T\d\d\d-name.shTomi Ollila
All test scripts to be executed are now named as T\d\d\d-name.sh, numers in increments of 10. This eases adding new tests and developers to see which are test scripts that are executed by test suite and in which order.