X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=test%2Ftest-lib.sh;h=e7638bee9f417c05f7ca37cb2febfda6ee360e0a;hb=1dd76ab9b681d6f1f59e7f076015e8f12f45f477;hp=8de5e32fd920e83ed1015d2337a19387ddb16ca2;hpb=b52ee879d869304c981be713566b40aa3f7a44db;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 8de5e32f..e7638bee 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -350,6 +350,11 @@ ${additional_headers}" ${additional_headers}" fi + if [ ! -z "${template[bcc]}" ]; then + additional_headers="Bcc: ${template[bcc]} +${additional_headers}" + fi + if [ ! -z "${template[references]}" ]; then additional_headers="References: ${template[references]} ${additional_headers}" @@ -403,8 +408,11 @@ emacs_deliver_message () shift 2 # before we can send a message, we have to prepare the FCC maildir mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp} - $TEST_DIRECTORY/smtp-dummy sent_message & - smtp_dummy_pid=$! + # eval'ing smtp-dummy --background will set smtp_dummy_pid + smtp_dummy_pid= + eval `$TEST_DIRECTORY/smtp-dummy --background sent_message` + test -n "$smtp_dummy_pid" || return 1 + test_emacs \ "(let ((message-send-mail-function 'message-smtpmail-send-it) (smtpmail-smtp-server \"localhost\") @@ -419,9 +427,11 @@ emacs_deliver_message () (insert \"${body}\") $@ (message-send-and-exit))" - # opportunistically quit smtp-dummy in case above fails. - { echo QUIT > /dev/tcp/localhost/25025; } 2>/dev/null - wait ${smtp_dummy_pid} + + # In case message was sent properly, client waits for confirmation + # before exiting and resuming control here; therefore making sure + # that server exits by sending (KILL) signal to it is safe. + kill -9 $smtp_dummy_pid notmuch new >/dev/null } @@ -555,7 +565,7 @@ test_emacs_expect_t () { NOTMUCH_NEW () { - notmuch new | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file' + notmuch new "${@}" | grep -v -E -e '^Processed [0-9]*( total)? file|Found [0-9]* total file' } notmuch_search_sanitize ()