aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-09-18 21:27:09 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-09-18 21:27:09 +0300
commit78f10a75d96d08192f908f034e44e4932bfecc72 (patch)
treeef891e81921ff19c2064c69a35dd5cfefc313143
parent0916577f8f06454925095e97a5be447f8b17f2a3 (diff)
downloadmailfromd-78f10a75d96d08192f908f034e44e4932bfecc72.tar.gz
mailfromd-78f10a75d96d08192f908f034e44e4932bfecc72.tar.bz2
Improve testsuite.
* tests/testsuite.at (MF_CHECK_PROG): New macro. (MF_CHECK_TEXT, MF_RUN_TEXT): Unify calls to mailfromd. * tests/accept.at, tests/arg.at, tests/bctx00.at, tests/bctx01.at, tests/curmsg.at, tests/declvar.at, tests/farg.at, tests/fctx00.at, tests/fctx01.at, tests/macros.at, tests/ml.at, tests/numrcpt.at, tests/prec.at, tests/reject.at, tests/shadow.at, tests/strings.at, tests/tempfail.at: Rewrite giving the filter script in place. * tests/ack.at, tests/catch.at, tests/catch01.at, tests/cidr1.at, tests/cidr2.at, tests/cidr3.at, tests/cond01.at, tests/cond02.at, tests/cond03.at, tests/cond04.at, tests/cond05.at, tests/cond06.at, tests/invcidr.at, tests/invcidr2.at, tests/invip.at, tests/invip2.at, tests/relayed01.at, tests/relayed02.at, tests/switchn1.at, tests/switchn2.at, tests/switchn3.at, tests/switchn4.at, tests/switchs1.at, tests/switchs2.at, tests/switchs3.at, tests/switchs4.at: Replace AT_CHECK with the equivalent MF_CHECK_PROG * tests/hasmx.at, tests/hostname.at, tests/poll.at, tests/poll01.at, tests/poll02.at, tests/poll03.at, tests/rescname.at, tests/resolve.at: Unify calls to mailfromd * tests/hdr-cap.at, tests/hdr-mul.at, tests/ismx.at: Use EX_ codes instead of hardcoded ints. * tests/etc/accept.rc: Remove. * tests/etc/arg.rc: Remove. * tests/etc/farg.rc: Remove. * tests/etc/macros.rc: Remove. * tests/etc/ml.rc: Remove. * tests/etc/numrcpt.rc: Remove. * tests/etc/prec.rc: Remove. * tests/etc/reject.rc: Remove. * tests/etc/sa01.rc: Remove. * tests/etc/sa02.rc: Remove. * tests/etc/sa03.rc: Remove. * tests/etc/sa04.rc: Remove. * tests/etc/shadow.rc: Remove. * tests/etc/size.rc: Remove. * tests/etc/strings.rc: Remove. * tests/etc/tempfail.rc: Remove. * tests/etc/var.rc: Remove. * tests/etc/Makefile.am (RCFILES): Remove the above files.
-rw-r--r--tests/accept.at7
-rw-r--r--tests/ack.at4
-rw-r--r--tests/arg.at9
-rw-r--r--tests/bctx00.at17
-rw-r--r--tests/bctx01.at14
-rw-r--r--tests/catch.at6
-rw-r--r--tests/catch01.at6
-rw-r--r--tests/cidr1.at6
-rw-r--r--tests/cidr2.at6
-rw-r--r--tests/cidr3.at6
-rw-r--r--tests/cond01.at6
-rw-r--r--tests/cond02.at6
-rw-r--r--tests/cond03.at6
-rw-r--r--tests/cond04.at6
-rw-r--r--tests/cond05.at6
-rw-r--r--tests/cond06.at6
-rw-r--r--tests/curmsg.at8
-rw-r--r--tests/declvar.at14
-rw-r--r--tests/etc/Makefile.am19
-rw-r--r--tests/etc/accept.rc5
-rw-r--r--tests/etc/arg.rc23
-rw-r--r--tests/etc/farg.rc34
-rw-r--r--tests/etc/macros.rc32
-rw-r--r--tests/etc/ml.rc18
-rw-r--r--tests/etc/numrcpt.rc23
-rw-r--r--tests/etc/prec.rc31
-rw-r--r--tests/etc/reject.rc5
-rw-r--r--tests/etc/sa01.rc22
-rw-r--r--tests/etc/sa02.rc22
-rw-r--r--tests/etc/sa03.rc27
-rw-r--r--tests/etc/sa04.rc27
-rw-r--r--tests/etc/shadow.rc36
-rw-r--r--tests/etc/size.rc20
-rw-r--r--tests/etc/strings.rc35
-rw-r--r--tests/etc/tempfail.rc5
-rw-r--r--tests/etc/var.rc23
-rw-r--r--tests/farg.at26
-rw-r--r--tests/fctx00.at20
-rw-r--r--tests/fctx01.at19
-rw-r--r--tests/hasmx.at4
-rw-r--r--tests/hdr-cap.at2
-rw-r--r--tests/hdr-mul.at2
-rw-r--r--tests/hostname.at4
-rw-r--r--tests/invcidr.at4
-rw-r--r--tests/invcidr2.at4
-rw-r--r--tests/invip.at6
-rw-r--r--tests/invip2.at6
-rw-r--r--tests/ismx.at4
-rw-r--r--tests/macros.at25
-rw-r--r--tests/ml.at24
-rw-r--r--tests/numrcpt.at9
-rw-r--r--tests/poll.at4
-rw-r--r--tests/poll01.at4
-rw-r--r--tests/poll02.at4
-rw-r--r--tests/poll03.at4
-rw-r--r--tests/prec.at22
-rw-r--r--tests/reject.at7
-rw-r--r--tests/relayed01.at9
-rw-r--r--tests/relayed02.at9
-rw-r--r--tests/rescname.at4
-rw-r--r--tests/resolve.at4
-rw-r--r--tests/shadow.at39
-rw-r--r--tests/strings.at25
-rw-r--r--tests/switchn1.at6
-rw-r--r--tests/switchn2.at6
-rw-r--r--tests/switchn3.at6
-rw-r--r--tests/switchn4.at6
-rw-r--r--tests/switchs1.at6
-rw-r--r--tests/switchs2.at6
-rw-r--r--tests/switchs3.at6
-rw-r--r--tests/switchs4.at6
-rw-r--r--tests/tempfail.at8
-rw-r--r--tests/testsuite.at12
73 files changed, 348 insertions, 560 deletions
diff --git a/tests/accept.at b/tests/accept.at
index 2f10e6e7..902a8f3a 100644
--- a/tests/accept.at
+++ b/tests/accept.at
@@ -17,7 +17,12 @@
AT_SETUP([Accept action])
AT_KEYWORDS([actions accept])
-AT_MTA_TEST_FILTER([accept.rc],
+AT_MTA_TEST_FILTER_SCRIPT([
+prog envfrom
+do
+ accept
+done
+],
[
\E250
HELO localhost
diff --git a/tests/ack.at b/tests/ack.at
index 8169cca7..d026de20 100644
--- a/tests/ack.at
+++ b/tests/ack.at
@@ -17,8 +17,8 @@
AT_SETUP([Ackerman function])
AT_KEYWORDS([ack])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/ack.rc],
- [0],
+MF_CHECK_PROG([$ETCDIR/ack.rc], [],
+[EX_OK],
[State envfrom: continue
],
[ack(3,8)=2045
diff --git a/tests/arg.at b/tests/arg.at
index dfc246f7..dd09ffe8 100644
--- a/tests/arg.at
+++ b/tests/arg.at
@@ -17,7 +17,14 @@
AT_SETUP([Function arguments])
AT_KEYWORDS([arg])
-AT_MTA_TEST_FILTER([arg.rc],
+AT_MTA_TEST_FILTER_SCRIPT([
+prog envfrom
+do
+ if $1 = "gray@localhost"
+ reject 550 5.7.1 "We do not accept mail from that address"
+ fi
+done
+],
[
\E250
HELO localhost
diff --git a/tests/bctx00.at b/tests/bctx00.at
index db106e1e..398a25c7 100644
--- a/tests/bctx00.at
+++ b/tests/bctx00.at
@@ -17,12 +17,19 @@
AT_SETUP([Builtin in wrong context])
AT_KEYWORDS([context builtin-context bctx bctx00])
-echo "mailfromd: $ETCDIR/sa01.rc:19: built-in function \`sa' cannot be used in prog \`envfrom'" > experr
-
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/sa01.rc],
- [78],
+MF_CHECK_TEXT([
+prog envfrom
+do
+ if sa("tcp://localhost", 10)
+ discard
+ fi
+done
+],
+[],
+[EX_CONFIG],
[],
-[experr])
+[mailfromd: prog:4: built-in function `sa' cannot be used in prog `envfrom'
+])
AT_CLEANUP
diff --git a/tests/bctx01.at b/tests/bctx01.at
index 51b45fc8..8a70bce4 100644
--- a/tests/bctx01.at
+++ b/tests/bctx01.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,16 @@
AT_SETUP([Builtin in correct context])
AT_KEYWORDS([context builtin-context bctx bctx01])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/sa02.rc],
- [0],
+MF_CHECK_TEXT([
+prog eom
+do
+ if sa("tcp://localhost", 10)
+ discard
+ fi
+done
+],
+[],
+[EX_OK],
[State envfrom: continue
])
diff --git a/tests/catch.at b/tests/catch.at
index 67c52520..980fac39 100644
--- a/tests/catch.at
+++ b/tests/catch.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([Setting exceptions])
AT_KEYWORDS([exceptions catch setex])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/catch.rc s=127.0.0.1],
- [0],
+MF_CHECK_PROG([$ETCDIR/catch.rc], [s=127.0.0.1],
+[EX_OK],
[State envfrom: accept
])
diff --git a/tests/catch01.at b/tests/catch01.at
index 2102eeb7..cec5c13b 100644
--- a/tests/catch01.at
+++ b/tests/catch01.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([Setting exceptions (2)])
AT_KEYWORDS([exceptions catch setex2])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/catch01.rc s=127.0.0.1],
- [0],
+MF_CHECK_PROG([$ETCDIR/catch01.rc], [s=127.0.0.1],
+[EX_OK],
[State envfrom: accept
])
diff --git a/tests/cidr1.at b/tests/cidr1.at
index 3428976e..275857e5 100644
--- a/tests/cidr1.at
+++ b/tests/cidr1.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([cidr: 10.10.0.1 matches 10.10.0.0/19])
AT_KEYWORDS([cidr cidr1])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cidr.rc client_addr=10.10.0.1],
- [0],
+MF_CHECK_PROG([$ETCDIR/cidr.rc], [client_addr=10.10.0.1],
+[EX_OK],
[SET REPLY 550 Not from this address!
State envfrom: reject
])
diff --git a/tests/cidr2.at b/tests/cidr2.at
index 8c7f8888..fc9fa130 100644
--- a/tests/cidr2.at
+++ b/tests/cidr2.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([cidr: 10.10.31.255 matches 10.10.0.0/19])
AT_KEYWORDS([cidr cidr2])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cidr.rc client_addr=10.10.31.255],
- [0],
+MF_CHECK_PROG([$ETCDIR/cidr.rc], [client_addr=10.10.31.255],
+[EX_OK],
[SET REPLY 550 Not from this address!
State envfrom: reject
])
diff --git a/tests/cidr3.at b/tests/cidr3.at
index 8e3cb94c..dac14373 100644
--- a/tests/cidr3.at
+++ b/tests/cidr3.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([cidr: 10.10.32.1 does not match 10.10.0.0/19])
AT_KEYWORDS([cidr cidr3])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cidr.rc client_addr=10.10.32.1],
- [0],
+MF_CHECK_PROG([$ETCDIR/cidr.rc], [client_addr=10.10.32.1],
+[EX_OK],
[State envfrom: continue
])
diff --git a/tests/cond01.at b/tests/cond01.at
index eea35e71..afb79f31 100644
--- a/tests/cond01.at
+++ b/tests/cond01.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([String equality])
AT_KEYWORDS([cond cond01])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cond.rc --test=envrcpt rcpt_addr=devnull],
- [0],
+MF_CHECK_PROG([$ETCDIR/cond.rc], [--test=envrcpt rcpt_addr=devnull],
+[EX_OK],
[SET REPLY 550 Case 1: No mails to devnull
State envrcpt: reject
])
diff --git a/tests/cond02.at b/tests/cond02.at
index 44b658ff..cf496d76 100644
--- a/tests/cond02.at
+++ b/tests/cond02.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([Fnmatch])
AT_KEYWORDS([cond cond02 fnmatch fnmatch1])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cond.rc --test=envrcpt rcpt_addr=gray],
- [0],
+MF_CHECK_PROG([$ETCDIR/cond.rc], [--test=envrcpt rcpt_addr=gray],
+[EX_OK],
[SET REPLY 550 Case 2: Mail to this user is not accepted
State envrcpt: reject
])
diff --git a/tests/cond03.at b/tests/cond03.at
index 25004a64..da47816d 100644
--- a/tests/cond03.at
+++ b/tests/cond03.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([Fnmatch (2)])
AT_KEYWORDS([cond cond02 fnmatch fnmatch2])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cond.rc --test=envrcpt rcpt_addr=gray22],
- [0],
+MF_CHECK_PROG([$ETCDIR/cond.rc], [--test=envrcpt rcpt_addr=gray22],
+[EX_OK],
[SET REPLY 550 Case 2: Mail to this user is not accepted
State envrcpt: reject
])
diff --git a/tests/cond04.at b/tests/cond04.at
index aabf7260..81ad96ed 100644
--- a/tests/cond04.at
+++ b/tests/cond04.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([Regex match])
AT_KEYWORDS([cond cond04 regex regex1])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cond.rc --test=envrcpt rcpt_addr=foobar f=f],
- [0],
+MF_CHECK_PROG([$ETCDIR/cond.rc], [--test=envrcpt rcpt_addr=foobar f=f],
+[EX_OK],
[SET REPLY 550 Case 3: Not a fully qualified name
State envrcpt: reject
])
diff --git a/tests/cond05.at b/tests/cond05.at
index dedd353c..4707244d 100644
--- a/tests/cond05.at
+++ b/tests/cond05.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([Regex match (5)])
AT_KEYWORDS([cond cond05 regex regex2])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cond.rc --test=envrcpt rcpt_addr=foo.bar f=f],
- [0],
+MF_CHECK_PROG([$ETCDIR/cond.rc], [--test=envrcpt rcpt_addr=foo.bar f=f],
+[EX_OK],
[State envrcpt: continue
])
diff --git a/tests/cond06.at b/tests/cond06.at
index 71bef937..baeafadd 100644
--- a/tests/cond06.at
+++ b/tests/cond06.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,8 @@
AT_SETUP([Nested if])
AT_KEYWORDS([cond cond06 nested])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/cond.rc --test=envrcpt rcpt_addr=foobar f=gray],
- [0],
+MF_CHECK_PROG([$ETCDIR/cond.rc], [--test=envrcpt rcpt_addr=foobar f=gray],
+[EX_OK],
[State envrcpt: accept
])
diff --git a/tests/curmsg.at b/tests/curmsg.at
index f7ee81d9..b5d8fba3 100644
--- a/tests/curmsg.at
+++ b/tests/curmsg.at
@@ -26,7 +26,13 @@ AT_SETUP([Working current_message])
AT_KEYWORDS([curmsg])
AT_WITH_MAILFROMD_OPTIONS([--stderr],[
-AT_MTA_TEST_FILTER([size.rc],[
+AT_MTA_TEST_FILTER_SCRIPT([
+prog eom
+do
+ echo "SIZE " message_body_size(current_message())
+done
+],
+[
\E250
HELO localhost
\E250
diff --git a/tests/declvar.at b/tests/declvar.at
index b0cc4118..fc6ad084 100644
--- a/tests/declvar.at
+++ b/tests/declvar.at
@@ -1,5 +1,5 @@
# This file is part of Mailfromd testsuite. -*- Autotest -*-
-# Copyright (C) 2007, 2008 Sergey Poznyakoff
+# Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,8 +17,16 @@
AT_SETUP([Declared variables])
AT_KEYWORDS([declvar variable variables])
-AT_CHECK([mailfromd $MFOPTS --test $ETCDIR/var.rc],
- [0],
+MF_CHECK_TEXT([
+set str "String"
+
+prog envfrom
+do
+ echo %str
+done
+],
+[],
+[EX_OK],
[State envfrom: continue
],
[String
diff --git a/tests/etc/Makefile.am b/tests/etc/Makefile.am
index 9125c901..a6e3f04f 100644
--- a/tests/etc/Makefile.am
+++ b/tests/etc/Makefile.am
@@ -15,35 +15,18 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
RCFILES=\
- accept.rc\
ack.rc\
- arg.rc\
catch.rc\
catch01.rc\
cidr.rc\
cond.rc\
dns.rc\
- farg.rc\
greylist.rc\
greylist-ct.rc\
- numrcpt.rc\
- macros.rc\
- ml.rc\
poll.rc\
poll-1.rc\
- prec.rc\
- reject.rc\
relayed.rc\
- sa01.rc\
- sa02.rc\
- sa03.rc\
- sa04.rc\
- shadow.rc\
- size.rc\
- strings.rc\
- switch.rc\
- tempfail.rc\
- var.rc
+ switch.rc
noinst_DATA = $(RCFILES)
EXTRA_DIST=relayed.list hdr.mts hdr2.mts $(RCFILES)
diff --git a/tests/etc/accept.rc b/tests/etc/accept.rc
deleted file mode 100644
index 58f0ae74..00000000
--- a/