Commit 68b7dc9d 68b7dc9dacacaf0111de9d636c36ec05e1061172 by Sergey Poznyakoff

Rewrite Sieve testssuite in Autotest.

* mailbox/cfg_parser.y (mu_cfg_create_subtree): Optional prefix
character may be used to alter the separator or to suppress
value splitting.
1 parent 8c76d675
Showing 102 changed files with 1490 additions and 1738 deletions
......@@ -1209,6 +1209,10 @@ AC_ARG_WITH([mh-bindir],
[MH_BIN_DIR='${exec_prefix}/bin/mu-mh'])
# Initialize the (autotest) test suite.
AC_CONFIG_TESTDIR(tests)
AC_CONFIG_FILES([sieve/tests/Makefile sieve/tests/atlocal])
AM_MISSING_PROG([AUTOM4TE], [autom4te])
dnl Make sysconfdir available to the application
dnl This must be done LAST, since CPPFLAGS is passed by configure
......@@ -1371,7 +1375,6 @@ AC_CONFIG_FILES([
mu-aux/Makefile
mu-aux/mailutils.spec
sieve/Makefile
sieve/testsuite/Makefile
testsuite/Makefile
])
AC_OUTPUT
......
......@@ -36,6 +36,7 @@
#include <mailutils/iterator.h>
#include <mailutils/debug.h>
#include <mailutils/mutil.h>
#include <mailutils/cctype.h>
int mu_cfg_parser_verbose;
static mu_list_t /* of mu_cfg_node_t */ parse_node_list;
......@@ -1741,25 +1742,53 @@ mu_cfg_create_subtree (const char *path, mu_cfg_node_t **pnode)
{
int rc;
int argc, i;
char *p;
char **argv;
mu_cfg_locus_t locus;
enum mu_cfg_node_type type;
mu_cfg_node_t *node = NULL;
char *delim = MU_CFG_PATH_DELIM_STR;
char static_delim[2] = { 0, 0 };
locus.file = "<int>";
locus.line = 0;
rc = mu_argcv_get_np (path, strlen (path), MU_CFG_PATH_DELIM_STR, NULL, 0,
if (path[0] == '\\')
{
argv = calloc (2, sizeof (*argv));
if (!argv)
return ENOMEM;
argv[0] = strdup (path + 1);
if (!argv[0])
{
free (argv);
return ENOMEM;
}
argv[1] = NULL;
argc = 1;
rc = 0;
}
else
{
if (mu_ispunct (path[0]))
{
delim = static_delim;
delim[0] = path[0];
path++;
}
rc = mu_argcv_get_np (path, strlen (path), delim, NULL, 0,
&argc, &argv, NULL);
}
if (rc)
return rc;
for (i = argc - 1; i >= 0; i--)
{
mu_list_t nodelist = NULL;
char *p = strrchr (argv[i], '=');
mu_config_value_t *label = NULL;
p = strrchr (argv[i], '=');
type = mu_cfg_node_statement;
if (p)
{
......
......@@ -18,7 +18,7 @@
## 02110-1301 USA
INCLUDES = @MU_APP_COMMON_INCLUDES@
SUBDIRS = testsuite
SUBDIRS = tests
bin_PROGRAMS = sieve
sieve_SOURCES = sieve.c
......
atconfig
atlocal
package.m4
status.mf
testsuite
testsuite.dir
testsuite.log
# This file is part of GNU Mailutils.
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4
DISTCLEANFILES = atconfig $(check_SCRIPTS)
MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
#SUBDIRS = etc
## ------------ ##
## package.m4. ##
## ------------ ##
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
} >$(srcdir)/package.m4
#
## ------------ ##
## Test suite. ##
## ------------ ##
TESTSUITE_AT = \
action.at\
address.at\
allof.at\
anyof.at\
compile.at\
envelope.at\
exists.at\
ext.at\
false.at\
header.at\
i-casemap.at\
i-numeric.at\
i-octet.at\
mul-addr.at\
not.at\
redirect.at\
reject.at\
relational.at\
size.at\
true.at\
testsuite.at\
version.at
TESTSUITE = $(srcdir)/testsuite
M4=m4
AUTOTEST = $(AUTOM4TE) --language=autotest
$(TESTSUITE): package.m4 $(TESTSUITE_AT)
$(AM_V_GEN)$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
$(AM_V_at)mv $@.tmp $@
atconfig: $(top_builddir)/config.status
cd $(top_builddir) && ./config.status tests/$@
clean-local:
@test ! -f $(TESTSUITE) || $(SHELL) $(TESTSUITE) --clean
check-local: atconfig atlocal $(TESTSUITE)
@$(SHELL) $(TESTSUITE)
# Run the test suite on the *installed* tree.
#installcheck-local:
# $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([action stop], [], [stop;],[],[0],[],
[STOP on msg uid 1
STOP on msg uid 2
STOP on msg uid 3
])
MUT_TESTCASE([action null],[],[],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([action keep],[],[keep;],[],[0],[],
[KEEP on msg uid 1
KEEP on msg uid 2
KEEP on msg uid 3
])
MUT_TESTCASE([action discard],[],[discard;],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
DISCARD on msg uid 3: marking as deleted
])
m4_pushdef([MUT_SIEVE_OPTIONS],[--set ":mailbox:folder=`pwd`"])
MUT_TESTCASE([action fileinto],[],
[require "fileinto";
fileinto "+file";
],
[cat file
],
[0],
[From coyote@desert.example.org Sun May 6 22:16:47 2001
From: coyote@desert.example.org
To: roadrunner@acme.example.com
Subject: I have a present for you
X-Caffeine: C8H10N4O2
Look, I'm sorry about the whole anvil thing, and I really
didn't mean to try and drop it on you from the top of the
cliff. I want to try to make it up to you. I've got some
great birdseed over here at my place--top of the line
stuff--and if you come by, I'll have it all wrapped up
for you. I'm really sorry for all the problems I've caused
for you over the years, but I know we can work this out.
--
Wile E. Coyote "Super Genius" coyote@desert.example.org
From b1ff@de.res.example.com Sun May 6 22:17:15 2001
From: youcouldberich!@reply-by-postal-mail.invalid
To: rube@landru.example.edu
Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$
Date: TBD
X-Number: 0015
YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT
IT! SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS! IT WILL
GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!
MONEY! MONEY! COLD HARD CASH! YOU WILL RECEIVE OVER
$20,000 IN LESS THAN TWO MONTHS! AND IT'S LEGAL!!!!!!!!!
!!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1 JUST
SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!
From bar@dontmailme.org Fri Dec 28 23:28:09 2001
Received: (from bar@dontmailme.org)
by dontmailme.org id fERKR9N16790
for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
Date: Fri, 28 Dec 2001 23:28:08 +0200
From: Bar <bar@dontmailme.org>
To: Foo Bar <foobar@nonexistent.net>
Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
Subject: Coffee
How about some coffee?
],
[FILEINTO on msg uid 1: delivering into +file
FILEINTO on msg uid 2: delivering into +file
FILEINTO on msg uid 3: delivering into +file
])
m4_popdef([MUT_SIEVE_OPTIONS])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([address :all],[test address all address-all],
[
if address :is :all "From" "coyote@desert.example.org" {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([address :domain],[test address domain address-domain],
[
if address :is :domain "From" "desert.example.org" {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([address :localpart],[test address localpart address-localpart],
[
if address :is :localpart "From" "youcouldberich!" {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([address :matches],[test address matches address-matches],
[
if address :matches :all "From" "*invalid" {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([allof 00],[test allof allof00],
[
if allof(false,false) {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([allof 01],[test allof allof01],
[
if allof(false,true) {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([allof 11],[test allof allof11],
[
if allof(true,true) {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
DISCARD on msg uid 3: marking as deleted
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([anyof 00],[test anyof anyof00],
[
if anyof(false,false) {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([anyof 01],[test anyof anyof01],
[
if anyof(false,true) {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
DISCARD on msg uid 3: marking as deleted
])
MUT_TESTCASE([anyof 11],[test anyof anyof11],
[
if anyof(true,true) {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
DISCARD on msg uid 3: marking as deleted
])
# @configure_input@ -*- shell-script -*-
# Configurable variable values for Mailutils test suite.
# Copyright (C) 2004, 2010 Free Software Foundation, Inc.
PATH=@abs_builddir@:@abs_top_builddir@/sieve:$top_srcdir:$srcdir:$PATH
top_srcdir=@abs_top_srcdir@
top_builddir=@abs_top_builddir@
initspool() {
test -d data || mkdir data
test -d data/spool || mkdir data/spool
cp $top_srcdir/testsuite/spool/* data/spool
}
\ No newline at end of file
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
testcompile([ex-null.sv])
testcompile([box.sv])
testcompile([ex-1.10.2.sv])
testcompile([ex-2.3a.sv])
testcompile([ex-2.5.1.sv])
testcompile([ex-2.7.3.sv])
testcompile([ex-3.1a.sv])
testcompile([ex-3.1b.sv])
testcompile([ex-4.2.sv])
testcompile([ex-4.4a.sv])
testcompile([ex-4.4b.sv])
testcompile([ex-4.5.sv])
testcompile([ex-5.1.sv])
testcompile([ex-5.7.sv])
testcompile([ex-save-all.sv])
testcompile([example.sv])
testcompile([exn-2.3b.sv])
dnl t-complex.sv
dnl t-exists.sv
dnl t-fileinto.sv
dnl t-mailutils.sv
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([envelope],[test envelope],
[
if envelope "from" "coyote@desert.example.org" {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([exists: single header],[test exists exists01],
[
if exists "X-Caffeine" {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([exists: array],[test exists exists02],
[
if exists [["X-Caffeine", "From"]] {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([exists: array 2],[test exists exists03],
[
if exists [["X-Caffeine", "X-Status"]] {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
AT_SETUP([loadable extensions: numaddr])
AT_KEYWORDS([ext])
AT_CHECK([
MUT_PREREQ_CAPA([HAVE_LIBLTDL])
AT_DATA([prog],[
require "test-numaddr";
if numaddr [[ "to", "cc" ]] :over 5
{
discard;
}
])
cp $top_srcdir/testsuite/spool/bigto.mbox .
sieve MUT_SIEVE_CMDLINE dnl
--clearpath -L "${top_builddir}/examples" -f ./bigto.mbox prog
],
[0],
[],
[DISCARD on msg uid 1: marking as deleted
])
AT_CLEANUP
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([false],[test constant false],
[
if false {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([header :is],[test header header-is],
[
if header :is "X-Caffeine" "C8H10N4O2" {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([header arrays],[test header header-arrays],
[
if header [["X-Caffeine","Subject"] ["C8H10N4O2","Coffee"]] {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
DISCARD on msg uid 3: marking as deleted
])
MUT_TESTCASE([header :matches],[test header matches header-matches],
[
if header :matches "Subject" "*$$$*" {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
m4_pushdef([MUT_SIEVE_MAILBOX],[mbox1])
MUT_TESTCASE([header :mime],[test header header-mime],
[
if header :mime :is "Content-Description" "How doth" {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
DISCARD on msg uid 3: marking as deleted
IMPLICIT KEEP on msg uid 4
IMPLICIT KEEP on msg uid 5
])
m4_popdef([MUT_SIEVE_MAILBOX])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([i-casemap :is],[comparator i-casemap i-casemap-is],
[
require "comparator-i;ascii-casemap";
if header :comparator "i;ascii-casemap" :is "to" "roadrunner@ACME.EXAMPLE.COM"
{
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([i-casemap :matches],[comparator i-casemap i-casemap-matches],
[
require "comparator-i;ascii-casemap";
if header :comparator "i;ascii-casemap" :matches "subject" "*you, too,*"
{
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([i-casemap :contains],[comparator i-casemap i-casemap-contains],
[
require "comparator-i;ascii-casemap";
if header :comparator "i;ascii-casemap" :contains [["from", "to"]] "ExAmPLe"
{
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([i-casemap :regex],[comparator i-casemap i-casemap-regex],
[
require "comparator-i;ascii-casemap";
if header :comparator "i;ascii-casemap" :regex "subject" ".*you.*"
{
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([i-numeric :is], [comparator i-numeric is i-numeric-is],
[
require "comparator-i;ascii-numeric";
if header :comparator "i;ascii-numeric" :is "X-Number" "15"
{
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
AT_SETUP([i-numeric with contains])
AT_KEYWORDS([comparator i-numeric is i-numeric-contains])
MUT_SIEVE_COMPILE([
require "comparator-i;ascii-numeric";
if header :comparator "i;ascii-numeric" :contains "X-Number" "15"
{
discard;
}
],[78],[],
[sieve: prog:5: comparator `i;ascii-numeric' is incompatible with match type `contains' in call to `header'
])
AT_CLEANUP
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([i-octet :is],[comparator i-octet is i-octet-is],
[
require "comparator-i;octet";
if header :comparator "i;octet" :is "to" "roadrunner@acme.example.com"
{
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([i-octet :matches],[comparator i-octet matches i-octet-matches],
[
require "comparator-i;octet";
if header :comparator "i;octet" :matches "subject" "$$$*$$$"
{
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([i-octet :contains],[comparator i-octet contains i-octet-contains],
[
require "comparator-i;octet";
if header :comparator "i;octet" :contains [["from", "to"]] "example"
{
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
MUT_TESTCASE([i-octet :regex],[comparator i-octet regex i-octet-regex],
[
require "comparator-i;octet";
if header :comparator "i;octet" :regex "subject" ".*you.*"
{
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
m4_pushdef([MUT_SIEVE_MAILBOX],[relational.mbox])
MUT_TESTCASE([multiple addresses],[test address mul-addr],
[
require "fileinto";
if address :localpart :is [["To", "Cc"]] [[ "foo", "oof" ]]
{
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
DISCARD on msg uid 3: marking as deleted
DISCARD on msg uid 4: marking as deleted
DISCARD on msg uid 5: marking as deleted
DISCARD on msg uid 6: marking as deleted
DISCARD on msg uid 7: marking as deleted
IMPLICIT KEEP on msg uid 8
DISCARD on msg uid 9: marking as deleted
])
m4_popdef([MUT_SIEVE_MAILBOX])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([not], [test not boolean],
[
if not false {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
DISCARD on msg uid 3: marking as deleted
])
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# 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.
#
# This program 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.
# This program 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 this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# along with GNU Mailutils. If not, see <http://www.gnu.org/licenses/>.
# This file is part of Mailfromd testsuite.
TEST redirect.sv
PATTERN BEGIN
REDIRECT on msg uid 1: to gray@gnu.org
REDIRECT on msg uid 2: to gray@gnu.org
REDIRECT on msg uid 3: to gray@gnu.org
PATTERN END
AT_SETUP([redirect])
AT_KEYWORDS([action])
AT_CHECK([
MUT_PREREQ_CAPA([ENABLE_SENDMAIL])
MTA_DIAG=`pwd`/mta.diag
MTA_APPEND=1
export MTA_DIAG MTA_APPEND
FILE BEGIN
ENVELOPE FROM: coyote@desert.example.org
AT_DATA([prog],[
require "redirect";
redirect "gray@gnu.org";
])
cp $top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX .
sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1
sed 's/ $//' ./mta.diag
],
[0],
[ENVELOPE FROM: coyote@desert.example.org
ENVELOPE TO: <gray@gnu.org>
0: X-Loop-Prevention: foobar@nonexistent.net
1: From: coyote@desert.example.org
......@@ -77,7 +88,10 @@ ENVELOPE TO: <gray@gnu.org>
10: How about some coffee?
11:
END OF MESSAGE
FILE END
TEST END
],
[REDIRECT on msg uid 1: to gray@gnu.org
REDIRECT on msg uid 2: to gray@gnu.org
REDIRECT on msg uid 3: to gray@gnu.org
])
# End of Redirect
AT_CLEANUP
......
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
AT_SETUP([reject])
AT_KEYWORDS([action])
AT_CHECK([
MUT_PREREQ_CAPA([ENABLE_SENDMAIL])
MTA_DIAG=`pwd`/mta.diag
MTA_APPEND=1
export MTA_DIAG MTA_APPEND
AT_DATA([prog],[
require "reject";
reject text:
I don't want to read these messages.
Regards.
.
;
])
AT_DATA([filter.sed],[
# mta log contains trailing spaces
s/ $//
# MIME boundaries are unpredictable, so we replace them with a constant string.
s/^\( *[[0-9]][[0-9]]*: Content-Type: .*boundary=\).*/\1(boundary)/
s/^\( *[[0-9]][[0-9]]*:\) --[[0-9]].*/\1 --(boundary)/
# Same goes for dates.
s/^\( *[[0-9]][[0-9]]*: The original message was received at *\).*\( from .*\)/\1(date)\2/
s/^\( *[[0-9]][[0-9]]*: Last-Attempt-Date:\).*/\1 (date)/
])
cp $top_srcdir/testsuite/spool/MUT_SIEVE_MAILBOX .
sieve MUT_SIEVE_CMDLINE MUT_SIEVE_OPTIONS -f ./MUT_SIEVE_MAILBOX prog || exit 1
sed -f filter.sed ./mta.diag
],
[0],
[ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
ENVELOPE TO: <coyote@desert.example.org>
0: To: coyote@desert.example.org
1: Content-Type: multipart/mixed; boundary=(boundary)
2: MIME-Version: 1.0
3:
4: --(boundary)
5: Content-Type: text/plain;charset=UTF-8
6: Content-Transfer-Encoding: 8bit
7:
8: The original message was received at (date) from coyote@desert.example.org.
9: Message was refused by recipient's mail filtering program.
10: Reason given was as follows:
11:
12: I don't want to read these messages.
13:
14: Regards.
15:
16: --(boundary)
17: Content-Type: message/delivery-status
18:
19: Reporting-UA: sieve; GNU Mailutils 2.2.90
20: Arrival-Date: Mon, May 07 01:16:47 2001 EEST
21: Final-Recipient: RFC822; foobar@nonexistent.net
22: Action: deleted
23: Disposition: automatic-action/MDN-sent-automatically;deleted
24: Last-Attempt-Date: (date)
25:
26: --(boundary)
27: Content-Type: message/rfc822
28:
29: From: coyote@desert.example.org
30: To: roadrunner@acme.example.com
31: Subject: I have a present for you
32: X-Caffeine: C8H10N4O2
33:
34: Look, I'm sorry about the whole anvil thing, and I really
35: didn't mean to try and drop it on you from the top of the
36: cliff. I want to try to make it up to you. I've got some
37: great birdseed over here at my place--top of the line
38: stuff--and if you come by, I'll have it all wrapped up
39: for you. I'm really sorry for all the problems I've caused
40: for you over the years, but I know we can work this out.
41:
42: --
43: Wile E. Coyote "Super Genius" coyote@desert.example.org
44:
45: --(boundary)
46:
END OF MESSAGE
ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
ENVELOPE TO: <b1ff@de.res.example.com>
0: To: b1ff@de.res.example.com
1: Content-Type: multipart/mixed; boundary=(boundary)
2: MIME-Version: 1.0
3:
4: --(boundary)
5: Content-Type: text/plain;charset=UTF-8
6: Content-Transfer-Encoding: 8bit
7:
8: The original message was received at (date) from b1ff@de.res.example.com.
9: Message was refused by recipient's mail filtering program.
10: Reason given was as follows:
11:
12: I don't want to read these messages.
13:
14: Regards.
15:
16: --(boundary)
17: Content-Type: message/delivery-status
18:
19: Reporting-UA: sieve; GNU Mailutils 2.2.90
20: Arrival-Date: Mon, May 07 01:17:15 2001 EEST
21: Final-Recipient: RFC822; foobar@nonexistent.net
22: Action: deleted
23: Disposition: automatic-action/MDN-sent-automatically;deleted
24: Last-Attempt-Date: (date)
25:
26: --(boundary)
27: Content-Type: message/rfc822
28:
29: From: youcouldberich!@reply-by-postal-mail.invalid
30: To: rube@landru.example.edu
31: Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$
32: Date: TBD
33: X-Number: 0015
34:
35: YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT
36: IT! SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS! IT WILL
37: GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!
38: MONEY! MONEY! COLD HARD CASH! YOU WILL RECEIVE OVER
39: $20,000 IN LESS THAN TWO MONTHS! AND IT'S LEGAL!!!!!!!!!
40: !!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1 JUST
41: SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!
42:
43: --(boundary)
44:
END OF MESSAGE
ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
ENVELOPE TO: <bar@dontmailme.org>
0: To: bar@dontmailme.org
1: Content-Type: multipart/mixed; boundary=(boundary)
2: MIME-Version: 1.0
3:
4: --(boundary)
5: Content-Type: text/plain;charset=UTF-8
6: Content-Transfer-Encoding: 8bit
7:
8: The original message was received at (date) from bar@dontmailme.org.
9: Message was refused by recipient's mail filtering program.
10: Reason given was as follows:
11:
12: I don't want to read these messages.
13:
14: Regards.
15:
16: --(boundary)
17: Content-Type: message/delivery-status
18:
19: Reporting-UA: sieve; GNU Mailutils 2.2.90
20: Arrival-Date: Sat, Dec 29 01:28:09 2001 EET
21: Final-Recipient: RFC822; foobar@nonexistent.net
22: Action: deleted
23: Disposition: automatic-action/MDN-sent-automatically;deleted
24: Last-Attempt-Date: (date)
25:
26: --(boundary)
27: Content-Type: message/rfc822
28:
29: Received: (from bar@dontmailme.org)
30: by dontmailme.org id fERKR9N16790
31: for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
32: Date: Fri, 28 Dec 2001 23:28:08 +0200
33: From: Bar <bar@dontmailme.org>
34: To: Foo Bar <foobar@nonexistent.net>
35: Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
36: Subject: Coffee
37:
38: How about some coffee?
39:
40: --(boundary)
41:
END OF MESSAGE
],
[REJECT on msg uid 1
REJECT on msg uid 2
REJECT on msg uid 3
])
AT_CLEANUP
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
m4_pushdef([MUT_SIEVE_MAILBOX],[relational.mbox])
m4_pushdef([MUT_SIEVE_OPTIONS],[--set ":mailbox:folder=`pwd`"])
MUT_TESTCASE([relational address],[test relational address comparator i-ascii-numeric],
[
require [["relational", "comparator-i;ascii-numeric"]];
if address :count "ge" :comparator "i;ascii-numeric" [["to", "cc"] ["3"]]
{
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
IMPLICIT KEEP on msg uid 4
IMPLICIT KEEP on msg uid 5
IMPLICIT KEEP on msg uid 6
IMPLICIT KEEP on msg uid 7
IMPLICIT KEEP on msg uid 8
DISCARD on msg uid 9: marking as deleted
])
MUT_TESTCASE([relational header],[test relational header comparator i-ascii-numeric],
[
require [["relational", "comparator-i;ascii-numeric"]];
if header :count "gt" [["received"]] [["2"]]
{
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
IMPLICIT KEEP on msg uid 3
IMPLICIT KEEP on msg uid 4
IMPLICIT KEEP on msg uid 5
IMPLICIT KEEP on msg uid 6
IMPLICIT KEEP on msg uid 7
IMPLICIT KEEP on msg uid 8
DISCARD on msg uid 9: marking as deleted
])
MUT_TESTCASE([relational big test],[test relational relational-hairy],
[
require [["relational", "comparator-i;ascii-numeric", "fileinto"]];
if header :value "lt" :comparator "i;ascii-numeric" [["x-priority"]] [["3"]]
{
fileinto "%Priority";
}
elsif address :count "gt" :comparator "i;ascii-numeric" [["to"]] [["5"]]
{
# everything with more than 5 recipients in the "to" field
# is considered SPAM
fileinto "%SPAM";
}
elsif address :value "gt" :all :comparator "i;ascii-casemap" [["from"]] [["M"]]
{
fileinto "%From_N-Z";
}
else
{
fileinto "%From_A-M";
}
if allof (address :count "eq" :comparator "i;ascii-numeric"
[["to", "cc"]] [["1"]] ,
address :all :comparator "i;ascii-casemap"
[["to", "cc"]] [["me@foo.example.com.invalid"]])
{
fileinto "%Only_me";
}
],[],[0],[],
[FILEINTO on msg uid 1: delivering into %From_A-M
FILEINTO on msg uid 2: delivering into %From_N-Z
FILEINTO on msg uid 3: delivering into %Priority
FILEINTO on msg uid 4: delivering into %Priority
FILEINTO on msg uid 5: delivering into %Priority
FILEINTO on msg uid 6: delivering into %From_A-M
FILEINTO on msg uid 7: delivering into %From_A-M
FILEINTO on msg uid 8: delivering into %From_A-M
FILEINTO on msg uid 8: delivering into %Only_me
FILEINTO on msg uid 9: delivering into %SPAM
])
m4_popdef([MUT_SIEVE_MAILBOX])
m4_popdef([MUT_SIEVE_OPTIONS])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([size :under],[test size under size-under],
[
if size :under 400 {
discard;
}
],[],[0],[],
[IMPLICIT KEEP on msg uid 1
IMPLICIT KEEP on msg uid 2
DISCARD on msg uid 3: marking as deleted
])
MUT_TESTCASE([size :over],[test size over size-over],
[
if size :over 500 {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
IMPLICIT KEEP on msg uid 3
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
# Require a reasonably recent autotest.
m4_version_prereq([2.52g])
m4_define([AT_SKIP_TEST],[exit 77])
dnl ------------------------------------------------------------
dnl testcompile(SCRIPT) -- test compilation of the Sieve SCRIPT
dnl
m4_define([testcompile],[
AT_SETUP([compile $1])
AT_CHECK([sieve -c $top_srcdir/sieve/examples/$1],
[0])
AT_CLEANUP
])
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
--line-info=no dnl
--no-program-name dnl
--no-site-config dnl
--no-user-config dnl
-M sendmail:$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_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])
cp $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
])
AT_INIT
AT_TESTED([sieve])
m4_include([version.at])
m4_include([compile.at])
m4_include([false.at])
m4_include([true.at])
m4_include([not.at])
m4_include([action.at])
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([i-casemap.at])
m4_include([i-numeric.at])
m4_include([i-octet.at])
m4_include([mul-addr.at])
m4_include([relational.at])
m4_include([size.at])
m4_include([redirect.at])
m4_include([reject.at])
m4_include([ext.at])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
MUT_TESTCASE([true],[test constant true],
[
if true {
discard;
}
],[],[0],[],
[DISCARD on msg uid 1: marking as deleted
DISCARD on msg uid 2: marking as deleted
DISCARD on msg uid 3: marking as deleted
])
# This file is part of GNU Mailutils. -*- Autotest -*-
# Copyright (C) 2007, 2008, 2009, 2010 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.
#
# This program 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/>.
# This file is part of Mailfromd testsuite.
AT_SETUP([sieve version])
AT_CHECK([sieve --version | sed '1{s/ *[\[.*\]]//;q}' ],
[0],
[sieve (AT_PACKAGE_NAME) AT_PACKAGE_VERSION
],
[],
[cat >$[]XFAILFILE <<'_EOT'
==============================================================
WARNING: Not using the proper version, *all* checks dubious...
==============================================================
_EOT
],
[rm -f $[]XFAILFILE])
AT_CLEANUP
Makefile
Makefile.in
*.log
*.sum
site.exp
remote.exp
data
## Process this file with GNU Automake to create Makefile.in
## Copyright (C) 2002, 2007, 2010 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.
##
## This program 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 this program; if not, write to the Free Software
## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301 USA
AUTOMAKE_OPTIONS = dejagnu
DEJATOOL = sieve
RUNTESTFLAGS =
CLEANFILES = *.log
test_dirs = lib sieve scripts
EXTRA_DIST = Reject Redirect
dist-hook:
here=`cd $(top_builddir)/$(subdir) && pwd`; \
srcdir=`cd $(srcdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
for dir in $(test_dirs); \
do \
cd $$srcdir;\
mkdir $$distdir/$$dir;\
cd $$dir;\
for file in DISTFILES `cat DISTFILES`; do \
d=$$srcdir/$$dir; \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $$distdir/$$dir/$$file; \
else \
test -f $$distdir/$$dir/$$file \
|| cp -p $$d/$$file $$distdir/$$dir/$$file || exit; \
fi; \
done;\
done;\
cd $$here
site.exp: Makefile remote.exp
@echo 'Making a new site.exp file...'
@test ! -f site.bak || rm -f site.bak
@echo '## these variables are automatically generated by make ##' > $@-t
@echo '# Do not edit here. If you wish to override these values' >> $@-t
@echo '# edit the last section' >> $@-t
@echo 'set tool $(DEJATOOL)' >> $@-t
@echo "set top_srcdir `cd $(top_srcdir); pwd`" >> $@-t
@echo "set top_builddir `cd $(top_builddir); pwd`" >> $@-t
@echo "set srcdir `cd $(srcdir); pwd`" >> $@-t
@echo 'set objdir' `pwd` >> $@-t
@echo 'set host_alias "$(host_alias)"' >> $@-t
@echo 'set host_triplet $(host_triplet)' >> $@-t
@echo 'set target_alias "$(target_alias)"' >> $@-t
@echo 'set target_triplet $(target_triplet)' >> $@-t
@echo 'set build_alias "$(build_alias)"' >> $@-t
@echo 'set build_triplet $(build_triplet)' >> $@-t
@echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
@test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
@test ! -f site.exp || mv site.exp site.bak
@mv $@-t site.exp
remote.exp:;
@echo 'Making a new remote.exp file...'
@test ! -f remote.bak || rm -f remote.bak
@echo '## These variables are used to set up for the remote testing.' >> $@-t
@echo '## Please, read file README in this directory for instructions' >> $@-t
@echo '## on how to use this file' >> $@-t
@echo "set host_board `hostname`" >> $@-t
@echo 'set board_info($$host_board,connect) rlogin' >> $@-t
@echo 'set board_info($$host_board,shell_prompt) "\\$$ "' >> $@-t
@echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
@echo "set board_info(\$$host_board,srcdir) `cd $(srcdir); pwd`" >> $@-t
@echo "set board_info(\$$host_board,objdir) `pwd`" >> $@-t
@echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
@echo "set board_info(\$$host_board,top_builddir) `cd $(top_builddir); pwd`" >> $@-t
@test ! -f remote.exp || mv remote.exp remote.bak
@mv $@-t remote.exp
DISTCLEANFILES=*.exp *.log *.sum
distclean-local:
-rm -rf data
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
TEST reject.sv
PATTERN BEGIN
REJECT on msg uid 1
REJECT on msg uid 2
REJECT on msg uid 3
PATTERN END
FILE BEGIN
ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
ENVELOPE TO: <coyote@desert.example.org>
0: To: coyote@desert.example.org
-re
1: Content-Type: multipart/mixed; boundary="[0-9:=-]+"
2: MIME-Version: 1.0
3:
-re
4: [0-9:=-]+
5: Content-Type: text/plain;charset=UTF-8
6: Content-Transfer-Encoding: 8bit
7:
-re
8: The original message was received at [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* from coyote@desert.example.org.
9: Message was refused by recipient's mail filtering program.
10: Reason given was as follows:
11:
12: I don't want to read these messages.
13:
14: Regards.
15:
-re
16: [0-9:=-]+
17: Content-Type: message/delivery-status
18:
-re
19: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]*
-re
20: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
21: Final-Recipient: RFC822; foobar@nonexistent.net
22: Action: deleted
23: Disposition: automatic-action/MDN-sent-automatically;deleted
-re
24: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
25:
-re
26: [0-9:=-]+
27: Content-Type: message/rfc822
28:
29: From: coyote@desert.example.org
30: To: roadrunner@acme.example.com
31: Subject: I have a present for you
32: X-Caffeine: C8H10N4O2
33:
34: Look, I'm sorry about the whole anvil thing, and I really
35: didn't mean to try and drop it on you from the top of the
36: cliff. I want to try to make it up to you. I've got some
37: great birdseed over here at my place--top of the line
38: stuff--and if you come by, I'll have it all wrapped up
39: for you. I'm really sorry for all the problems I've caused
40: for you over the years, but I know we can work this out.
41:
42: --
43: Wile E. Coyote "Super Genius" coyote@desert.example.org
44:
-re
45: [0-9:=-]+
46:
END OF MESSAGE
ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
ENVELOPE TO: <b1ff@de.res.example.com>
0: To: b1ff@de.res.example.com
-re
1: Content-Type: multipart/mixed; boundary="[0-9:=-]+"
2: MIME-Version: 1.0
3:
-re
4: [0-9:=-]+
5: Content-Type: text/plain;charset=UTF-8
6: Content-Transfer-Encoding: 8bit
7:
-re
8: The original message was received at [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* from b1ff@de.res.example.com.
9: Message was refused by recipient's mail filtering program.
10: Reason given was as follows:
11:
12: I don't want to read these messages.
13:
14: Regards.
15:
-re
16: [0-9:=-]+
17: Content-Type: message/delivery-status
18:
-re
19: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]*
-re
20: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
21: Final-Recipient: RFC822; foobar@nonexistent.net
22: Action: deleted
23: Disposition: automatic-action/MDN-sent-automatically;deleted
-re
24: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
25:
-re
26: [0-9:=-]+
27: Content-Type: message/rfc822
28:
29: From: youcouldberich!@reply-by-postal-mail.invalid
30: To: rube@landru.example.edu
31: Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$
32: Date: TBD
33: X-Number: 0015
34:
35: YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT
36: IT! SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS! IT WILL
37: GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!
38: MONEY! MONEY! COLD HARD CASH! YOU WILL RECEIVE OVER
39: $20,000 IN LESS THAN TWO MONTHS! AND IT'S LEGAL!!!!!!!!!
40: !!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1 JUST
41: SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!
42:
-re
43: [0-9:=-]+
44:
END OF MESSAGE
ENVELOPE FROM: MAILER-DAEMON@nonexistent.net
ENVELOPE TO: <bar@dontmailme.org>
0: To: bar@dontmailme.org
-re
1: Content-Type: multipart/mixed; boundary="[0-9:=-]+"
2: MIME-Version: 1.0
3:
-re
4: [0-9:=-]+
5: Content-Type: text/plain;charset=UTF-8
6: Content-Transfer-Encoding: 8bit
7:
-re
8: The original message was received at [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]* from bar@dontmailme.org.
9: Message was refused by recipient's mail filtering program.
10: Reason given was as follows:
11:
12: I don't want to read these messages.
13:
14: Regards.
15:
-re
16: [0-9:=-]+
17: Content-Type: message/delivery-status
18:
-re
19: Reporting-UA: sieve; GNU Mailutils [0-9][0-9.]*
-re
20: Arrival-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
21: Final-Recipient: RFC822; foobar@nonexistent.net
22: Action: deleted
23: Disposition: automatic-action/MDN-sent-automatically;deleted
-re
24: Last-Attempt-Date: [A-Z][a-z][a-z], [A-Z][a-z][a-z] [ 0-3][0-9] [ 0-2][0-9]:[0-6][0-9]:[0-6][0-9] [0-9][0-9][0-9][0-9] [a-zA-Z0-9]*
25:
-re
26: [0-9:=-]+
27: Content-Type: message/rfc822
28:
29: Received: (from bar@dontmailme.org)
30: by dontmailme.org id fERKR9N16790
31: for foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200
32: Date: Fri, 28 Dec 2001 23:28:08 +0200
33: From: Bar <bar@dontmailme.org>
34: To: Foo Bar <foobar@nonexistent.net>
35: Message-Id: <200112232808.fERKR9N16790@dontmailme.org>
36: Subject: Coffee
37:
38: How about some coffee?
39:
-re
40: [0-9:=-]+
41:
END OF MESSAGE
FILE END
TEST END
# End of Reject
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
source $top_srcdir/testsuite/lib/mailutils.exp
set sieve_source_dir "${srcdir}/scripts"
mu_init -noflags
set env(MAIL) $MU_SPOOL_DIR/sieve.mbox
set env(FOLDER) $env(MAIL)
set SIEVE_ETC_DIR "$MU_DATA_DIR/etc"
mu_makespool "$MU_RC_DIR" "$SIEVE_ETC_DIR"
# sieve_test [-retcode N][-message MESSAGE][-default (FAIL|XFAIL)]
# [-reuse-spool]
# [ARGS...][-pattern PATTERN...]
proc sieve_test {args} {
global sieve_source_dir
global top_builddir
global SIEVE_ETC_DIR
global MU_SPOOL_DIR
set default ""
set sw [list "--config-file=$SIEVE_ETC_DIR/mailutils.rc" \
"--verbose" \
"--line-info=no" \
"--no-program-name" \
"-M sendmail:$top_builddir/examples/mta" \
"--email foobar@nonexistent.net"]
set reuse_spool 0
set retcode 0
set mailbox "$MU_SPOOL_DIR/sieve.mbox"
for {set i 0} {$i < [llength $args]} {incr i} {
set a [lindex $args $i]
if {"$a" == "-default"} {
incr i
set default [lindex $args $i]
} elseif {"$a" == "-message"} {
incr i
set message [lindex $args $i]
} elseif {"$a" == "-pattern"} {
incr i
set pattern [lrange $args $i end]
break
} elseif {"$a" == "-reuse-spool"} {
set reuse_spool 1
break
} elseif {"$a" == "-retcode"} {
incr i
set retcode [lindex $args $i]
} elseif {"$a" == "-f"} {
incr i
set mailbox [lindex $args $i]
} else {
set sw [concat $sw [lindex $args $i]]
}
}
switch -- "[lindex $sw end]" {
^/.* { }
default {
set sw [concat [lrange $sw 0 [expr [llength $sw] - 2]] \
[list "${sieve_source_dir}/[lindex $sw end]"]]
}
}
set sw [concat "-f$mailbox" $sw]
if {![info exists message]} {
set message "[lindex $sw end]"
}
if {!$reuse_spool} {
mu_prepare_spools
}
if [info exists pattern] {
mu_exec -default $default -message $message -arg-list $sw \
-pattern $pattern -retcode $retcode
} else {
mu_exec -default $default -message $message -arg-list $sw \
-retcode $retcode
}
#FIXME: examine the output mailbox
}
proc sieve_driver_test {name mailer diag} {
global srcdir
set chan [open "${srcdir}/$name" r]
set state 0
set command ""
for {gets $chan line} {![eof $chan]} {gets $chan line} {
verbose "LINE $line" 1
switch -regexp -- "$line" {
"^#.*" { }
"^TEST END" {
verbose "ARGS $args" 1
verbose "PATTERN $pattern" 1
verbose "OUTPUT $output" 1
eval sieve_test $args -pattern $pattern
eval mu_test_file "$diag" $output
set state 0
}
"^TEST" {
regexp "^TEST (.*)" $line dummy args
set pattern [list]
set output [list]
set state 1
}
"^PATTERN BEGIN" {
set state 2
}
"^PATTERN END" {
set state 1
}
"^FILE BEGIN" {
set state 3
}
"^FILE END" {
set state 1
}
"^STOP" {
break
}
default {
if {$state == 2} {
lappend pattern $line
} elseif {$state == 3} {
lappend output $line
}
}
}
}
close $chan
}
addr_is_all.sv
addr_is_domain.sv
addr_is_local.sv
addr_matches.sv
address.sv
allof00.sv
allof01.sv
allof11.sv
anyof00.sv
anyof01.sv
anyof11.sv
discard.sv
envelope1.sv
exists1.sv
exists2.sv
exists3.sv
false.sv
fileinto.sv
header1.sv
header2.sv
header3.sv
header-mime.sv
i-casemap-contains.sv
i-casemap-is.sv
i-casemap-matches.sv
i-casemap-regex.sv
i-numeric-contains.sv
i-numeric-is.sv
i-octet-contains.sv
i-octet-is.sv
i-octet-matches.sv
i-octet-regex.sv
keep.sv
mul-addr.sv
not.sv
null.sv
numaddr.sv
redirect.sv
reject.sv
rel-address.sv
rel-hairy.sv
rel-header.sv
size1.sv
size2.sv
stop.sv
true.sv
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if address :is :all "From" "coyote@desert.example.org" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if address :is :domain "From" "desert.example.org" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if address :is :localpart "From" "youcouldberich!" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if address :matches :all "From" "*invalid" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if address :is :all "From" "coyote@desert.example.org" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if allof(false,false) {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if allof(false,true) {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if allof(true,true) {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if anyof(false,false) {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if anyof(false,true) {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if anyof(true,true) {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
discard;
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if envelope "from" "coyote@desert.example.org" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if exists "X-Caffeine" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if exists ["X-Caffeine", "From"] {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if exists ["X-Caffeine", "X-Status"] {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if false {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "fileinto";
fileinto "+file";
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if header :mime :is "Content-Description" "How doth" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if header :is "X-Caffeine" "C8H10N4O2" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if header ["X-Caffeine","Subject"] ["C8H10N4O2","Coffee"] {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if header :matches "Subject" "*$$$*" {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;ascii-casemap";
if header :comparator "i;ascii-casemap" :contains ["from", "to"] "ExAmPLe"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;ascii-casemap";
if header :comparator "i;ascii-casemap" :is "to" "roadrunner@ACME.EXAMPLE.COM"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;ascii-casemap";
if header :comparator "i;ascii-casemap" :matches "subject" "*you, too,*"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;ascii-casemap";
if header :comparator "i;ascii-casemap" :regex "subject" ".*you.*"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;ascii-numeric";
if header :comparator "i;ascii-numeric" :contains "X-Number" "15"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;ascii-numeric";
if header :comparator "i;ascii-numeric" :is "X-Number" "15"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;octet";
if header :comparator "i;octet" :contains ["from", "to"] "example"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;octet";
if header :comparator "i;octet" :is "to" "roadrunner@acme.example.com"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;octet";
if header :comparator "i;octet" :matches "subject" "$$$*$$$"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "comparator-i;octet";
if header :comparator "i;octet" :regex "subject" ".*you.*"
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
keep;
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "fileinto";
if address :localpart :is ["To", "Cc"] [ "foo", "oof" ]
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if not false {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
# Empty script to test implicit keep.
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "test-numaddr";
if numaddr [ "to", "cc" ] :over 5
{
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "redirect";
redirect "gray@gnu.org";
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require "reject";
reject text:
I don't want to read these messages.
Regards.
.
;
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require ["relational", "comparator-i;ascii-numeric"];
if address :count "ge" :comparator "i;ascii-numeric" ["to", "cc"] ["3"]
{
discard;
}
# End of rel-address.sv
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require ["relational", "comparator-i;ascii-numeric", "fileinto"];
if header :value "lt" :comparator "i;ascii-numeric" ["x-priority"] ["3"]
{
fileinto "%Priority";
}
elsif address :count "gt" :comparator "i;ascii-numeric" ["to"] ["5"]
{
# everything with more than 5 recipients in the "to" field
# is considered SPAM
fileinto "%SPAM";
}
elsif address :value "gt" :all :comparator "i;ascii-casemap" ["from"] ["M"]
{
fileinto "%From_N-Z";
}
else
{
fileinto "%From_A-M";
}
if allof (address :count "eq" :comparator "i;ascii-numeric"
["to", "cc"] ["1"] ,
address :all :comparator "i;ascii-casemap"
["to", "cc"] ["me@foo.example.com.invalid"])
{
fileinto "%Only_me";
}
# End of rel-hairy.sv
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2003, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
require ["relational", "comparator-i;ascii-numeric"];
if header :count "gt" ["received"] ["2"]
{
discard;
}
# End of rel-address.sv
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if size :under 400 {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if size :over 500 {
discard;
}
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
stop;
# -*- sieve -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2010 Free Software Foundation, Inc.
# See file COPYING for distribution conditions.
if true {
discard;
}
action.exp
address.exp
allof.exp
anyof.exp
envelope.exp
exists.exp
ext.exp
false.exp
header.exp
i-casemap.exp
i-numeric.exp
i-octet.exp
mul-addr.exp
not.exp
redirect.exp
reject.exp
relational.exp
size.exp
true.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2009, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test stop.sv -pattern\
"STOP on msg uid 1"\
"STOP on msg uid 2"\
"STOP on msg uid 3"
sieve_test null.sv -pattern\
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test keep.sv -pattern\
"KEEP on msg uid 1"\
"KEEP on msg uid 2"\
"KEEP on msg uid 3"
sieve_test discard.sv -pattern\
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"DISCARD on msg uid 3: marking as deleted"
sieve_test --set "mailbox.folder=\"'$MU_SPOOL_DIR'\"" fileinto.sv -pattern\
"FILEINTO on msg uid 1: delivering into +file"\
"FILEINTO on msg uid 2: delivering into +file"\
"FILEINTO on msg uid 3: delivering into +file"
mu_test_file "$MU_SPOOL_DIR/file" \
"From coyote@desert.example.org Sun May 6 22:16:47 2001"\
"From: coyote@desert.example.org"\
"To: roadrunner@acme.example.com"\
"Subject: I have a present for you"\
"X-Caffeine: C8H10N4O2"\
""\
"Look, I'm sorry about the whole anvil thing, and I really"\
"didn't mean to try and drop it on you from the top of the"\
"cliff. I want to try to make it up to you. I've got some"\
"great birdseed over here at my place--top of the line"\
"stuff--and if you come by, I'll have it all wrapped up"\
"for you. I'm really sorry for all the problems I've caused"\
"for you over the years, but I know we can work this out."\
""\
-- "--"\
"Wile E. Coyote \"Super Genius\" coyote@desert.example.org"\
""\
"From b1ff@de.res.example.com Sun May 6 22:17:15 2001"\
"From: youcouldberich!@reply-by-postal-mail.invalid"\
"To: rube@landru.example.edu"\
"Subject: \$\$\$ YOU, TOO, CAN BE A MILLIONAIRE! \$\$\$"\
"Date: TBD"\
"X-Number: 0015"\
""\
"YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT"\
"IT! SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS! IT WILL"\
"GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!"\
"MONEY! MONEY! COLD HARD CASH! YOU WILL RECEIVE OVER"\
"\$20,000 IN LESS THAN TWO MONTHS! AND IT'S LEGAL!!!!!!!!!"\
"!!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1 JUST"\
"SEND \$5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!"\
""\
"From bar@dontmailme.org Fri Dec 28 23:28:09 2001"\
"Received: (from bar@dontmailme.org)"\
"\tby dontmailme.org id fERKR9N16790"\
"\tfor foobar@nonexistent.net; Fri, 28 Dec 2001 22:18:08 +0200"\
"Date: Fri, 28 Dec 2001 23:28:08 +0200"\
"From: Bar <bar@dontmailme.org>"\
"To: Foo Bar <foobar@nonexistent.net>"\
"Message-Id: <200112232808.fERKR9N16790@dontmailme.org>"\
"Subject: Coffee"\
""\
"How about some coffee?"
# end of action.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test addr_is_all.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test addr_is_domain.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test addr_is_local.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
sieve_test addr_matches.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
# end of address.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test allof00.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test allof01.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test allof11.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"DISCARD on msg uid 3: marking as deleted"
# end of allof.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test anyof00.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test anyof01.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"DISCARD on msg uid 3: marking as deleted"
sieve_test anyof11.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"DISCARD on msg uid 3: marking as deleted"
# end of anyof.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
set exdir "${srcdir}/../examples"
set scripts [list\
ex-null.sv\
box.sv\
ex-1.10.2.sv\
ex-2.3a.sv\
ex-2.5.1.sv\
ex-2.7.3.sv\
ex-3.1a.sv\
ex-3.1b.sv\
ex-4.2.sv\
ex-4.4a.sv\
ex-4.4b.sv\
ex-4.5.sv\
ex-5.1.sv\
ex-5.7.sv\
ex-save-all.sv\
example.sv\
exn-2.3b.sv]
# t-complex.sv
# t-exists.sv
# t-fileinto.sv
# t-mailutils.sv
for {set s $scripts} {[llength $s] != 0} {set s [lrange $s 1 end]} {
set source_name [lindex $s 0]
mu_exec -message "sieve -c $source_name" \
-arg -c -arg ${exdir}/$source_name
}
# end of compile.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test envelope1.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
# end of envelope.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test exists1.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test exists2.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test exists3.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
# end of exists.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
mu_version
if ![mu_check_capability HAVE_LIBLTDL] {
unsupported "This test requires libltdl"
} else {
sieve_test --clearpath -L "${top_builddir}/examples" -f ${MU_SPOOL_DIR}/bigto.mbox numaddr.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"
}
# End of ext.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test false.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
# end of false.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test header1.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test header2.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"DISCARD on msg uid 3: marking as deleted"
sieve_test header3.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
sieve_test -f "$MU_SPOOL_DIR/mbox1" header-mime.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"DISCARD on msg uid 3: marking as deleted"\
"IMPLICIT KEEP on msg uid 4"\
"IMPLICIT KEEP on msg uid 5"
# end of header.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test i-casemap-is.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test i-casemap-matches.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
sieve_test i-casemap-contains.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
sieve_test i-casemap-regex.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
# end of i-casemap.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test i-numeric-is.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
sieve_test i-numeric-contains.sv -retcode 78 -pattern \
-re ".*i-numeric-contains.sv:9: comparator `i;ascii-numeric' is incompatible with match type `contains' in call to `header'"
# end of i-numeric.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test i-octet-is.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
sieve_test i-octet-matches.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
sieve_test i-octet-contains.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
sieve_test i-octet-regex.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"
# end of i-octet.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test -f $MU_SPOOL_DIR/relational.mbox mul-addr.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"DISCARD on msg uid 3: marking as deleted"\
"DISCARD on msg uid 4: marking as deleted"\
"DISCARD on msg uid 5: marking as deleted"\
"DISCARD on msg uid 6: marking as deleted"\
"DISCARD on msg uid 7: marking as deleted"\
"IMPLICIT KEEP on msg uid 8"\
"DISCARD on msg uid 9: marking as deleted"
# End of mul-addr.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test not.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"DISCARD on msg uid 3: marking as deleted"
# end of not.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
mu_version
if ![mu_check_capability ENABLE_SENDMAIL] {
unsupported "Support for sendmail not compiled in"
} else {
set mtafile "$MU_FOLDER_DIR/mta.diag"
set env(MTA_DIAG) "$mtafile"
set env(MTA_APPEND) 1
set mailer "sendmail:$top_builddir/examples/mta"
sieve_driver_test "Redirect" "$mailer" "$mtafile"
}
# End of redirect.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
mu_version
if ![mu_check_capability ENABLE_SENDMAIL] {
unsupported "Support for sendmail not compiled in"
} else {
set mtafile "$MU_FOLDER_DIR/mta.diag"
set env(MTA_DIAG) "$mtafile"
set env(MTA_APPEND) 1
set mailer "sendmail:$top_builddir/examples/mta"
sieve_driver_test "Reject" "$mailer" "$mtafile"
}
# End of reject.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test -f $MU_SPOOL_DIR/relational.mbox rel-address.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"\
"IMPLICIT KEEP on msg uid 4"\
"IMPLICIT KEEP on msg uid 5"\
"IMPLICIT KEEP on msg uid 6"\
"IMPLICIT KEEP on msg uid 7"\
"IMPLICIT KEEP on msg uid 8"\
"DISCARD on msg uid 9: marking as deleted"
sieve_test -f $MU_SPOOL_DIR/relational.mbox rel-header.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"IMPLICIT KEEP on msg uid 3"\
"IMPLICIT KEEP on msg uid 4"\
"IMPLICIT KEEP on msg uid 5"\
"IMPLICIT KEEP on msg uid 6"\
"IMPLICIT KEEP on msg uid 7"\
"IMPLICIT KEEP on msg uid 8"\
"DISCARD on msg uid 9: marking as deleted"
sieve_test -f $MU_SPOOL_DIR/relational.mbox rel-hairy.sv -pattern \
"FILEINTO on msg uid 1: delivering into %From_A-M"\
"FILEINTO on msg uid 2: delivering into %From_N-Z"\
"FILEINTO on msg uid 3: delivering into %Priority"\
"FILEINTO on msg uid 4: delivering into %Priority"\
"FILEINTO on msg uid 5: delivering into %Priority"\
"FILEINTO on msg uid 6: delivering into %From_A-M"\
"FILEINTO on msg uid 7: delivering into %From_A-M"\
"FILEINTO on msg uid 8: delivering into %From_A-M"\
"FILEINTO on msg uid 8: delivering into %Only_me"\
"FILEINTO on msg uid 9: delivering into %SPAM"
# End of relational.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test size1.sv -pattern \
"IMPLICIT KEEP on msg uid 1"\
"IMPLICIT KEEP on msg uid 2"\
"DISCARD on msg uid 3: marking as deleted"
sieve_test size2.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"IMPLICIT KEEP on msg uid 3"
# end of size.exp
# -*- tcl -*-
# This file is part of Mailutils testsuite.
# Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc.
#
# 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
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA.
sieve_test true.sv -pattern \
"DISCARD on msg uid 1: marking as deleted"\
"DISCARD on msg uid 2: marking as deleted"\
"DISCARD on msg uid 3: marking as deleted"
# end of true.exp