Commit graph

128 commits

Author SHA1 Message Date
David Bremner
ec26eeaeec test: support testing notmuch as installed
We put some effort into testing the built copy rather than some
installed copy. On the other hand for people like packagers, testing
the installed copy is also of interest.

When NOTMUCH_TEST_INSTALLED is set to a nonempty value, tests do not
require a built notmuch tree or running configure.

Some of the tests marked as broken when running against installed
notmuch are probably fixable.
2023-07-21 07:41:50 -03:00
David Bremner
c966fa6439 test: use --minversion to detect GNU Parallel.
Based on a suggestion of Ole Tange [1].

[1]: id:CA+4vN7x6jp4HCiEybZ=5g+2X6Pa7etBFX3Bbd=UYty37gR6wEQ@mail.gmail.com
2021-08-03 20:29:47 -03:00
Tomi Ollila
6f0f83660e test: aggregate-results updates
notmuch-test will now call aggregate-results.sh with file list
that it compiles based on the test ran, and aggregate-results
will report failure is any of the test files are missing.

With this notmuch-test no longer has to exit in non-parallel
run if some test fail to write its report file -- so it works
as parallel tests in this sense.

Changed test_done() in test-lib.sh write report file in one write(2),
so there is (even) less chance it being partially written. Also,
now it writes 'total' last and aggregate-results.sh expects this
line to exist in all report files for reporting to be successful.

Added 'set -eu' to notmuch-test and modified code to work with
these settings. That makes it harder to get mistakes slipped
into committed code.
2021-06-07 20:16:33 -03:00
David Bremner
00487fa901 test: hide message from moreutils parallel.
The argument --version confuses moreutils parallel, but this is OK,
because its confusing does not include printing "GNU"
2021-04-26 09:00:11 -03:00
Tobias Backer Dirks
f2b5ad28e2 test: check for GNU parallel with --version options
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-24 20:06:41 -03:00
Daniel Kahn Gillmor
73cebe6e72 test: report summary even when aborting
In certain cases of test suite failure, the summary report was not
being printed.  In particular, any failure on the parallel test suite,
and any aborted test in the serialized test suite would end up hiding
the summary.

It's better to always show the summary where we can (while preserving
the return code).  If we do abort due to this high-level failure,
though, we should also announce to the user that we're doing so as
close to the end of the process as possible, to make it easier to find
the problem.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-26 18:55:06 -03:00
Daniel Kahn Gillmor
fa9d8b7026 test: allow disabling timeout with NOTMUCH_TEST_TIMEOUT=0
To aid in diagnosing test suite tooling that interacts poorly with
coreutils' timeout, it's handy to be able to bypass it entirely.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-25 08:26:41 -03:00
Tomi Ollila
3563079be3 test-lib.sh: colors to test output when parallel(1) is run on tty
Done via $COLORS_WITHOUT_TTY environment variable as passing options
to commands through parallel(1) does not look trivial.

Reorganized color checking in test-lib.sh a bit for this (perhaps
were not fully necessary but rest still an improvement):

  - color checking commands in subshell are not run before arg parsing
    (args may disable colors with --no-color)

  - [ -t 1 ] is checked before forking subshell
2019-05-23 08:00:31 -03:00
Daniel Kahn Gillmor
c88e030580 tests: fail and report when a parallel build fails (or times out)
When a parallel build fails (or when it times out, if timeout is
present), the test suite should not blithely succeed.  Catch these
failures and at least report them.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-20 14:48:56 -03:00
Daniel Kahn Gillmor
73bf7e532e tests: make timeout configurable with NOTMUCH_TEST_TIMEOUT (default: 2m)
The current 2 minute timeout is reasonable, but to exercise the test
suite or induce timeout failures, we might want to make it shorter.
This makes it configurable so you can run (for example):

    make check NOTMUCH_TEST_TIMEOUT=10s

We stick with the default of 2m.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2019-05-20 14:48:43 -03:00
Jameson Graef Rollins
eeff431996 tests: environment variable to specify that tests should be serialized
If NOTMUCH_TEST_SERIALIZE is non-null all tests will be run in series,
rather than in parallel.
2019-05-07 06:55:31 -03:00
Jameson Graef Rollins
908d930d22 tests: run all tests in parallel, if available
If either the moreutils or GNU parallel utility are available, run all
tests in parallel.  On my eight core machine this makes for a ~x7
speed-up in the full test suite (1m24s -> 12s).

The design of the test suite makes this parallelization trivial.
2019-05-07 06:54:09 -03:00
Jameson Graef Rollins
591388ccd1 tests: remove entangling corpus index optimization
The add_email_corpus test utility includes logic that tries to re-use
an index of the corpus if available.  This was seemingly done as an
optimization, so that every test that uses the corpus didn't have to
create it's own index of the corpus.  However, this has the perverse
side effect of entangling tests together, and breaks parallelization.

Forcing each test to do it's own index does increase the overall time
of the test slightly (~6%), but this will be more than made up for in
the next patch that introduces paraellization.
2019-05-07 06:53:57 -03:00
Jani Nikula
a8cd1ec26b test: use source and build paths in notmuch-test
Make a distinction between source and build directories.
2017-10-20 19:55:31 -03:00
Vladimir Panteleev
4d44976135 test: Update extant references to corpus.mail
971cdc72cd renamed corpus.mail to
corpora.mail. Although 971cdc72cd
updated some of the remaining corpus.mail references, two remained,
causing the test suite to leave behind an unignored corpora.mail
directory.
2017-08-18 19:42:19 -03:00
Tomi Ollila
be55acf4f0 test/notmuch-test: simple streamlining
A few simple things that applies well to test/notmuch-test.sh

- Shell does pathname expansion also without doing `echo ...` in subshell.

- Redirections >/dev/null 2>/dev/null hide (improbable but) potential
  serious errors; adding -f to rm instead.

- Inter-file capitalization consistency in comments.

- Unnecesary space removal.
2016-06-28 09:23:39 +02:00
Tomi Ollila
b183f2635e test: copyright information updates
Files in test directories had only copyright of a single individual,
of which code was adapted here as a base of the test system.
Since then many Notmuch Developers have contributed to the test
system, which is now acknowledged with a constant string in some
of the test files.

The README file in test directory instructed new files contain a
copyright notice, but that has never been done (and it is also not
needed). To simplify things a bit (and lessen confusion) this
instruction is now removed.

As a side enchangement, all of the 3 entries in the whole source
tree cd'ing to `dirname` of "$0" now uses syntax cd "$(dirname "$0")".
This makes these particular lines work when current working directory
is e.g. /c/Program Files/notmuch/test/.
(Probably it would fail elsewhere, though.)
2016-05-19 07:56:58 -03:00
Tomi Ollila
a755c9d6a9 test: renamed test scripts to format T\d\d\d-name.sh
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.
2014-01-13 14:16:46 -04:00
Tomi Ollila
f05e7f3ce5 test: print empty line at the beginning of test script, not at end
In preparation for quiet mode print empty line before writing the
test description. This is done now in function designed for it --
it will also be called when test fails.
2013-12-09 23:25:41 +08:00
Mark Walters
81b2ad57f0 test: move emacs-tree test into mainline
We move the emacs-tree test and associated files into the main test
directory and add the test to the list in notmuch-test.
2013-11-07 07:40:28 -04:00
Ben Gamari
1eecfbd51a test: Add compact test
Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
2013-10-31 07:48:04 -03:00
Tomi Ollila
11a3805464 test: exit with nonzero value when not all tests completed successfully
If any of the tests in our test system is not passing the execution
of the test suite completes with nonzero exit value.

It is better to rely on the exit value of the test system instead
of some arbitrary strings in test output (or use both).
2013-09-08 22:40:57 -03:00
Peter Wang
7e3a7ed62f test: add tests for insert
Add tests for new 'insert' command.
2013-06-29 19:29:02 -03:00
Aaron Ecay
983d5e1df2 test: add tests for the handling of References and In-Reply-To headers
These tests are known_broken, the following commit fixes them.

amended per

	id:87txmi1zq3.fsf@nikula.org
	id:87vc6yalo7.fsf@zancas.localnet
2013-05-13 21:27:01 -03:00
Jani Nikula
2c64c2e0eb test: add basic test for notmuch setup
And annotate with test_subtest_known_broken. Hooray.
2013-05-12 07:46:23 -03:00
Peter Feigl
76271e098c Adding tests for --format=sexp.
Add basic tests, the same as for json, for the S-Expression output
format.
2012-12-08 09:30:46 -04:00
David Bremner
a09115ae1d test/hex-escaping: new test for hex escaping routines
These are more like unit tests, to (try to) make sure the library
functionality is working before building more complicated things on
top of it.
2012-12-02 15:51:32 -04:00
Austin Clements
ec59896de0 test: Abort driver if a test script aborts
Previously, if a test script aborted (e.g., because it passed too few
arguments to a test function), the test driver loop would simply
continue on to the next test script and the final results would
declare that everything passed (except that the test count would look
suspiciously low, but maybe you just misremembered how many tests
there were).

Now, if a test script exits with a non-zero status and did not produce
a final results file, we propagate that failure out of the driver loop
immediately.

To keep this simple, this patch removes the PID from the test-results
file name.  This PID was inherited from the git test system and seems
unnecessary, since the file name already includes the name of the test
script and the test-results directory is created anew for each run.
2012-11-29 09:24:12 -04:00
Jani Nikula
84a0c529b9 test: add tests for date:since..until range queries
A brief initial test set.
2012-10-31 17:14:07 -03:00
Jani Nikula
58b222d597 test: add smoke tests for the date/time parser module
Test the date/time parser module directly, independent of notmuch,
using the parse-time test tool.

Credits to Michal Sojka <sojkam1@fel.cvut.cz> for writing most of the
tests.
2012-10-31 16:50:57 -03:00
Austin Clements
36e640852b test: Add test for messages with missing headers
Currently the JSON tests for search and show are broken because
notmuch attempts to dereference a NULL pointer.
2012-08-12 21:06:50 +02:00
Peter Wang
9d70e952eb test: add basic show, search --format=text tests
There didn't seem to be these basic tests for --format=text,
as there are for --format=json.  These are just the tests from
the `json' script, with adjusted expected outputs.
2012-07-09 15:43:40 -06:00
Peter Wang
b8c7707d4d test: Add tests for 'config' command
Start a new test script.
2012-04-28 10:14:10 -03:00
Mark Walters
6478e1bc92 test: add some exclude tests
Systematically test the exclude options for search. Also move the
search existing exclude tests into the new test. There is some overlap
between the two sets of tests but many of the existing ones are there
because they triggered bugs in the past so I have kept them to ensure
coverage.
2012-04-07 23:06:21 -03:00
Daniel Schoepe
6e25ea031f emacs: Tests for user-defined sections
A new file was added for notmuch-hello tests.
2012-03-01 08:16:55 -04:00
Dmitry Kurochkin
69adeb52b1 test: add test for hiding Original Message region at beginning of a message
The test is currently broken and will be fixed by a subsequent patch.

The patch adds a new file for tests of Emacs notmuch-show view.

Based on patch by David Edmondson [1].

[1] id:"1327562380-12894-4-git-send-email-dme@dme.org"
2012-02-04 07:32:54 -05:00
Dmitry Kurochkin
6dec2af55b test: remove ".sh" extension from the recently added Emacs tests
All test files, except for the recently added Emacs tests, do not have
".sh" extension.  So remove it from the new test files for consistency.
2012-02-03 21:12:12 -04:00
David Edmondson
3699fedb3a test: Add address cleaning tests. 2012-01-25 07:27:01 -04:00
David Edmondson
260975e8af test: Add `test_emacs_expect_t'.
Add a new test function to allow simpler testing of emacs
functionality.

`test_emacs_expect_t' takes one argument - a lisp expression to
evaluate. The test passes if the expression returns `t', otherwise it
fails and the output is reported to the tester.
2012-01-25 07:25:44 -04:00
Mark Walters
15ea8625d1 test: add tests for "notmuch reply" --reply-to=sender 2012-01-14 11:11:18 -04:00
Jani Nikula
02052781a9 test: emacs: test notmuch-wash-subject-to-* functions
Signed-off-by: Jani Nikula <jani@nikula.org>
2011-12-28 08:18:40 -04:00
Jani Nikula
caae152772 test: add tests for hooks
Signed-off-by: Jani Nikula <jani@nikula.org>
2011-12-11 13:59:39 -04:00
David Bremner
5800a44bd5 test: tests for command-line-arguments.c
This was needed because no current notmuch code exercises the
NOTMUCH_OPT_STRING style arguments.
2011-12-08 20:24:24 -04:00
David Bremner
f0e0053149 Merge branch 'release'
Conflicts:
	NEWS

Conflicts resolved by inserting the 0.10.2 stanza before 0.11
2011-12-06 19:39:33 -04:00
David Bremner
6cca3a5c16 test: add tests for python bindings
We start modestly, with a (slightly modified) test case from Kazuo
Teramoto. Originally it just made sure the bindings didn't crash; here
we check that by comparing the output with that of notmuch search.
2011-12-05 18:06:48 -04:00
David Bremner
ac8576de63 Merge branch 'release' 2011-11-26 21:15:20 -08:00
David Bremner
398b94bb39 test: add simple tests for online help
Nothing fancy, but we can at least detect segmentation faults.
2011-11-25 12:35:40 -05:00
Tomi Ollila
6237f3808c test: make all tests terminable with Ctrl-c
Some tests don't break when HUP signal is sent tho those (by
pressing ctrl-c on the terminal). Therefore, the top-level
test script catches the HUP and sends TERM signal to the
started test script.
2011-11-18 13:53:51 -05:00
Jani Nikula
8a4d631d7c test: add tests for notmuch search --offset and --limit
Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-15 19:25:58 -04:00
Jani Nikula
28d78c2b02 test: add tests for notmuch count
Signed-off-by: Jani Nikula <jani@nikula.org>
2011-11-15 19:22:13 -04:00