masqmail-0.2

changeset 63:49ca781e1503

reworked the test cases completely they are split into four independent tests now and each one is tested to work with the current version
author meillo@marmaro.de
date Sun, 30 May 2010 16:05:49 +0200
parents 610cd4e09b91
children 0379789a847b
files tests/Makefile tests/README tests/conf.templ tests/hostname-stdin/README tests/hostname-stdin/makefile tests/hostname-stdin/test.conf.tpl tests/hostname-stdin/test.tpl tests/localhost-stdin/README tests/localhost-stdin/makefile tests/localhost-stdin/test tests/localhost-stdin/test.conf.tpl tests/makefile tests/relay-to-hostname-mta/README tests/relay-to-hostname-mta/makefile tests/relay-to-hostname-mta/online tests/relay-to-hostname-mta/test.conf.tpl tests/relay-to-hostname-mta/test.tpl tests/relay-to-localhost-mta/README tests/relay-to-localhost-mta/makefile tests/relay-to-localhost-mta/online tests/relay-to-localhost-mta/test.conf.tpl tests/relay-to-localhost-mta/test.route tests/relay-to-localhost-mta/test.tpl tests/test.templ
diffstat 24 files changed, 660 insertions(+), 194 deletions(-) [+]
line diff
     1.1 --- a/tests/Makefile	Sat May 29 23:48:42 2010 +0200
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,21 +0,0 @@
     1.4 -# Makefile by markus schnalke <meillo@marmaro.de>
     1.5 -# heavily based on Makefile.am written by oliver kurth
     1.6 -
     1.7 -all: test.conf local.sh smtpout.sh
     1.8 -	mkdir -p ./input ./lock
     1.9 -
    1.10 -test.conf: conf.templ
    1.11 -	# fails if the current path contains `^'.
    1.12 -	sed "s/SMTP_HOST/`hostname`/; s^PWD^`pwd`^" conf.templ > test.conf
    1.13 -
    1.14 -local.sh: test.templ
    1.15 -	sed s/RECV_HOST/localhost/ test.templ > local.sh
    1.16 -	chmod ugo+x local.sh
    1.17 -
    1.18 -smtpout.sh: test.templ
    1.19 -	sed s/RECV_HOST/`hostname`/ test.templ > smtpout.sh
    1.20 -	chmod ugo+x smtpout.sh
    1.21 -
    1.22 -clean:
    1.23 -	rm -f test.conf local.sh smtpout.sh
    1.24 -	rm -rf ./input ./lock
     2.1 --- a/tests/README	Sat May 29 23:48:42 2010 +0200
     2.2 +++ b/tests/README	Sun May 30 16:05:49 2010 +0200
     2.3 @@ -1,37 +1,29 @@
     2.4 -Here a two test programs: local.sh and smtpout.sh. They both send
     2.5 -three mails, using different options. Run them from within this
     2.6 -directory, preferably NOT as root, but you got to have write
     2.7 -permission for this directory.
     2.8 +This directory contains test cases for masqmail, one in each directory.
     2.9  
    2.10 -local.sh sends mail accepted from stdin and sends them to a fake local
    2.11 -mailbox, using your login name. If it works, there should be a file
    2.12 -named with your login name with the mails. You can look at it with cat
    2.13 -or less, or with an ordinary mail program.
    2.14 +Build the test scripts be running
    2.15 +	make
    2.16 +in the directory. You can build all of them by running
    2.17 +	make
    2.18 +in the tests directory.
    2.19  
    2.20 -smtpout.sh sends mail accepted from stdin and sends them to your local
    2.21 -MTA, so use it only if you have an MTA running on your box (sendmail,
    2.22 -exim, qmail or whatever, or masqmail when you have it already
    2.23 -installed). If it works, you should get three mails.
    2.24 +Run the test by executing
    2.25 +	./test
    2.26 +in its directory, preferably NOT as root, but you got to have write
    2.27 +permission for the directory.
    2.28  
    2.29 -The scripts assume that your login name corresponds to your mailbox
    2.30 -(quite probable) and that your MTA listens on port 25 with the
    2.31 -interface which corresponds to the hostname as returned by the shell
    2.32 -command "hostname" (without quotes...), also very probable. They are
    2.33 -created with make from test.templ. They use a special configuration
    2.34 -(test.conf) for masqmail, which is also created with make from
    2.35 -conf.templ.
    2.36  
    2.37 -Two log files, masqmail.log and debug.log will also be created within
    2.38 -this directory. They may give some information if anything went wrong.
    2.39 +Usually, two log files, masqmail.log and debug.log, will be created.
    2.40 +They may give some information if anything went wrong.
    2.41  
    2.42 -If the log files reveal that your MTA is not willing to relay, you may
    2.43 -have to qualify the hostname: Say
    2.44 +The README files in the test case directories explain the tests in
    2.45 +more detail.
    2.46  
    2.47 -sed s/RECV_HOST/foo.bar.com/ test.templ > smtpout.sh
    2.48  
    2.49 -where you set your fully qualified host name for foo.bar.com.
    2.50 +FIXME: Currently, the return values of the test scripts don't express
    2.51 +       if the test was successful or not.
    2.52  
    2.53 -If they do not work, there could be some problem with either the test
    2.54 +
    2.55 +If tests do not work, there could be some problem with either the test
    2.56  programs, the configuration file or masqmail itself. If you have
    2.57  installed masqmail successfully and these scripts do not work, do not
    2.58  worry too much :-).
     3.1 --- a/tests/conf.templ	Sat May 29 23:48:42 2010 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,66 +0,0 @@
     3.4 -# Example configuration for MasqMail
     3.5 -# Copyright (C) 1999 Oliver Kurth
     3.6 -#
     3.7 -# This program is free software; you can redistribute it and/or modify
     3.8 -# it under the terms of the GNU General Public License as published by
     3.9 -# the Free Software Foundation; either version 2 of the License, or
    3.10 -# (at your option) any later version.
    3.11 -
    3.12 -# This program is distributed in the hope that it will be useful,
    3.13 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.15 -# GNU General Public License for more details.
    3.16 -
    3.17 -# You should have received a copy of the GNU General Public License
    3.18 -# along with this program; if not, write to the Free Software
    3.19 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    3.20 -#
    3.21 -
    3.22 -# this is just for testing. In real life it does not make much sense:
    3.23 -run_as_user=true
    3.24 -
    3.25 -# set debug level (0 = no debugging, 5 = very much, 6 = too much)
    3.26 -# can also be set with the -d option on the cmd line
    3.27 -debug_level = 5
    3.28 -
    3.29 -do_queue = false
    3.30 -
    3.31 -# The name with which MasqMail identifies itself to others:
    3.32 -host_name="SMTP_HOST"
    3.33 -
    3.34 -# Hosts considered local:
    3.35 -#local_hosts="localhost;blue.patchwork.net;blue"
    3.36 -local_hosts="localhost"
    3.37 -
    3.38 -# Nets considered local, for immediate delivery attempts:
    3.39 -# ALL hosts not included in either local_host or local_nets are
    3.40 -# considered to be 'outside', meaning that messages to them will be queued
    3.41 -local_nets="SMTP_HOST"
    3.42 -
    3.43 -# accept connections on these interfaces:
    3.44 -listen_addresses="localhost:2525"
    3.45 -
    3.46 -# send messages to this port:
    3.47 -# probably this will also be configurable on host basis
    3.48 -#remote_port=25
    3.49 -
    3.50 -# where MasqMail stores its spool files and other stuff:
    3.51 -#spool_dir="/var/spool/masqmail"
    3.52 -spool_dir="PWD"
    3.53 -
    3.54 -# where local mail will be written to:
    3.55 -#mail_dir="/var/spool/mail"
    3.56 -mail_dir="PWD"
    3.57 -
    3.58 -# use syslogd for logs?
    3.59 -use_syslog=false
    3.60 -
    3.61 -# directory for log files if not using syslogd:
    3.62 -#log_dir="/var/masqmail"
    3.63 -log_dir="PWD"
    3.64 -
    3.65 -# special routes:
    3.66 -
    3.67 -#connect_route.GWDG = "src/gwdg.route"
    3.68 -#connect_route.Argon = "src/argon.route"
    3.69 -
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tests/hostname-stdin/README	Sun May 30 16:05:49 2010 +0200
     4.3 @@ -0,0 +1,11 @@
     4.4 +Test hostname-stdin
     4.5 +-------------------
     4.6 +
     4.7 +Sends three mails, using different options, to <you@hostname>. The
     4.8 +mails are passed on stdin.
     4.9 +
    4.10 +Two log files, masqmail.log and debug.log will also be created within
    4.11 +this directory. They may give some information if anything went wrong.
    4.12 +
    4.13 +Run them from within this directory, preferably NOT as root, but you
    4.14 +got to have write permission for this directory.
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tests/hostname-stdin/makefile	Sun May 30 16:05:49 2010 +0200
     5.3 @@ -0,0 +1,20 @@
     5.4 +# Makefile by markus schnalke <meillo@marmaro.de>
     5.5 +# heavily based on Makefile.am written by oliver kurth
     5.6 +
     5.7 +all: test test.conf
     5.8 +	mkdir -p ./input ./lock
     5.9 +
    5.10 +test.conf: test.conf.tpl
    5.11 +	# fails if the current path contains `^'.
    5.12 +	sed "s/SMTP_HOST/`hostname`/; s^PWD^`pwd`^" $< >$@
    5.13 +
    5.14 +test: test.tpl
    5.15 +	sed s/RECV_HOST/`hostname`/ $< >$@
    5.16 +	chmod +x $@
    5.17 +
    5.18 +clean:
    5.19 +	rm -f test.conf test
    5.20 +
    5.21 +realclean: clean
    5.22 +	rm -rf ./input ./lock
    5.23 +	rm -f *.log `logname`
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/tests/hostname-stdin/test.conf.tpl	Sun May 30 16:05:49 2010 +0200
     6.3 @@ -0,0 +1,39 @@
     6.4 +# Example configuration for MasqMail
     6.5 +# Copyright (C) 1999 Oliver Kurth
     6.6 +
     6.7 +
     6.8 +# this is just for testing. In real life it does not make much sense:
     6.9 +run_as_user=true
    6.10 +
    6.11 +# set debug level (0 = no debugging, 5 = very much, 6 = too much)
    6.12 +# can also be set with the -d option on the cmd line
    6.13 +debug_level = 5
    6.14 +
    6.15 +do_queue = false
    6.16 +
    6.17 +# The name with which MasqMail identifies itself to others:
    6.18 +host_name="SMTP_HOST"
    6.19 +
    6.20 +# Hosts considered local:
    6.21 +local_hosts="SMTP_HOST"
    6.22 +
    6.23 +# Nets considered local, for immediate delivery attempts:
    6.24 +# ALL hosts not included in either local_host or local_nets are
    6.25 +# considered to be 'outside', meaning that messages to them will be queued
    6.26 +#local_nets="SMTP_HOST"
    6.27 +
    6.28 +# accept connections on these interfaces:
    6.29 +#listen_addresses="localhost:2525"
    6.30 +
    6.31 +# where MasqMail stores its spool files and other stuff:
    6.32 +#spool_dir="/var/spool/masqmail"
    6.33 +spool_dir="PWD"
    6.34 +
    6.35 +# where local mail will be written to:
    6.36 +mail_dir="PWD"
    6.37 +
    6.38 +# use syslogd for logs?
    6.39 +use_syslog=false
    6.40 +
    6.41 +# directory for log files if not using syslogd:
    6.42 +log_dir="PWD"
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tests/hostname-stdin/test.tpl	Sun May 30 16:05:49 2010 +0200
     7.3 @@ -0,0 +1,78 @@
     7.4 +#! /bin/bash
     7.5 +
     7.6 +# should be run from within tests dir set if you move this:
     7.7 +mm_bin=../../src/masqmail
     7.8 +
     7.9 +hfrom="\"Fritz Meier\" <`logname`@RECV_HOST>"
    7.10 +hto="$hfrom"
    7.11 +to=`logname`@RECV_HOST
    7.12 +hsubject="MasqMail stdin Test"
    7.13 +
    7.14 +
    7.15 +# Testing with rcpt on cmd line
    7.16 +# (dot does end)
    7.17 +#
    7.18 +# the command to be run:
    7.19 +cmd="$mm_bin -C ./test.conf $to"
    7.20 +
    7.21 +$cmd <<EOF
    7.22 +From: $hfrom
    7.23 +To: $hto
    7.24 +Subject: $hsubject
    7.25 +
    7.26 +Hallo Fritz!
    7.27 +
    7.28 +..
    7.29 +there is a dot above (Yes, one and not two).
    7.30 +
    7.31 +command was: $cmd
    7.32 +
    7.33 +Fritz
    7.34 +.
    7.35 +
    7.36 +EOF
    7.37 +
    7.38 +#
    7.39 +# Testing with rcpt on cmd line with -oi option
    7.40 +# (dot does not end)
    7.41 +#
    7.42 +# the command to be run:
    7.43 +cmd="$mm_bin -C ./test.conf -oi $to"
    7.44 +
    7.45 +$cmd <<EOF
    7.46 +From: $hfrom
    7.47 +To: $hto
    7.48 +Subject: $hsubject
    7.49 +
    7.50 +Hallo Fritz!
    7.51 +.
    7.52 +there is a dot above.
    7.53 +
    7.54 +command was: $cmd
    7.55 +
    7.56 +Fritz
    7.57 +
    7.58 +EOF
    7.59 +
    7.60 +#
    7.61 +# Testing with rcpt read from headers (-t option)
    7.62 +# (dot does end)
    7.63 +#
    7.64 +# the command to be run:
    7.65 +cmd="$mm_bin -C ./test.conf -t"
    7.66 +
    7.67 +$cmd <<EOF
    7.68 +From: $hfrom
    7.69 +To: $hto
    7.70 +Subject: $hsubject
    7.71 +
    7.72 +Hallo Fritz!
    7.73 +..
    7.74 +there is a dot above.
    7.75 +
    7.76 +command was: $cmd
    7.77 +
    7.78 +Fritz
    7.79 +.
    7.80 +
    7.81 +EOF
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tests/localhost-stdin/README	Sun May 30 16:05:49 2010 +0200
     8.3 @@ -0,0 +1,14 @@
     8.4 +localhost-stdin
     8.5 +---------------
     8.6 +
     8.7 +Three mails are sent, using different options, to <you@localhost>.
     8.8 +local.sh sends mail accepted from stdin and sends them to a fake local
     8.9 +mailbox, using your login name. If it works, there should be a file
    8.10 +named with your login name with the mails. You can look at it with cat
    8.11 +or less, or with an ordinary mail program.
    8.12 +
    8.13 +Two log files, masqmail.log and debug.log will also be created within
    8.14 +this directory. They may give some information if anything went wrong.
    8.15 +
    8.16 +Run them from within this directory, preferably NOT as root, but you
    8.17 +got to have write permission for this directory.
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tests/localhost-stdin/makefile	Sun May 30 16:05:49 2010 +0200
     9.3 @@ -0,0 +1,16 @@
     9.4 +# Makefile by markus schnalke <meillo@marmaro.de>
     9.5 +# heavily based on Makefile.am written by oliver kurth
     9.6 +
     9.7 +all: test.conf
     9.8 +	mkdir -p ./input ./lock
     9.9 +
    9.10 +test.conf: test.conf.tpl
    9.11 +	# fails if the current path contains `^'.
    9.12 +	sed "s^PWD^`pwd`^" $< >$@
    9.13 +
    9.14 +clean:
    9.15 +	rm -f test.conf
    9.16 +
    9.17 +realclean: clean
    9.18 +	rm -rf ./input ./lock
    9.19 +	rm -f *.log `logname`
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/tests/localhost-stdin/test	Sun May 30 16:05:49 2010 +0200
    10.3 @@ -0,0 +1,79 @@
    10.4 +#! /bin/bash
    10.5 +
    10.6 +# should be run from within tests dir set if you move this:
    10.7 +mm_bin=../../src/masqmail
    10.8 +
    10.9 +#
   10.10 +hfrom="\"Fritz Meier\" <`logname`@localhost>"
   10.11 +hto=$hfrom
   10.12 +to=`logname`@localhost
   10.13 +hsubject="MasqMail stdin Test"
   10.14 +
   10.15 +#
   10.16 +# Testing with rcpt on cmd line
   10.17 +# (dot does end)
   10.18 +#
   10.19 +# the command to be run:
   10.20 +cmd="$mm_bin -C ./test.conf $to"
   10.21 +
   10.22 +$cmd <<EOF
   10.23 +From: $hfrom
   10.24 +To: $hto
   10.25 +Subject: $hsubject
   10.26 +
   10.27 +Hallo Fritz!
   10.28 +
   10.29 +..
   10.30 +there is a dot above (Yes, one and not two).
   10.31 +
   10.32 +command was: $cmd
   10.33 +
   10.34 +Fritz
   10.35 +.
   10.36 +
   10.37 +EOF
   10.38 +
   10.39 +#
   10.40 +# Testing with rcpt on cmd line with -oi option
   10.41 +# (dot does not end)
   10.42 +#
   10.43 +# the command to be run:
   10.44 +cmd="$mm_bin -C ./test.conf -oi $to"
   10.45 +
   10.46 +$cmd <<EOF
   10.47 +From: $hfrom
   10.48 +To: $hto
   10.49 +Subject: $hsubject
   10.50 +
   10.51 +Hallo Fritz!
   10.52 +.
   10.53 +there is a dot above.
   10.54 +
   10.55 +command was: $cmd
   10.56 +
   10.57 +Fritz
   10.58 +
   10.59 +EOF
   10.60 +
   10.61 +#
   10.62 +# Testing with rcpt read from headers (-t option)
   10.63 +# (dot does end)
   10.64 +#
   10.65 +# the command to be run:
   10.66 +cmd="$mm_bin -C ./test.conf -t"
   10.67 +
   10.68 +$cmd <<EOF
   10.69 +From: $hfrom
   10.70 +To: $hto
   10.71 +Subject: $hsubject
   10.72 +
   10.73 +Hallo Fritz!
   10.74 +..
   10.75 +there is a dot above.
   10.76 +
   10.77 +command was: $cmd
   10.78 +
   10.79 +Fritz
   10.80 +.
   10.81 +
   10.82 +EOF
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/tests/localhost-stdin/test.conf.tpl	Sun May 30 16:05:49 2010 +0200
    11.3 @@ -0,0 +1,45 @@
    11.4 +# Example configuration for MasqMail
    11.5 +# Copyright (C) 1999 Oliver Kurth
    11.6 +
    11.7 +
    11.8 +# this is just for testing. In real life it does not make much sense:
    11.9 +run_as_user=true
   11.10 +
   11.11 +# set debug level (0 = no debugging, 5 = very much, 6 = too much)
   11.12 +# can also be set with the -d option on the cmd line
   11.13 +debug_level = 5
   11.14 +
   11.15 +do_queue = false
   11.16 +
   11.17 +# The name with which MasqMail identifies itself to others:
   11.18 +host_name="SMTP_HOST"
   11.19 +
   11.20 +# Hosts considered local:
   11.21 +#local_hosts="localhost;blue.patchwork.net;blue"
   11.22 +local_hosts="localhost"
   11.23 +
   11.24 +# Nets considered local, for immediate delivery attempts:
   11.25 +# ALL hosts not included in either local_host or local_nets are
   11.26 +# considered to be 'outside', meaning that messages to them will be queued
   11.27 +#local_nets="SMTP_HOST"
   11.28 +
   11.29 +# accept connections on these interfaces:
   11.30 +#listen_addresses="localhost:2525"
   11.31 +
   11.32 +# send messages to this port:
   11.33 +# probably this will also be configurable on host basis
   11.34 +#remote_port=25
   11.35 +
   11.36 +# where MasqMail stores its spool files and other stuff:
   11.37 +#spool_dir="/var/spool/masqmail"
   11.38 +spool_dir="PWD"
   11.39 +
   11.40 +# where local mail will be written to:
   11.41 +#mail_dir="/var/spool/mail"
   11.42 +mail_dir="PWD"
   11.43 +
   11.44 +# use syslogd for logs?
   11.45 +use_syslog=false
   11.46 +
   11.47 +# directory for log files if not using syslogd:
   11.48 +log_dir="PWD"
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/tests/makefile	Sun May 30 16:05:49 2010 +0200
    12.3 @@ -0,0 +1,24 @@
    12.4 +
    12.5 +all:
    12.6 +	cd hostname-stdin && make
    12.7 +	cd localhost-stdin && make
    12.8 +	cd relay-to-localhost-mta && make
    12.9 +	cd relay-to-hostname-mta && make
   12.10 +
   12.11 +run: all
   12.12 +	cd hostname-stdin && ./test
   12.13 +	cd localhost-stdin && ./test
   12.14 +	cd relay-to-localhost-mta && ./test
   12.15 +	cd relay-to-hostname-mta && ./test
   12.16 +
   12.17 +clean:
   12.18 +	cd hostname-stdin && make clean
   12.19 +	cd localhost-stdin && make clean
   12.20 +	cd relay-to-localhost-mta && make clean
   12.21 +	cd relay-to-hostname-mta && make clean
   12.22 +
   12.23 +realclean:
   12.24 +	cd hostname-stdin && make realclean
   12.25 +	cd localhost-stdin && make realclean
   12.26 +	cd relay-to-localhost-mta && make realclean
   12.27 +	cd relay-to-hostname-mta && make realclean
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/tests/relay-to-hostname-mta/README	Sun May 30 16:05:49 2010 +0200
    13.3 @@ -0,0 +1,24 @@
    13.4 +relay-to-localhost-mta
    13.5 +----------------------
    13.6 +
    13.7 +Send three mails, using different options, to stdin of masqmail, which
    13.8 +relays it per STMP to a local MTA listening at localhost:25.
    13.9 +
   13.10 +So use it only if you have an MTA running on your box (sendmail,
   13.11 +exim, qmail or whatever, or masqmail when you have it already
   13.12 +installed).
   13.13 +
   13.14 +If it works, you should get three mails.
   13.15 +Two log files, masqmail.log and debug.log will also be created within
   13.16 +this directory. They may give some information if anything went wrong.
   13.17 +
   13.18 +The scripts assume that your login name corresponds to your mailbox
   13.19 +(quite probable) and that your MTA listens on port 25 with the
   13.20 +interface which corresponds to the hostname as returned by the shell
   13.21 +command "hostname" (without quotes...), also very probable.
   13.22 +
   13.23 +If the log files reveal that your MTA is not willing to relay, you may
   13.24 +have to qualify the hostname. You might want to do this in a way
   13.25 +similar to:
   13.26 +
   13.27 +	sed 's/RECV_HOST/foo.example.org/' test.tpl >test
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/tests/relay-to-hostname-mta/makefile	Sun May 30 16:05:49 2010 +0200
    14.3 @@ -0,0 +1,23 @@
    14.4 +# Makefile by markus schnalke <meillo@marmaro.de>
    14.5 +# heavily based on Makefile.am written by oliver kurth
    14.6 +
    14.7 +all: test test.conf test.route
    14.8 +	mkdir -p ./input ./lock
    14.9 +
   14.10 +test.conf: test.conf.tpl
   14.11 +	# fails if the current path contains `^'.
   14.12 +	sed "s^PWD^`pwd`^" $< >$@
   14.13 +
   14.14 +test: test.tpl
   14.15 +	sed s/RECV_HOST/`hostname`/ $< >$@
   14.16 +	chmod +x $@
   14.17 +
   14.18 +test.route:
   14.19 +	echo mail_host=\"`hostname`\" >$@
   14.20 +
   14.21 +clean:
   14.22 +	rm -f test.conf test test.route
   14.23 +
   14.24 +realclean: clean
   14.25 +	rm -rf ./input ./lock
   14.26 +	rm -f *.log
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/tests/relay-to-hostname-mta/online	Sun May 30 16:05:49 2010 +0200
    15.3 @@ -0,0 +1,1 @@
    15.4 +test
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/tests/relay-to-hostname-mta/test.conf.tpl	Sun May 30 16:05:49 2010 +0200
    16.3 @@ -0,0 +1,33 @@
    16.4 +
    16.5 +# this is just for testing. In real life it does not make much sense:
    16.6 +run_as_user=true
    16.7 +
    16.8 +# set debug level (0 = no debugging, 5 = very much, 6 = too much)
    16.9 +# can also be set with the -d option on the cmd line
   16.10 +debug_level = 5
   16.11 +
   16.12 +do_queue = false
   16.13 +
   16.14 +# The name with which MasqMail identifies itself to others:
   16.15 +host_name="MASQMAIL-TEST"
   16.16 +
   16.17 +# where MasqMail stores its spool files and other stuff:
   16.18 +spool_dir="PWD"
   16.19 +
   16.20 +# where local mail will be written to:
   16.21 +mail_dir="PWD"
   16.22 +
   16.23 +# use syslogd for logs?
   16.24 +use_syslog=false
   16.25 +
   16.26 +# directory for log files if not using syslogd:
   16.27 +log_dir="PWD"
   16.28 +
   16.29 +online_routes.test = "PWD/test.route"
   16.30 +
   16.31 +errmsg_file="PWD/../../tpl/failmsg.tpl"
   16.32 +warnmsg_file="PWD/../../tpl/warnmsg.tpl"
   16.33 +
   16.34 +online_detect = "file"
   16.35 +online_file = "PWD/online"
   16.36 +
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/tests/relay-to-hostname-mta/test.tpl	Sun May 30 16:05:49 2010 +0200
    17.3 @@ -0,0 +1,78 @@
    17.4 +#! /bin/bash
    17.5 +
    17.6 +# should be run from within tests dir set if you move this:
    17.7 +mm_bin=../../src/masqmail
    17.8 +
    17.9 +hfrom="\"Fritz Meier\" <`logname`@RECV_HOST>"
   17.10 +hto="$hfrom"
   17.11 +to=`logname`@RECV_HOST
   17.12 +hsubject="MasqMail stdin Test"
   17.13 +
   17.14 +
   17.15 +# Testing with rcpt on cmd line
   17.16 +# (dot does end)
   17.17 +#
   17.18 +# the command to be run:
   17.19 +cmd="$mm_bin -C ./test.conf $to"
   17.20 +
   17.21 +$cmd <<EOF
   17.22 +From: $hfrom
   17.23 +To: $hto
   17.24 +Subject: $hsubject
   17.25 +
   17.26 +Hallo Fritz!
   17.27 +
   17.28 +..
   17.29 +there is a dot above (Yes, one and not two).
   17.30 +
   17.31 +command was: $cmd
   17.32 +
   17.33 +Fritz
   17.34 +.
   17.35 +
   17.36 +EOF
   17.37 +
   17.38 +#
   17.39 +# Testing with rcpt on cmd line with -oi option
   17.40 +# (dot does not end)
   17.41 +#
   17.42 +# the command to be run:
   17.43 +cmd="$mm_bin -C ./test.conf -oi $to"
   17.44 +
   17.45 +$cmd <<EOF
   17.46 +From: $hfrom
   17.47 +To: $hto
   17.48 +Subject: $hsubject
   17.49 +
   17.50 +Hallo Fritz!
   17.51 +.
   17.52 +there is a dot above.
   17.53 +
   17.54 +command was: $cmd
   17.55 +
   17.56 +Fritz
   17.57 +
   17.58 +EOF
   17.59 +
   17.60 +#
   17.61 +# Testing with rcpt read from headers (-t option)
   17.62 +# (dot does end)
   17.63 +#
   17.64 +# the command to be run:
   17.65 +cmd="$mm_bin -C ./test.conf -t"
   17.66 +
   17.67 +$cmd <<EOF
   17.68 +From: $hfrom
   17.69 +To: $hto
   17.70 +Subject: $hsubject
   17.71 +
   17.72 +Hallo Fritz!
   17.73 +..
   17.74 +there is a dot above.
   17.75 +
   17.76 +command was: $cmd
   17.77 +
   17.78 +Fritz
   17.79 +.
   17.80 +
   17.81 +EOF
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/tests/relay-to-localhost-mta/README	Sun May 30 16:05:49 2010 +0200
    18.3 @@ -0,0 +1,24 @@
    18.4 +relay-to-localhost-mta
    18.5 +----------------------
    18.6 +
    18.7 +Send three mails, using different options, to stdin of masqmail, which
    18.8 +relays it per STMP to a local MTA listening at localhost:25.
    18.9 +
   18.10 +So use it only if you have an MTA running on your box (sendmail,
   18.11 +exim, qmail or whatever, or masqmail when you have it already
   18.12 +installed).
   18.13 +
   18.14 +If it works, you should get three mails.
   18.15 +Two log files, masqmail.log and debug.log will also be created within
   18.16 +this directory. They may give some information if anything went wrong.
   18.17 +
   18.18 +The scripts assume that your login name corresponds to your mailbox
   18.19 +(quite probable) and that your MTA listens on port 25 with the
   18.20 +interface which corresponds to the hostname as returned by the shell
   18.21 +command "hostname" (without quotes...), also very probable.
   18.22 +
   18.23 +If the log files reveal that your MTA is not willing to relay, you may
   18.24 +have to qualify the hostname. You might want to do this in a way
   18.25 +similar to:
   18.26 +
   18.27 +	sed 's/RECV_HOST/foo.example.org/' test.tpl >test
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/tests/relay-to-localhost-mta/makefile	Sun May 30 16:05:49 2010 +0200
    19.3 @@ -0,0 +1,20 @@
    19.4 +# Makefile by markus schnalke <meillo@marmaro.de>
    19.5 +# heavily based on Makefile.am written by oliver kurth
    19.6 +
    19.7 +all: test test.conf
    19.8 +	mkdir -p ./input ./lock
    19.9 +
   19.10 +test.conf: test.conf.tpl
   19.11 +	# fails if the current path contains `^'.
   19.12 +	sed "s^PWD^`pwd`^" $< >$@
   19.13 +
   19.14 +test: test.tpl
   19.15 +	sed s/RECV_HOST/`hostname`/ $< >$@
   19.16 +	chmod +x $@
   19.17 +
   19.18 +clean:
   19.19 +	rm -f test.conf test
   19.20 +
   19.21 +realclean: clean
   19.22 +	rm -rf ./input ./lock
   19.23 +	rm -f *.log
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/tests/relay-to-localhost-mta/online	Sun May 30 16:05:49 2010 +0200
    20.3 @@ -0,0 +1,1 @@
    20.4 +test
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/tests/relay-to-localhost-mta/test.conf.tpl	Sun May 30 16:05:49 2010 +0200
    21.3 @@ -0,0 +1,33 @@
    21.4 +
    21.5 +# this is just for testing. In real life it does not make much sense:
    21.6 +run_as_user=true
    21.7 +
    21.8 +# set debug level (0 = no debugging, 5 = very much, 6 = too much)
    21.9 +# can also be set with the -d option on the cmd line
   21.10 +debug_level = 5
   21.11 +
   21.12 +do_queue = false
   21.13 +
   21.14 +# The name with which MasqMail identifies itself to others:
   21.15 +host_name="MASQMAIL-TEST"
   21.16 +
   21.17 +# where MasqMail stores its spool files and other stuff:
   21.18 +spool_dir="PWD"
   21.19 +
   21.20 +# where local mail will be written to:
   21.21 +mail_dir="PWD"
   21.22 +
   21.23 +# use syslogd for logs?
   21.24 +use_syslog=false
   21.25 +
   21.26 +# directory for log files if not using syslogd:
   21.27 +log_dir="PWD"
   21.28 +
   21.29 +online_routes.test = "PWD/test.route"
   21.30 +
   21.31 +errmsg_file="PWD/../../tpl/failmsg.tpl"
   21.32 +warnmsg_file="PWD/../../tpl/warnmsg.tpl"
   21.33 +
   21.34 +online_detect = "file"
   21.35 +online_file = "PWD/online"
   21.36 +
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/tests/relay-to-localhost-mta/test.route	Sun May 30 16:05:49 2010 +0200
    22.3 @@ -0,0 +1,1 @@
    22.4 +mail_host = "localhost"
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/tests/relay-to-localhost-mta/test.tpl	Sun May 30 16:05:49 2010 +0200
    23.3 @@ -0,0 +1,78 @@
    23.4 +#! /bin/bash
    23.5 +
    23.6 +# should be run from within tests dir set if you move this:
    23.7 +mm_bin=../../src/masqmail
    23.8 +
    23.9 +hfrom="\"Fritz Meier\" <`logname`@RECV_HOST>"
   23.10 +hto="$hfrom"
   23.11 +to=`logname`@RECV_HOST
   23.12 +hsubject="MasqMail stdin Test"
   23.13 +
   23.14 +
   23.15 +# Testing with rcpt on cmd line
   23.16 +# (dot does end)
   23.17 +#
   23.18 +# the command to be run:
   23.19 +cmd="$mm_bin -C ./test.conf $to"
   23.20 +
   23.21 +$cmd <<EOF
   23.22 +From: $hfrom
   23.23 +To: $hto
   23.24 +Subject: $hsubject
   23.25 +
   23.26 +Hallo Fritz!
   23.27 +
   23.28 +..
   23.29 +there is a dot above (Yes, one and not two).
   23.30 +
   23.31 +command was: $cmd
   23.32 +
   23.33 +Fritz
   23.34 +.
   23.35 +
   23.36 +EOF
   23.37 +
   23.38 +#
   23.39 +# Testing with rcpt on cmd line with -oi option
   23.40 +# (dot does not end)
   23.41 +#
   23.42 +# the command to be run:
   23.43 +cmd="$mm_bin -C ./test.conf -oi $to"
   23.44 +
   23.45 +$cmd <<EOF
   23.46 +From: $hfrom
   23.47 +To: $hto
   23.48 +Subject: $hsubject
   23.49 +
   23.50 +Hallo Fritz!
   23.51 +.
   23.52 +there is a dot above.
   23.53 +
   23.54 +command was: $cmd
   23.55 +
   23.56 +Fritz
   23.57 +
   23.58 +EOF
   23.59 +
   23.60 +#
   23.61 +# Testing with rcpt read from headers (-t option)
   23.62 +# (dot does end)
   23.63 +#
   23.64 +# the command to be run:
   23.65 +cmd="$mm_bin -C ./test.conf -t"
   23.66 +
   23.67 +$cmd <<EOF
   23.68 +From: $hfrom
   23.69 +To: $hto
   23.70 +Subject: $hsubject
   23.71 +
   23.72 +Hallo Fritz!
   23.73 +..
   23.74 +there is a dot above.
   23.75 +
   23.76 +command was: $cmd
   23.77 +
   23.78 +Fritz
   23.79 +.
   23.80 +
   23.81 +EOF
    24.1 --- a/tests/test.templ	Sat May 29 23:48:42 2010 +0200
    24.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.3 @@ -1,81 +0,0 @@
    24.4 -#! /bin/bash
    24.5 -
    24.6 -# should be run from within tests dir
    24.7 -# set if you move this:
    24.8 -mm_src_dir=../src
    24.9 -mm_bin=$mm_src_dir/masqmail
   24.10 -
   24.11 -#
   24.12 -hfrom="\"Fritz Meier\" <`logname`@RECV_HOST>"
   24.13 -hto=$hfrom
   24.14 -to=`logname`@RECV_HOST
   24.15 -hsubject="MasqMail stdin Test"
   24.16 -
   24.17 -#
   24.18 -# Testing with rcpt on cmd line
   24.19 -# (dot does end)
   24.20 -#
   24.21 -# the command to be run:
   24.22 -cmd="$mm_bin -C ./test.conf $to"
   24.23 -
   24.24 -$cmd <<EOF
   24.25 -From: $hfrom
   24.26 -To: $hto
   24.27 -Subject: $hsubject
   24.28 -
   24.29 -Hallo Fritz!
   24.30 -
   24.31 -..
   24.32 -there is a dot above (Yes, one and not two).
   24.33 -
   24.34 -command was: $cmd
   24.35 -
   24.36 -Fritz
   24.37 -.
   24.38 -
   24.39 -EOF
   24.40 -
   24.41 -#
   24.42 -# Testing with rcpt on cmd line with -oi option
   24.43 -# (dot does not end)
   24.44 -#
   24.45 -# the command to be run:
   24.46 -cmd="$mm_bin -C ./test.conf -oi $to"
   24.47 -
   24.48 -$cmd <<EOF
   24.49 -From: $hfrom
   24.50 -To: $hto
   24.51 -Subject: $hsubject
   24.52 -
   24.53 -Hallo Fritz!
   24.54 -.
   24.55 -there is a dot above.
   24.56 -
   24.57 -command was: $cmd
   24.58 -
   24.59 -Fritz
   24.60 -
   24.61 -EOF
   24.62 -
   24.63 -#
   24.64 -# Testing with rcpt read from headers (-t option)
   24.65 -# (dot does end)
   24.66 -#
   24.67 -# the command to be run:
   24.68 -cmd="$mm_bin -C ./test.conf -t"
   24.69 -
   24.70 -$cmd <<EOF
   24.71 -From: $hfrom
   24.72 -To: $hto
   24.73 -Subject: $hsubject
   24.74 -
   24.75 -Hallo Fritz!
   24.76 -..
   24.77 -there is a dot above.
   24.78 -
   24.79 -command was: $cmd
   24.80 -
   24.81 -Fritz
   24.82 -.
   24.83 -
   24.84 -EOF