X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=test%2Ftest-lib.sh;h=e2e26e6f274a1260ac570b09cd92f27ae90f1478;hp=aac0343ba7bfd221744d73ffbf44eae5f3200a83;hb=971cdc72cdb80f060193bc0914dc9badcc29696b;hpb=07dff496304d6dc2e8033a18691b095ed9cd212f diff --git a/test/test-lib.sh b/test/test-lib.sh index aac0343b..e2e26e6f 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -541,21 +541,26 @@ emacs_fcc_message () 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 -# the history of the notmuch mailing list), which allows for reliably +# $1 is the corpus dir under corpora to add, using "default" if unset. +# +# 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 # number of messages. add_email_corpus () { + corpus=${1:-default} + rm -rf ${MAIL_DIR} - if [ -d $TEST_DIRECTORY/corpus.mail ]; then - cp -a $TEST_DIRECTORY/corpus.mail ${MAIL_DIR} + if [ -d $TEST_DIRECTORY/corpora.mail/$corpus ]; then + cp -a $TEST_DIRECTORY/corpora.mail/$corpus ${MAIL_DIR} 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" - cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpus.mail + mkdir -p $TEST_DIRECTORY/corpora.mail + cp -a ${MAIL_DIR} $TEST_DIRECTORY/corpora.mail/$corpus fi }