${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}"
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\")
(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
}
error "bug in the test script: not 2 or 3 parameters to test_expect_equal"
file1="$1"
+ basename1=`basename "$file1"`
file2="$2"
+ basename2=`basename "$file2"`
if ! test_skip "$test_subtest_name"
then
if diff -q "$file1" "$file2" >/dev/null ; then
test_ok_ "$test_subtest_name"
else
testname=$this_test.$test_count
- cp "$file1" "$testname.$file1"
- cp "$file2" "$testname.$file2"
- test_failure_ "$test_subtest_name" "$(diff -u "$testname.$file1" "$testname.$file2")"
+ cp "$file1" "$testname.$basename1"
+ cp "$file2" "$testname.$basename2"
+ test_failure_ "$test_subtest_name" "$(diff -u "$testname.$basename1" "$testname.$basename2")"
fi
fi
}
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 ()
done
fi
+ # Clear test-output output file. Most Emacs tests end with a
+ # call to (test-output). If the test code fails with an
+ # exception before this call, the output file won't get
+ # updated. Since we don't want to compare against an output
+ # file from another test, so start out with an empty file.
+ rm -f OUTPUT
+ touch OUTPUT
+
emacsclient --socket-name="$EMACS_SERVER" --eval "(progn $@)"
}