diff options
author | Andreas Metzler <ametzler@debian.org> | 2011-05-07 16:44:18 +0000 |
---|---|---|
committer | Andreas Metzler <ametzler@debian.org> | 2011-05-07 16:44:18 +0000 |
commit | abeb1f298e9b31358822001d345cdf0868188ccd (patch) | |
tree | b1335b9e2c4075b89023751be6115d462c2df592 | |
parent | 3789f5f204835395dcd4c2f42b0ab4d14cae3ebd (diff) | |
download | exim4-abeb1f298e9b31358822001d345cdf0868188ccd.tar.gz |
Run a minimal testsuite after build.
svn path=/exim/trunk/; revision=2617
-rw-r--r-- | debian/changelog | 5 | ||||
-rw-r--r-- | debian/minimaltest | 86 | ||||
-rwxr-xr-x | debian/rules | 19 |
3 files changed, 108 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog index 0122a3d..9fabe00 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,9 @@ exim4 (4.76~RC1-1) experimental; urgency=low 81_negatebool.diff 82_dkimpercent.diff * [Lintian] Fix grammar error in manpage (spelling-error-in-manpage update-exim4defaults.8.gz allows to allows one to). + * [debian/minimaltest]: Added. Try to run a minimal functionality test after + building exim. (Currently only supported if the build-system has a + Debian-exim user.) -- Andreas Metzler <ametzler@debian.org> Fri, 06 May 2011 20:27:56 +0200 @@ -3129,7 +3132,7 @@ exim4 (4.14-0.5) experimental; urgency=low * updated version of dlopen patch (Marc Merlin) * don't regenerate files managed by update-exim4.conf on package updates if the local admin had deleted them. - * replace the listenonpublic yes/no question with one that allows to + * replace the listenonpublic yes/no question with one that allows one to specify on which interfaces to listen to (Closes: #190498) * new dc-question for dial-on-demand-users to minimize DNS lookups diff --git a/debian/minimaltest b/debian/minimaltest new file mode 100644 index 0000000..b39704d --- /dev/null +++ b/debian/minimaltest @@ -0,0 +1,86 @@ +#!/bin/sh + +set -e + +# Do not run as root +if [ `id -u` = "0" ]; then + echo $0: running with id 0, exiting. + exit 0 +fi + +if ! test -x "$2" ; then + echo "\$2 $2: not exeutable" + exit 1 +fi + +# set up directorytree +if ! echo "$1" | grep -q '^/......' && test -d "$1"; then + echo \$1 needs to be absolute patch + exit 1 +fi + +echo ======================================== +echo running minimal functionality test for binary $2 in directory $1 + +top="$1/eximtest" + +rm -rf $1/eximtest/* +mkdir -p $top/var/log $top/var/spool/db $top/var/spool/input $top/var/spool/msglog $top/var/run $top/var/mail +cat <<EOF > $top/exim4.conf +exim_user = `id -u` +exim_group = `id -g` +log_file_path = $top/var/log/%slog +spool_directory = $top/var/spool +pid_file_path = $top/var/run +primary_hostname = eximtest.example.com +rfc1413_hosts = + +begin routers +eximtest: + driver = accept + transport = writetofile + +begin transports +writetofile: + driver = appendfile + file = $top/var/mail/\$local_part + delivery_date_add + envelope_to_add + return_path_add +EOF + +cat <<EOF > $top/var/mail/compare +From from@eximtest.example.com Sat May 07 12:12:12 2012 +Return-path: <from@eximtest.example.com> +Envelope-to: recip@eximtest.example.com +Delivery-date: Sat, 07 May 2011 12:12:12 +0000 +Received: from ametzler by eximtest.example.com with local (Exim 4.44)) + (envelope-from <from@eximtest.example.com>) + id msgid + for recip@eximtest.example.com;Sat, 07 May 2011 12:12:12 +0000 +From: Testing Exim <from@eximtest.example.com> +To: Recipient <recip@eximtest.example.com> +Subject: Test Message +Message-Id: <Emsgid@eximtest.example.com> +Date: Sat, 07 May 2011 12:12:12 +0000 + +no body + +EOF + +$2 -C "$top/exim4.conf" -bV +$2 -C "$top/exim4.conf" -be '${if bool{0}{yes}{no}} X ${if !bool{0}{yes}{no}}' +$2 -C "$top/exim4.conf" -bt local +printf 'From: Testing Exim <from@eximtest.example.com>\nTo: Recipient <recip@eximtest.example.com>\nSubject: Test Message\n\nno body\n' | \ +$2 -C "$top/exim4.conf" -odf -oep -oi -t -f from@eximtest.example.com +sed -i -e 's/^From \([^ ]*\) .*/From \1 Sat May 07 12:12:12 2012/' \ + -e 's/^Delivery-date: .*/Delivery-date: Sat, 07 May 2011 12:12:12 +0000/' \ + -e '/^Received:/s/(Exim [^)]*/(Exim 4.44)/' \ + -e '/[[:space:]]for /s/;.*/;Sat, 07 May 2011 12:12:12 +0000/' \ + -e '/[[:space:]]id /s/id .*/id msgid/' \ + -e 's/^Message-Id: [^@]*/Message-Id: <Emsgid/' \ + -e 's/^Date: .*/Date: Sat, 07 May 2011 12:12:12 +0000/' \ + $top/var/mail/recip + +diff -u $top/var/mail/recip $top/var/mail/compare +exit 0 diff --git a/debian/rules b/debian/rules index 67efb77..68d336f 100755 --- a/debian/rules +++ b/debian/rules @@ -220,7 +220,7 @@ build-indep-stamp: touch build-indep-stamp -build-arch: build-arch-stamp +build-arch: build-arch-stamp test-stamp ifeq ($(buildbasepackages),yes) build-arch-stamp: build-tree/build-exim4-daemon-light/exim $(daemonbinaries) @@ -230,6 +230,23 @@ endif dh_testdir touch build-arch-stamp +test-stamp: build-arch-stamp + # it is not possible to run exim unless the compile-time specified + # user exists. + if id -u Debian-exim ; then \ + echo Debian-exim user found, running minimal testsuite ; \ + chmod +x debian/minimaltest ; \ + rm -rf $(CURDIR)/test ; \ + for i in build-tree/build-exim4-daemon-light/exim \ + $(daemonbinaries) ;\ + do mkdir $(CURDIR)/test && \ + debian/minimaltest $(CURDIR)/test $$i || \ + { echo testsuite error ; exit 1 ; } ; \ + rm -rf $(CURDIR)/test ; \ + done \ + fi + touch $@ + build: build-arch build-indep clean: cleanfiles |