maidag/tests/forward.at: forgotten to add (see db1ee5e0).
Showing
1 changed file
with
78 additions
and
0 deletions
maidag/tests/forward.at
0 → 100644
1 | # This file is part of GNU Mailutils. -*- Autotest -*- | ||
2 | # Copyright (C) 2010 Free Software Foundation, Inc. | ||
3 | # | ||
4 | # GNU Mailutils is free software; you can redistribute it and/or | ||
5 | # modify it under the terms of the GNU General Public License as | ||
6 | # published by the Free Software Foundation; either version 3, or (at | ||
7 | # your option) any later version. | ||
8 | # | ||
9 | # GNU Mailutils is distributed in the hope that it will be useful, but | ||
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | # General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | AT_SETUP([forwarding support]) | ||
18 | AT_KEYWORDS([maidag forward]) | ||
19 | |||
20 | m4_pushdef([FORWARD_OPTIONS],[dnl | ||
21 | --set "^mailer^url=sendmail:$abs_top_builddir/examples/mta" dnl | ||
22 | --set "^forward-file=$forward" dnl | ||
23 | --set "^forward-file-checks=none"]) | ||
24 | |||
25 | AT_CHECK([ | ||
26 | forward=`pwd`/my.forward | ||
27 | namelist=`sed 's/:.*//;3,$d' /etc/passwd 2>/dev/null` | ||
28 | test -n "$namelist" || AT_SKIP_TEST | ||
29 | |||
30 | cat > my.forward <<EOT | ||
31 | foo@bar.baz | ||
32 | \\$namelist | ||
33 | EOT | ||
34 | |||
35 | set -- $namelist | ||
36 | |||
37 | cat > experr <<EOT | ||
38 | maidag: notice: skipping forward file $forward: already processed | ||
39 | EOT | ||
40 | |||
41 | echo ENVELOPE > expout.0 | ||
42 | cat $abs_top_srcdir/maidag/tests/input.msg >> expout.0 | ||
43 | echo "" >> expout.0 | ||
44 | |||
45 | echo "ENVELOPE FROM: gulliver@example.net" > expout.1 | ||
46 | echo "ENVELOPE TO: <foo@bar.baz>" >> expout.1 | ||
47 | awk '{printf("% 4d: %s\n", NR-1,$0)}' $abs_top_srcdir/maidag/tests/input.msg >> expout.1 | ||
48 | echo "END OF MESSAGE" >> expout.1 | ||
49 | |||
50 | MTA_DIAG=mta.diag | ||
51 | export MTA_DIAG | ||
52 | mkdir spool | ||
53 | maidag MAIDAG_OPTIONS FORWARD_OPTIONS --from gulliver@example.net $1 < \ | ||
54 | $abs_top_srcdir/maidag/tests/input.msg || exit $? | ||
55 | |||
56 | for name in $namelist | ||
57 | do | ||
58 | if test -f spool/$name; then | ||
59 | sed '1s/From gulliver@example.net.*/ENVELOPE/' spool/$name | \ | ||
60 | cmp expout.0 - >/dev/null || echo "$name mailbox mismatch" >&2 | ||
61 | else | ||
62 | echo "$name missed message" >&2 | ||
63 | fi | ||
64 | done | ||
65 | |||
66 | if test -f mta.diag; then | ||
67 | cmp mta.diag expout.1 >/dev/null || echo "remote copy mismatch" >&2 | ||
68 | else | ||
69 | echo "remote delivery failed" >&2 | ||
70 | fi | ||
71 | ], | ||
72 | [0], | ||
73 | [], | ||
74 | [experr]) | ||
75 | |||
76 | m4_popdef([FORWARD_OPTIONS]) | ||
77 | |||
78 | AT_CLEANUP |
-
Please register or sign in to post a comment