aboutsummaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2017-10-20test: use corpora/default not corpus in T480-hex-escaping.shJani Nikula
Turns out round trip tests didn't really round trip anything. Broken by yours truly in 971cdc72cdb8 ("test: make it possible to have multiple corpora"). Ooops.
2017-10-14tests: prepare for more crypto tests (using add_gnupg_home)Daniel Kahn Gillmor
Move add_gnupg_home to test-lib.sh to prepare it for reuse.
2017-10-09cli: convert notmuch_bool_t to stdboolJani Nikula
C99 stdbool turned 18 this year. There really is no reason to use our own, except in the library interface for backward compatibility. Convert the cli and test binaries to stdbool.
2017-10-04hex-xcode: use notmuch_bool_t for boolean argumentsJani Nikula
Pedantically correct, although they're the same underlying type.
2017-10-04test: expand argument parsing testsJani Nikula
Test and use the new .present field, only output the parameters given. Test space between parameter name and value.
2017-10-04test: add opt_inherit to arg-testJani Nikula
Just split the arguments to two opt desc arrays.
2017-10-04test: add boolean argument to arg-testJani Nikula
Surprisingly it's not there.
2017-10-04cli: use designated initializers for opt descJani Nikula
Several changes at once, just to not have to change the same lines several times over: - Use designated initializers to initialize opt desc arrays. - Only initialize the needed fields. - Remove arg_id (short options) as unused. - Replace opt_type and output_var with several type safe output variables, where the output variable being non-NULL determines the type. Introduce checks to ensure only one is set. The downside is some waste of const space per argument; this could be saved by retaining opt_type and using a union, but that's still pretty verbose. - Fix some variables due to the type safety. Mostly a good thing, but leads to some enums being changed to ints. This is pedantically correct, but somewhat annoying. We could also cast, but that defeats the purpose a bit. - Terminate the opt desc arrays using {}. The output variable type safety and the ability to add new fields for just some output types or arguments are the big wins. For example, if we wanted to add a variable to set when the argument is present, we could do so for just the arguments that need it. Beauty is in the eye of the beholder, but I think this looks nice when defining the arguments, and reduces some of the verbosity we have there.
2017-10-02T390-python: add test for get_message_parts and special charactersFlorian Klink
This imports a message with ISO-8859-2 encoded characters, then opens the database using the python bindings. We peek through all mesage parts, afterwards print the message id. Signed-off-by: Florian Klink <flokli@flokli.de> Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
2017-09-27emacs: sanitize subject in repliesJani Nikula
Commit a7964c86d125 ("emacs: Sanitize authors and subjects in search and show") added sanitization of header information for display. Do the same for reply subjects. This fixes the long-standing annoying artefact of certain versions of mailman using tab as folding whitespace, leading to tabs in reply subjects.
2017-09-27test: add emacs reply test for subjects with TABJani Nikula
Expect TABs to be sanitized from the subject line. Known broken.
2017-09-17lib: index the content-type of the parts of encrypted messagesDaniel Kahn Gillmor
This is a logical followup to "lib: index the content type of signature parts", which will make it easier to record the message structure of all messages.
2017-09-17lib: index the content type of signature partsJani Nikula
It's useful (*) to be able to easily find messages with certain types of signatures. Having the mimetype: prefix searches fail for some content types is also genuinely surprising (*). Index the content type of signature parts. While at it, switch to the gmime convenience constants for content and signature part indexes. *) At least for developers of email software!
2017-09-17test: signed and encrypted part content type indexingJani Nikula
Add known broken subtests for searching signed and encrypted messages using mimetype: prefix search for the content-types of signed and encrypted parts.
2017-09-05test/duplicate-mid: check for subject with notmuch-showDavid Bremner
In [1] Mark showed that the the current code (d7a49e81) is not consistent in it's handling of subjects of messages with duplicate message-ids (or in notmuch-speak, of messages with multiple files). notmuch-search uses indexing order and explicitedly preserves the first. notmuch-show (apparently) uses alphabetical (or at least xapian term order) of filenames. In a perfect world we would probably report all subjects in the json output; at the very least we should be consistent. [1]: id:87378dny3d.fsf@qmul.ac.uk
2017-09-05lib: enforce that n_message_reindex takes headers from first fileDavid Bremner
This is still a bit stopgap to be only choosing one set of headers, but this seems like a more defensible set of headers to choose.
2017-09-05test: known broken test for subject after reindexingDavid Bremner
In [1], Mark gave a test that was behaving strangly. This turns out to be specific to reindexing. I suppose one could argue that picking the lexicographically last file name is a defensible choice, but it's almost as easy to take the first, which seems more intuitive. So mark the current situation as broken. [1]: id:1503859703-2973-1-git-send-email-markwalters1009@gmail.com
2017-09-05test/duplicate-mid: clarify index order vs filename orderDavid Bremner
The existing test for notmuch search had the first in filename order the same as the first indexed, which made it harder to understand what the underlying behaviour is. Add a file with a lexicographically smaller name, but later index time to clarify this.
2017-09-05test: make fallback to duplicate test more robust.David Bremner
The original intent of this test was to verify that notmuch show was not crashing when the first file (where headers are being read from) was deleted. Run the output through some sanitization so that as we add and delete copies we don't have to update this test.
2017-09-04test: notmuch_drop_mail_headers() style updateTomi Ollila
Changed "" quotes to '' as we're not supposed to dynamically alter python program (via shell $variable expansion). Added space to python program to match general python style. Replaced $* with 'idiomatic' "$@" to serve as better example.
2017-09-03test/crypto: remove headers more robustlyDavid Bremner
In [1], Vladimir Panteleev observed that the In-Reply-To and References headers could be wrapped in the 'default' output format of notmuch-reply, depending on the version of Emacs creating the message. In my own experiments notmuch-reply sometimes wraps headers with only one message-id if that message-id is long enough. However it happens, this causes the previous approach using grep to fail. Since I found the proposed unwrapping shell fragment in [1] a bit hard to follow, I decided to write a little python script instead. Then Tomi suggested a slight generalization of my script, and here we are. [1] id:20170817175145.3204-7-notmuch@thecybershadow.net
2017-08-30test: Fix T050-new.sh on some Travis CI machinesVladimir Panteleev
On some system configurations, setting a breakpoint on the "add_file" function then issuing "continue" in gdb causes the debugger to seemingly jump over the add_file invocation. This results in a test failure, as the "Handle files vanishing between scandir and add_file" subtest expects add_file to be called and fail due to the vanishing file. The compiler optimization level also plays a role - the problem can be reproduced with CFLAGS having -O2 but not -Og. This problem was observed manifesting as a test failure on Travis CI configured with "dist: trusty" and "sudo: false". It was not reproducible on a local Docker image of Travis' runtime environment, so Travis' virtualization infrastructure likely plays a role as well. * T050-new.sh: Breakpoint notmuch_database_add_message instead of add_file to the same effect, and avoid bad gdb behaviour on Travis CI. Amended by db: s/notmuch_database_add_message/notmuch_database_index_file/ Somehow the wrapper function doesn't work as a breakpoint; perhaps due to inlining.
2017-08-30test/smtp-dummy: convert to 'goto DONE' styleDavid Bremner
Clean up several cppcheck warnings of the form - test/smtp-dummy.c:170: error: Resource leak: output Conform to overall notmuch code style.
2017-08-30test/smtp-dummy: uncrustifyDavid Bremner
For some reason lost in the mists of time this code was indented 8 spaces.
2017-08-29CLI/new: support maildir synced tags in new.tagsDavid Bremner
We reorder reading maildir flags to avoid overwriting 'new.tags'. The inverted status of 'unread' means the maildir flag needs to be checked a second time. I backpedalled here on the idea of supporting 'new.tags' without 'unread' in the presence of maildir syncing. For files in 'new/', it seems quite natural to tag them as 'unread'.
2017-08-28test: Perform T170 tests that don't require dtach before any that do.David Edmondson
This avoids the later tests seeing different versions of the database depending on whether dtach is available.
2017-08-23test: Use small Python script for JSON normalization instead of json.toolVladimir Panteleev
json.tool does not sort or otherwise normalize the order of JSON keys in its output, which can result in test failures on some test systems. Instead, use a one-line Python script passed to the interpreter directly on its command line. Use sort_keys=True for json.dump to ensure the key order is normalized. The script works with both Python 2 and 3. * test/test-lib.sh: Update test_expect_equal_json.
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-22show: workaround for the missing file problemYuri Volchkov
This patch fixes the 'Deleted first duplicate file does not stop notmuch show from working' test. If a message to be shown has several duplicated files, and for some reason the first file in the list is not available anymore, notmuch will exit with an error. This is clearly a problem in the database, but we are not going to let this problem be a show-stopper. Let's walk through the list, and show the first existing file. Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
2017-08-22test: show id:<> works even if the first duplicate is deletedYuri Volchkov
Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
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: move generate_message, add_message into test-lib-common.shDavid Bremner
The plan is to use at least the former in the perf test suite.
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-08-18test: remove remainder of previously killed basic testYuri Volchkov
In the commit 51cd69feb1d131db7a468e33e0fa2e043caad41e the part of the test "test runs if prerequisite is satisfied" has been removed. However, there was a remainder of that test - variable 'haveit'. Kill it, to not to confuse people. Signed-off-by: Yuri Volchkov <yuri.volchkov@gmail.com>
2017-08-18Use rooted paths in .gitignore filesVladimir Panteleev
A leading / in paths in a .gitignore file matches the beginning of the path, meaning that for patterns without slashes, git will match files only in the current directory as opposed to in any subdirectory. Prefix relevant paths with / in .gitignore files, to prevent accidentally ignoring files in subdirectories and possibly slightly improve the performance of "git status".
2017-08-18test: Update extant references to corpus.mailVladimir Panteleev
971cdc72cdb80f060193bc0914dc9badcc29696b renamed corpus.mail to corpora.mail. Although 971cdc72cdb80f060193bc0914dc9badcc29696b updated some of the remaining corpus.mail references, two remained, causing the test suite to leave behind an unignored corpora.mail directory.
2017-08-16test: add test for ,S message without 'unread' in new.tagsDavid Bremner
This is arguably overkill, but it helps to understand the complicated interactions here between maildir tags and configuration.
2017-08-16test: add missing quotes in maildir-sync test.David Bremner
Oops. ';' is significant in the shell. Who knew.
2017-08-06test: add broken tests for maildir syncingDavid Bremner
Users should be able to specify synced tags in new.tags
2017-08-01add "notmuch reindex" subcommandDaniel Kahn Gillmor
This new subcommand takes a set of search terms, and re-indexes the list of matching messages.
2017-08-01cli/search: print total number of files matched in summary output.David Bremner
The structured output formats already have all of the filenames. This is an easy bit of UI change to make the multiple files visible.
2017-08-01lib: index message files with duplicate message-idsDavid Bremner
The corresponding xapian document just gets more terms added to it, but this doesn't seem to break anything. Values on the other hand get overwritten, which is a bit annoying, but arguably it is not worse to take the values (from, subject, date) from the last file indexed rather than the first.
2017-08-01test: add known broken tests for duplicate message idDavid Bremner
There are many other problems that could be tested, but these ones we have some hope of fixing because it doesn't require UI changes, just indexing changes.
2017-07-18emacs: convert remaining format-versions from 3 to 4David Bremner
This is needed for consistent beheviour between notmuch built against gmime-2.6 and gmime-3.0 w.r.t. error reporting.
2017-07-18Fix orthographyDaniel Kahn Gillmor
2017-07-15emacs: change default for notmuch-crypto-process-mime to tDavid Bremner
There are some cases like remote usage where this might cause problems, but those users can easily customize the variable. The inconvenience seems to be outweighed by the security benefit for most users.
2017-07-14config: deprecate/drop crypto.gpg_path under gmime 2.6/3.0Daniel Kahn Gillmor
gmime 3.0 no longer offers a means to set the path for gpg. Users can set $PATH anyway if they want to pick a differently-installed gpg (e.g. /usr/local/bin/gpg), so this isn't much of a reduction in functionality. The one main difference is for people who have tried to use "gpg2" to make use of gpg 2.1, but that isn't usefully co-installable anyway.
2017-07-14Add additional munged reply-to testsDaniel Kahn Gillmor
The reply-to munging code might behave differently whether there's an exact match on the strings or not, or whether the string is a raw addr-spec instead of an name-addr. These tests cover those variations (i also had to tweak json output further below when this new test was added).
2017-07-14Ensure that "notmuch reply" succeeds during testing.Daniel Kahn Gillmor
In some (bad!) cases, "notmuch reply" might fail, or might even segfault. If this happens, it indicates a bug, and the test suite should notice it.
2017-07-14test/crypto: mark extra space in userid as a bug in gmime-2.6David Bremner
I can't see the space in the output of gpg -K --with-colons