aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test-lib.sh
Commit message (Collapse)AuthorAge
...
* test: do not set `message-signature' in test_emacsGravatar Dmitry Kurochkin2011-06-28
| | | | | It is no longer needed since tests are run in a temporary home directory instead of the user's one.
* fix sum moar typos [comments in source code]Gravatar Pieter Praet2011-06-23
| | | | | | | | | | Various typo fixes in comments within the source code. Signed-off-by: Pieter Praet <pieter@praet.org> Edited-by: Carl Worth <cworth@cworth.org> Restricted to just source-code comments, (and fixed fix of "descriptios" to "descriptors" rather than "descriptions").
* test: Create and set temporary home directoryGravatar Florian Friesdorf2011-06-01
| | | | | | | | | | | | | | In the master branch in test/emacs two tests access the build users home directory, so does emacs_deliver_message in the crypto branch. The tests should not touch the build user's home directory. The patch creates a directory in the temporary test directory and sets home accordingly. In case of a non-existent home directory, the tests are failing without this patch. Signed-off-by: Jameson Graef Rollins <jrollins@finestructure.net>
* test: copy files in test_expect_equal_file instead of moving themGravatar Dmitry Kurochkin2011-05-31
| | | | | | | | | | | Before the change, test_expect_equal_file moved files it compared in case of failure. The patch changes it to copy the files instead. This allows testing non-temporary files which are stored in git. Note: the change should not result in new temporary files left after the tests. Test_expect_equal_file used to move files only on failure, so callers had to cleanup them anyway.
* test: add crypto tests for signature verification and decryptionGravatar Jameson Graef Rollins2011-05-27
| | | | | | | | | | | | | | | | | | | This adds a new "crypto" test script to the test suite to test PGP/MIME signature verification and message decryption. Included here is a test GNUPGHOME with a test secret key (passwordless), and test for: * signing/verification * signing/verification with full owner trust * verification with signer key unavailable * encryption/decryption * decryption failure with missing key * encryption/decryption + signing/verfifying * reply to encrypted message * verification of signature from revoked key These tests are not expected to pass now, but will as crypto functionality is included.
* test: add notmuch_show_sanitize_all function that is a little more aggressive.Gravatar Jameson Graef Rollins2011-05-27
| | | | | | The old notmuch_show_sanitize function only scrubed part of the filename. This one scrubs the full filename, as well as the message id.
* test: new test-lib function to test for equality between filesGravatar Jameson Graef Rollins2011-05-27
| | | | | | | | | | We need to be able to test for the presence of a newline at the end of output. There's no good way to capture trailing newlines in bash, so redirecting output to a file is the next best thing. This new function should be used when testing for output that is expected to have trailing newlines. The next commit will demonstrate the use of this.
* test: change "#!/bin/bash" to "#!/usr/bin/env bash" enhances portabilityGravatar Joel Borggrén-Franck2011-05-27
| | | | | | Change #!/bin/bash at start of tests to "#!/usr/bin/env bash". That way systems running on bash < 4 can prepend bash >= 4 to path before running the tests.
* test: add test-lib.el file with `visible-buffer-string' functionGravatar Dmitry Kurochkin2011-05-26
| | | | | | | | | | | | | The patch adds test-lib.el file for Emacs tests auxiliary stuff. Currently, it implements two functions: `visible-buffer-string' and `visible-buffer-substring'. These are similar to standard counterparts without "visible-" prefix but exclude invisible text. The functions are not used anywhere at the moment but should be useful for testing hiding/showing in the Emacs interface. Edited-by: Carl Worth <cworth@cworth.org> Fixed "basic" test to ignore new test-lib.el file.
* Clarify usage of `additional_headers' in test/test-lib.sh:generate_message.Gravatar Thomas Schwinge2011-01-28
| | | | Signed-off-by: Thomas Schwinge <thomas@schwinge.name>
* Fix misspelling in a comment.Gravatar Carl Worth2011-01-15
| | | | Just a simple change I noticed in passing.
* test: Leave tmp.<testname> for broken testsGravatar Carl Worth2010-12-07
| | | | | | Previously, this directory was only preserved for failing tests. But it's important to be able to easily debug known-broken tests, so preserve the actual vs. expected output for those as well.
* Fix handling of broken tests.Gravatar Austin Clements2010-12-07
| | | | | Make sure to close the subtest for test_expect_equal_failure, just like in test_expect_equal.
* test: Detect unfinished subsetsGravatar Michal Sojka2010-11-16
| | | | | | When test_begin_subtest is not followed by corresponding test_expect_equal, the output of the rest of the test script is errornously suppressed. Add code to detect these bugs in test scripts.
* test: Add trailing newline to error messagesGravatar Michal Sojka2010-11-16
| | | | | | The newline was removed from say_color in commit 222926ab to allow printing test status in the beginning of the line. Error messages are never followed by other text so we add the newline to error function.
* test: Better handling of stdout and stderrGravatar Michal Sojka2010-11-16
| | | | | | | | | | | | | Git-style tests (test_expect_success etc.) suppress stdout and stderr unless -v is given. Notmuch-style tests (created by test_begin_subtest and test_expect_equal) do not have this behavior so implement it the same. Additionally, for both test styles, the test-lib.sh is changed so that the content of suppressed stdout and stderr is shown in case of failed test. Finally a test for this functionality is added to basic tests.
* Tests for maildir synchronizationGravatar Michal Sojka2010-11-10
| | | | Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
* test: Don't strip portions of test name after '-' for temporary files.Gravatar Carl Worth2010-11-10
| | | | | | | We have test names like maildir-sync now, so it's cleaner if the temporary files created are named things like maildir-sync-10.out rather than maildir-10.out. Presumably the extra stripping here came from naming conventions in git's test suite.
* test: Don't mess with user's HOME directoryGravatar Carl Worth2010-11-05
| | | | | | | | | | This was too rude of a thing to do and could easily introduce problems, (as reported by Rob Browning whose environment required some HOME-specific things for shell startup). Instead, implement more focused changes to ensure that particular file in $HOME don't cause problems. Specifically, we fix known problems with ~/.signature and ~/.mailrc here.
* test: Generate a little run_emacs script to help debug any failures.Gravatar Carl Worth2010-11-05
| | | | | | | | After any emacs test failure, the tmp.emacs directory will have this run_emacs script in it which the user can use to run emacs within the test suite environment, (pointing at the test suite's notmuch database, using the local notmuch command-line program, and the local notmuch emacs lisp code).
* test: Emit a friendly error message if run with bash < 4.0.Gravatar Carl Worth2010-10-28
| | | | | | | | | | The bash code in the test suite is using associative arrays which were only added to bash as of release 4.0. If the test suite is run with an older bash, we now immediately error out and explain the situation, (instead of emitting confusing error messages and failing dozens of tests, which is what happened before this change).
* test: Set alternate HOME during tests.Gravatar Carl Worth2010-10-27
| | | | | | We set the HOME environment variable to the test directory to avoid the tests relying on any configuration files from the test author's own home directory, (such as ${HOME}/.emacs or similar).
* test: Add simple tests for navigating notmuch-hello and notmuch-search viewsGravatar Carl Worth2010-10-22
| | | | | | | | | | | | | | | | | We simulate the act of selecting the "inbox" saved search from notmuch-hello and the act of selecting a desired thread from the notmuch-search results. The test for the navigation of notmuch-hello is currently marked as BROKEN since its output is in the opposite order compared to the '(notmuch-search "tag:inbox")' test. This question of ordering is a currently open issue on the notmuch mailing list, so we'll let the test suite reflect that for now. Finally, this commit also abstracts some common emacs lisp code, (waiting for the current buffer's process to complete), into a new notmuch-test-wait function that is made available to anything calling test_emacs.
* test: Add a new test_expect_equal_failureGravatar Carl Worth2010-10-22
| | | | | Which allows us to have a known-broken test that would otherwise use test_expect_equal.
* test: Add a new test_emacs function to test-lib.shGravatar Carl Worth2010-10-22
| | | | | | | | This should be quite handy for doing automated testing of the emacs-based functionality in notmuch. This function invokes emacs with the necessary command-line arguments, (to run in batch mode with no local initialization, to load the notmuch code from the source directory, and to ensure an 80-column width).
* test: Fix add_email_corpus function to be quiet.Gravatar Carl Worth2010-10-22
| | | | This simply avoids some unneeded noise in the "make test" output.
* test: Fix the search and dump-restore tests to operator on non-empty mail store.Gravatar Carl Worth2010-09-20
| | | | | We do this with a new add_email_corpus function that establishes a mail store with 50 messages from the notmuch mailing list.
* test: Remove useless NOTMUCH variable (in favor of simply "notmuch")Gravatar Carl Worth2010-09-20
| | | | | | | | | | When the NOTMUCH variable was originally invented it was used as an explicit path to the notmuch binary being tested. Today, the test suite sets the PATH variable instead, so the NOTMUCH variable always has a value of simply "notmuch". We simplifying that by using the constant value rather than the continual variable reference.
* test: Remove some dead code in test-lib.shGravatar Carl Worth2010-09-20
| | | | | These assignements weren't being used at all and were just confusing me, (the real assignments happen later on in the file).
* test: Print section names, and rename all test sectionsGravatar Carl Worth2010-09-20
| | | | | | | | Now that we can usefully pass section names via the NOTMUCH_SKIP_TESTS environment variable, it's useful to actually print those names out for the user. Then, since we're now printing these names, let's use nicer names, (not excessively long but also not using abbreviations like "msg").
* test: Make the --valgrind option useful, (and drop --verbose).Gravatar Carl Worth2010-09-20
| | | | | | | | | In order for --valgrind to be useful, we drop noisy additional output of all of the commands being executed in verbose mode. This makes --verbose alone quite useless, so we don't document it any more. Also, add a zlib valgrind suppression that was showing up frequently in the test suite.
* test: Rename GIT_SKIP_TESTS to NOTMUCH_SKIP_TESTSGravatar Carl Worth2010-09-20
| | | | | | | | | By scanning test-lib.sh for occurrences of "git" or "GIT", I found that most of those are internal things, (like the GIT_TEST_TEE_STARTED variable). But GIT_SKIP_TESTS is part of the user-interface to the test suite, so we rename it to reference notmuch rather than git. Also, the GIT_TRACE warning is git-specific, so we drop that as well.
* test: Fix test suite so that --valgrind option works.Gravatar Carl Worth2010-09-20
| | | | | The output is ugly, and we need a better suppressions file, but this is at least a start.
* test: Rework test-suite input to avoid ulti-command stringsGravatar Carl Worth2010-09-17
| | | | | | | | | | | | | | The original git test suite works by concatenating many commands into a very long string (each separated by &&). This is painful to work with since it prevents the editor from helping by parsing the shell script, indenting, colorizing, etc. Instead, we switch this back to something like the original notmuch test suite, and add two new functions to test-lib.sh (test_begin_subtest and test_expect_equal) to support these. This also fixes the test suite to once again display the diff when a test fails to generate the expected input.
* test: Cleanup the test outputGravatar Carl Worth2010-09-17
| | | | | | | | | | | | | | | | This makes the new, git-derived test suite report results in a manner similar to the original notmuch test suite. Notable changes include: * No more initial '*' on every line * Only colorize a single word * Don't print useless test numbers * Use "PASS" in place of "ok" * Begin sentences with a capital letter * Print test descriptions for each block * Separate each block of tests with a blank line * Don't summarize counts between each block
* test: Set all times to UTCGravatar Michal Sojka2010-09-16
| | | | | | | | In order to have repeatable test suite, all times in messages are set to UTC time zone to match the time zone (TZ variable) set in test-lib.sh. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
* test: Update helper functionsGravatar Michal Sojka2010-09-16
| | | | | | | | | | Modify the helper functions to work with git-based test suite i.e. 1) Quote arguments where it is necessary. 2) Do not use $NOTMUCH. It is equal to "notmuch" since $PATH is set to the build tree. 3) Modify pass_if_equal to fit into the git-based test suite. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
* Update test framework for use with notmuchGravatar Michal Sojka2010-09-16
| | | | | | | | This removes Git specific things from the test-lib.sh and adds helper functions for notmuch taken from Carl's notmuch-test script. README is also slightly modified to reflect the current state. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
* Copy test framework from GitGravatar Michal Sojka2010-09-16
Git uses a simple and yet powerful test framework, written in shell. The framework is easy to use for both users and developers so I think it would help if it is used in notmuch as well. This is a copy of Git's test framework from commit b6b0afdc30e066788592ca07c9a6c6936c68cc11 in git repository. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>