Commit | Line | Data |
---|---|---|
de45f55a AM |
1 | #!/bin/sh |
2 | ||
3 | set -e | |
4 | ||
5 | # Do not run as root | |
6 | if [ `id -u` = "0" ]; then | |
7 | echo $0: running with id 0, exiting. | |
8 | exit 0 | |
9 | fi | |
10 | ||
11 | if ! test -x "$2" ; then | |
12 | echo "\$2 $2: not exeutable" | |
13 | exit 1 | |
14 | fi | |
15 | ||
16 | # set up directorytree | |
17 | if ! echo "$1" | grep -q '^/......' && test -d "$1"; then | |
18 | echo \$1 needs to be absolute patch | |
19 | exit 1 | |
20 | fi | |
21 | ||
22 | echo ======================================== | |
23 | echo running minimal functionality test for binary $2 in directory $1 | |
24 | ||
25 | top="$1/eximtest" | |
26 | ||
27 | rm -rf $1/eximtest/* | |
0baa7b9d | 28 | mkdir -p $top/var/log $top/var/spool/db $top/var/spool/input $top/var/spool/msglog $top/run $top/var/mail |
de45f55a AM |
29 | cat <<EOF > $top/exim4.conf |
30 | exim_user = `id -u` | |
31 | exim_group = `id -g` | |
32 | log_file_path = $top/var/log/%slog | |
33 | spool_directory = $top/var/spool | |
0baa7b9d | 34 | pid_file_path = $top/run |
de45f55a AM |
35 | primary_hostname = eximtest.example.com |
36 | rfc1413_hosts = | |
37 | ||
38 | begin routers | |
39 | eximtest: | |
40 | driver = accept | |
41 | transport = writetofile | |
42 | ||
43 | begin transports | |
44 | writetofile: | |
45 | driver = appendfile | |
46 | file = $top/var/mail/\$local_part | |
47 | delivery_date_add | |
48 | envelope_to_add | |
49 | return_path_add | |
50 | EOF | |
51 | ||
52 | cat <<EOF > $top/var/mail/compare | |
53 | From from@eximtest.example.com Sat May 07 12:12:12 2012 | |
54 | Return-path: <from@eximtest.example.com> | |
55 | Envelope-to: recip@eximtest.example.com | |
56 | Delivery-date: Sat, 07 May 2011 12:12:12 +0000 | |
57 | Received: from buildd by eximtest.example.com with local (Exim 4.44) | |
58 | (envelope-from <from@eximtest.example.com>) | |
59 | id msgid | |
60 | for recip@eximtest.example.com;Sat, 07 May 2011 12:12:12 +0000 | |
61 | From: Testing Exim <from@eximtest.example.com> | |
62 | To: Recipient <recip@eximtest.example.com> | |
63 | Subject: Test Message | |
64 | Message-Id: <Emsgid@eximtest.example.com> | |
65 | Date: Sat, 07 May 2011 12:12:12 +0000 | |
66 | ||
67 | no body | |
68 | ||
69 | EOF | |
70 | ||
71 | $2 -C "$top/exim4.conf" -bV | |
72 | $2 -C "$top/exim4.conf" -be '${if bool{0}{yes}{no}} X ${if !bool{0}{yes}{no}}' | |
73 | $2 -C "$top/exim4.conf" -bt local | |
74 | printf 'From: Testing Exim <from@eximtest.example.com>\nTo: Recipient <recip@eximtest.example.com>\nSubject: Test Message\n\nno body\n' | \ | |
75 | $2 -C "$top/exim4.conf" -odf -oep -oi -t -f from@eximtest.example.com | |
76 | sed -i -e 's/^From \([^ ]*\) .*/From \1 Sat May 07 12:12:12 2012/' \ | |
77 | -e 's/^Delivery-date: .*/Delivery-date: Sat, 07 May 2011 12:12:12 +0000/' \ | |
78 | -e 's/^Received: from [^ ][^ ]* /Received: from buildd /' \ | |
79 | -e '/^Received:/s/(Exim [^)]*/(Exim 4.44/' \ | |
80 | -e '/[[:space:]]for /s/;.*/;Sat, 07 May 2011 12:12:12 +0000/' \ | |
81 | -e '/[[:space:]]id /s/id .*/id msgid/' \ | |
82 | -e 's/^Message-Id: [^@]*/Message-Id: <Emsgid/' \ | |
83 | -e 's/^Date: .*/Date: Sat, 07 May 2011 12:12:12 +0000/' \ | |
84 | $top/var/mail/recip | |
85 | ||
86 | diff -u $top/var/mail/recip $top/var/mail/compare | |
87 | exit 0 |