Import Debian changes 4.92-8+deb10u4
[hcoop/debian/exim4.git] / debian / minimaltest
CommitLineData
de45f55a
AM
1#!/bin/sh
2
3set -e
4
5# Do not run as root
6if [ `id -u` = "0" ]; then
7 echo $0: running with id 0, exiting.
8 exit 0
9fi
10
11if ! test -x "$2" ; then
12 echo "\$2 $2: not exeutable"
13 exit 1
14fi
15
16# set up directorytree
17if ! echo "$1" | grep -q '^/......' && test -d "$1"; then
18 echo \$1 needs to be absolute patch
19 exit 1
20fi
21
22echo ========================================
23echo running minimal functionality test for binary $2 in directory $1
24
25top="$1/eximtest"
26
27rm -rf $1/eximtest/*
0baa7b9d 28mkdir -p $top/var/log $top/var/spool/db $top/var/spool/input $top/var/spool/msglog $top/run $top/var/mail
de45f55a
AM
29cat <<EOF > $top/exim4.conf
30exim_user = `id -u`
31exim_group = `id -g`
32log_file_path = $top/var/log/%slog
33spool_directory = $top/var/spool
0baa7b9d 34pid_file_path = $top/run
de45f55a
AM
35primary_hostname = eximtest.example.com
36rfc1413_hosts =
37
38begin routers
39eximtest:
40 driver = accept
41 transport = writetofile
42
43begin transports
44writetofile:
45 driver = appendfile
46 file = $top/var/mail/\$local_part
47 delivery_date_add
48 envelope_to_add
49 return_path_add
50EOF
51
52cat <<EOF > $top/var/mail/compare
53From from@eximtest.example.com Sat May 07 12:12:12 2012
54Return-path: <from@eximtest.example.com>
55Envelope-to: recip@eximtest.example.com
56Delivery-date: Sat, 07 May 2011 12:12:12 +0000
57Received: 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
61From: Testing Exim <from@eximtest.example.com>
62To: Recipient <recip@eximtest.example.com>
63Subject: Test Message
64Message-Id: <Emsgid@eximtest.example.com>
65Date: Sat, 07 May 2011 12:12:12 +0000
66
67no body
68
69EOF
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
74printf '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
76sed -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
86diff -u $top/var/mail/recip $top/var/mail/compare
87exit 0