Commit graph

20 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
dfa43a1921 test: treat undefined feature variables as 0
When running the test suite without building first, it is desirable to
have the tests consider these variables being undefined as equivalent
to the feature not being present, and in particular for the tests not
to generate errors.
2023-07-21 06:58:16 -03:00
David Bremner
4612f3eb3d CLI/show: support --duplicate for structured output
This introduces a new mandatory key for message structures, namely
"duplicate". Per convention in devel/schemata this does _not_ increase
the format version. This means that clients are responsible for
checking that it exists, and not crashing if it does not.

The main functional change is teaching mime_node_open to understand a
'duplicate' argument.

Support for --duplicate in notmuch-reply would make sense, but we
defer it to a later commit.
2022-07-30 08:41:50 -03:00
David Bremner
5f6645bd2a test: use notmuch_json_show_sanitize more places
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-07-05 07:01:39 -03:00
David Bremner
c5cf92aa35 CLI: print extra headers in structured output
This is based on a patch from Johan Parin [1], which is in turn
responding to a bug report / feature requiest from Jan Malkhovski.

The update to the structured output documented in schemata is intended
to be upward compatible, so the format version stays the same

[1]: id:20191116162723.18343-1-johan.parin@gmail.com
[2]: id:87h8sdemnr.fsf@oxij.org
2022-01-18 08:11:06 -04:00
Tomi Ollila
572af27950 test: source $NOTMUCH_SRCDIR/test/test-lib-emacs.sh
Sourcing test-lib.sh will cd to TMP_DIRECTORY, so
relative path in $0 will not work in previous version
 . $(dirname "$0")/test-lib-emacs.sh

Now individual test scripts -- e.g. ./test/T310-emacs.sh
will work.
2021-06-03 09:29:27 -03:00
Felipe Contreras
92454bc093 test: split emacs functionality to its own file
This way it's easier to identify the tests that do require emacs stuff.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2021-05-17 07:29:04 -03:00
David Bremner
b46d842782 test: mark two tests broken on machines with 32 bit time_t
I haven't traced the code path as exhaustively for the SMIME test, but
the expiry date in question is larger then representable in a signed
32 bit integer.
2020-06-26 22:16:51 -03:00
Peter Wang
c17fca40e2 sprinter: change integer method to use int64_t
In particular, timestamps beyond 2038 could overflow the sprinter
interface on systems where time_t is 64-bit but 'int' is a signed 32-bit
integer type.
2020-02-13 19:10:42 -04:00
Peter Wang
e091427d98 test: add known broken test with timestamp beyond 2038 2020-02-13 19:08:56 -04:00
Daniel Kahn Gillmor
4cb789aa09 cli/show: emit new whole-message crypto status output
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
2019-05-26 08:20:23 -03:00
Jani Nikula
32c088b524 test: use source and build paths in T160-json.sh and T170-sexp.sh
Make a distinction between source and build directories.
2017-10-20 19:55:49 -03:00
Jani Nikula
a863de1e43 test: use $(dirname "$0") for sourcing test-lib.sh
Don't assume the tests are always run from within the source tree.
2017-10-20 19:52:49 -03:00
David Bremner
411675a6ce lib: index message files with duplicate message-ids
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-01 21:17:47 -04:00
Jani Nikula
0497d695ca test: require test_begin_subtest before test_expect_code
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-03-09 09:03:40 -04:00
Jani Nikula
ea20a932f1 cli/show: add content-disposition to structured output message parts
Help the clients decide how to display parts.

Test updates by Mark Walters <markwalters1009@gmail.com>.
One more test fix by db
2017-02-28 08:03:00 -04:00
Jani Nikula
75bb23f748 test: test format version difference between v2 and v3
Schemata v3 changed message filename field to a list. Test both
versions 2 and 3.
2017-02-26 07:42:02 -04:00
Jani Nikula
14c60cf168 cli/show: list all filenames of a message in the formatted output
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-02-26 07:41:33 -04: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
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
Renamed from test/json (Browse further)