Commit graph

14 commits

Author SHA1 Message Date
Jani Nikula
d0cd253b37 test: require test_begin_subtest before test_expect_success
Unify the subtests by requiring test_begin_subtest before
test_expect_success. (Similar change for test_expect_code will
follow.)

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-03-09 09:01:21 -04:00
David Bremner
e311aad182 test: cope with glass backend file naming variations
In several places in the test suite we intentionally corrupt the Xapian
database in order to test error handling. This corruption is specific to
the on-disk organization of the database, and that changed with the
glass backend. We use the previously computed default backend to make
the tests adapt to changing names.
2016-04-12 20:21:09 -03:00
David Bremner
45df509cb6 test: improve error handling in lib-error tests
There is at least one bug fixed here (missing parameter to printf), even
if exiting via segfault is considered OK.
2016-04-12 20:04:03 -03:00
David Bremner
12534d5c4b test: refactor directory name sanitization
test_C and notmuch_search_files_sanitize were giving different output on
the same path, which is not technically wrong, but slightly
confusing.
2016-01-26 22:50:58 -04:00
David Bremner
9ee29ad6f0 test: move backup_database and restore_database to library
The plan is to re-use them in testing the same errors from the CLI
2015-09-04 08:22:42 -03:00
Tomi Ollila
02a2eeb427 test: make script exit (1) if it "fails" to source (.) a file
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-08-07 21:56:39 +02:00
David Bremner
32fd74b7aa lib: reject relative paths in n_d_{create,open}_verbose
There are many places in the notmuch code where the path is assumed to be absolute. If someone (TM) wants a project, one could remove these assumptions. In the mean time, prevent users from shooting themselves in the foot.

Update test suite mark tests for this error as no longer broken, and
also convert some tests that used relative paths for nonexistent
directories.
2015-06-12 07:34:50 +02:00
David Bremner
b59ad1a9cc lib: add NOTMUCH_STATUS_PATH_ERROR
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-06-12 07:34:47 +02:00
David Bremner
294bb6de20 test: move nonexistent directory to something under notmuch's control.
Apparently some systems actually have a directory called /nonexist[ae]nt.
It's hard to fathom a good reason for that, but oh well. As long as we
don't create such a directory inside the notmuch source tree, the new
version should be more robust.
2015-04-08 23:43:55 +09:00
David Bremner
2e9ecb611a test: be consistent about spelling `nonexistent'
Apparently most of the misspellings are my fault.
2015-04-08 23:43:55 +09:00
David Bremner
703c8f9511 test: make one error output test more robust.
Since notmuch_database_status_string can return NULL, passing it
directly to fputs is not a good idea.
2015-03-29 09:50:01 +02:00
David Bremner
6a99505625 test: add more error reporting tests
This second half of the error reporting tests actually uses the function
notmuch_database_status_string to retrieve the last logged error
2015-03-29 00:34:15 +01:00
David Bremner
736ac26407 lib: replace almost all fprintfs in library with _n_d_log
This is not supposed to change any functionality from an end user
point of view. Note that it will eliminate some output to stderr. The
query debugging output is left as is; it doesn't really fit with the
current primitive logging model. The remaining "bad" fprintf will need
an internal API change.
2015-03-29 00:34:15 +01:00
David Bremner
83298fa0f8 test: add error reporting tests
This first half of the tests is all that don't need to retrieve the
the error string explicitly from the notmuch database structure.
2015-03-29 00:34:15 +01:00