]> diplodocus.org Git - nmh/blob - test/post/test-post-common.sh
Reverted commit 9a4b4a3d3b27fe4a7ff6d0b8724ce1c06b5917eb.
[nmh] / test / post / test-post-common.sh
1 #!/bin/sh
2 #
3 # Common routines for the post tests
4 #
5
6 set -e
7
8 . "${MH_OBJ_DIR}/test/common.sh"
9
10 setup_test
11
12 arith_eval 64000 + $$ % 1000
13 localport=$arith_val
14 testname="${MH_TEST_DIR}/$$"
15
16 #
17 # Set this for the EHLO command
18 #
19
20 echo "clientname: nosuchhost.example.com" >> ${MHMTSCONF}
21
22 #
23 # One "post" test run. Ok, yeah, we're using "send", but that's just
24 # because it's easier.
25 # $1: output filename for fakesmtp, i.e., the sent message
26 # $2: expected output
27 # $3: optional switches for send
28
29 test_post ()
30 { pid=`"${MH_OBJ_DIR}/test/fakesmtp" "$1" $localport`
31
32 run_prog send -draft -server 127.0.0.1 -port $localport $3
33
34 #
35 # It's hard to calculate the exact Date: header post is going to
36 # use, so we'll just use sed to remove the actual date so we can easily
37 # compare it against our "correct" output.
38 #
39
40 sed -e 's/^Date:.*/Date:/' "$1" > "$1".nodate
41 rm -f "$1"
42
43 check "$1".nodate "$2"
44 }