summaryrefslogtreecommitdiff
path: root/sieve/tests/testsuite.at
blob: 9e3a86ed5947bdbee6ac4cfbd8782c4bb8b1bd3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007-2012, 2014-2016 Free Software Foundation, Inc.
#
# GNU Mailutils is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3, or (at
# your option) any later version.
#
# GNU Mailutils is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GNU Mailutils.  If not, see <http://www.gnu.org/licenses/>.

m4_include([testsuite.inc])

dnl ------------------------------------------------------------
dnl testcompile(SCRIPT) -- test compilation of the Sieve SCRIPT
dnl
m4_define([testcompile],[
AT_SETUP([compile $1])
AT_CHECK([sieve MUT_SIEVE_DEFAULT_OPTIONS -c $abs_top_srcdir/sieve/examples/$1],
[0])
AT_CLEANUP
])

dnl ------------------------------------------------------------
m4_define([MUT_SIEVE_DEFAULT_OPTIONS],MUT_DEFAULT_OPTIONS)

dnl ------------------------------------------------------------
dnl MUT_SIEVE_OPTIONS  -- additional command line options for Sieve
m4_define([MUT_SIEVE_OPTIONS])

dnl ------------------------------------------------------------
dnl MUT_SIEVE_MAILBOX  -- mailbox used for testing
m4_define([MUT_SIEVE_MAILBOX],[sieve.mbox])

dnl ------------------------------------------------------------
m4_define([MUT_SIEVE_CMDLINE],[dnl
 --verbose dnl
 MUT_SIEVE_DEFAULT_OPTIONS dnl
 --line-info=no dnl
 --no-program-name dnl
 -M sendmail:$abs_top_builddir/examples/mta dnl
 --email foobar@nonexistent.net])
 
dnl ------------------------------------------------------------
dnl MUT_SIEVE_COMPILE(SCRIPT, [ADD-TEST = `'],
dnl                   [STATUS = `0'], [STDOUT = `'], [STDERR = `'],
dnl                   [RUN-IF-FAIL], [RUN-IF-PASS])
dnl	  
m4_define([MUT_SIEVE_COMPILE],[
AT_DATA([prog],[$1
])
AT_CHECK([sieve MUT_SIEVE_DEFAULT_OPTIONS MUT_SIEVE_OPTIONS -c prog],m4_shift($@))])

dnl ------------------------------------------------------------
dnl MUT_SIEVE_RUN(SCRIPT, MBOX, [ADD-TEST = `'],
dnl               [STATUS = `0'], [STDOUT = `'], [STDERR = `'],
dnl               [RUN-IF-FAIL], [RUN-IF-PASS])
dnl	  
m4_define([MUT_SIEVE_RUN],[
AT_DATA([prog],[$1
])
AT_CHECK([sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f $2 prog
		$3],
		m4_shift(m4_shift(m4_shift($@))))])

m4_define([MUT_TESTCASE],[
AT_SETUP([$1])
AT_KEYWORDS([$2])
MUT_MBCOPY($abs_top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX)

MUT_SIEVE_RUN([$3], ./MUT_SIEVE_MAILBOX, m4_shift(m4_shift(m4_shift($@))))
AT_CLEANUP])

m4_define([MUT_PREREQ_CAPA],[
sieve --show-config-options | grep '^$1' > /dev/null 2>&1 || AT_SKIP_TEST
])

dnl ------------------------------------------------------------
m4_define([MUT_SIEVE_EXT_NAME])

dnl ------------------------------------------------------------
dnl MUT_SIEVE_EXT_TEST([NAME],[KW = `'], [PROG], [TEST],
dnl                    [STDOUT = `'],[STDERR = `'])
m4_define([MUT_SIEVE_EXT_TEST],[
AT_SETUP(MUT_SIEVE_EXT_NAME[: $1])
AT_KEYWORDS([MUT_SIEVE_EXT_NAME $2])
m4_pushdef([MUT_SIEVE_OPTIONS],
           [--libdir-prefix "${abs_top_builddir}/libmu_sieve/extensions"])
AT_CHECK([
MUT_PREREQ_CAPA([HAVE_LIBLTDL])
cwd=`pwd`
cat >>prog<<EOT
$3
EOT
$4
],
[0],
[$5],[$6])
m4_popdef([MUT_SIEVE_OPTIONS])
AT_CLEANUP])


AT_INIT

AT_TESTED([sieve])

m4_include([version.at])

AT_BANNER(Compilation)
m4_include([compile.at])
m4_include([enc-char.at])

AT_BANNER(Actions)
m4_include([false.at])
m4_include([true.at])
m4_include([not.at])
m4_include([action.at])
m4_include([redirect.at])
m4_include([reject.at])

AT_BANNER(Tests)
m4_include([address.at])
m4_include([allof.at])
m4_include([anyof.at])
m4_include([envelope.at])
m4_include([exists.at])
m4_include([header.at])
m4_include([relational.at])
m4_include([size.at])
m4_include([mul-addr.at])

AT_BANNER(Comparators)
m4_include([i-casemap.at])
m4_include([i-numeric.at])
m4_include([i-octet.at])

AT_BANNER(Extensions)
m4_include([ext.at])
m4_include([moderator.at])
m4_include([pipeact.at])
m4_include([pipetest.at])
m4_include([list.at])
m4_include([addheader.at])
m4_include([delheader.at])
m4_include([vacation.at])

m4_include([variables.at])
m4_include([environment.at])

Return to:

Send suggestions and report system problems to the System administrator.