mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
test: make it possible to have multiple corpora
We largely use the corpus under test/corpus for testing. Unfortunately, many of our tests have grown to depend on having exactly this set of messages, making it hard to add new message files for testing specific cases. We do use a lot of add_message from within the tests, but it's not possible to use that for adding broken messages, and adding several messages at once can get unwieldy. Move the basic corpus under tests/corpora/default, and make it possible to add new, independent corpora along its side. This means tons of renames with a few tweaks to add_email_corpus function in test-lib.sh to let tests specify which corpus to use.
This commit is contained in:
parent
89c8d27948
commit
971cdc72cd
54 changed files with 12 additions and 7 deletions
|
@ -541,21 +541,26 @@ emacs_fcc_message ()
|
||||||
notmuch new >/dev/null
|
notmuch new >/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Generate a corpus of email and add it to the database.
|
# Add an existing, fixed corpus of email to the database.
|
||||||
#
|
#
|
||||||
# This corpus is fixed, (it happens to be 50 messages from early in
|
# $1 is the corpus dir under corpora to add, using "default" if unset.
|
||||||
# the history of the notmuch mailing list), which allows for reliably
|
#
|
||||||
|
# The default corpus is based on about 50 messages from early in the
|
||||||
|
# history of the notmuch mailing list, which allows for reliably
|
||||||
# testing commands that need to operate on a not-totally-trivial
|
# testing commands that need to operate on a not-totally-trivial
|
||||||
# number of messages.
|
# number of messages.
|
||||||
add_email_corpus ()
|
add_email_corpus ()
|
||||||
{
|
{
|
||||||
|
corpus=${1:-default}
|
||||||
|
|
||||||
rm -rf ${MAIL_DIR}
|
rm -rf ${MAIL_DIR}
|
||||||
if [ -d $TEST_DIRECTORY/corpus.mail ]; then
|
if [ -d $TEST_DIRECTORY/corpora.mail/$corpus ]; then
|
||||||
cp -a $TEST_DIRECTORY/corpus.mail ${MAIL_DIR}
|
cp -a $TEST_DIRECTORY/corpora.mail/$corpus ${MAIL_DIR}
|
||||||
else
|
else
|
||||||
cp -a $TEST_DIRECTORY/corpus ${MAIL_DIR}
|
cp -a $TEST_DIRECTORY/corpora/$corpus ${MAIL_DIR}
|
||||||
notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus"
|
notmuch new >/dev/null || die "'notmuch new' failed while adding email corpus"
|
||||||
cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpus.mail
|
mkdir -p $TEST_DIRECTORY/corpora.mail
|
||||||
|
cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpora.mail/$corpus
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue