summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2002-11-04 17:42:01 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2002-11-04 17:42:01 +0000
commit8d1c338f4dd36424104eb28e1a6500648c9fb4b7 (patch)
treeff95a73c46503d5e8e733705c5f109f605e140d6
parentbb752c910c1af619c42aacce827fa485c50bcf47 (diff)
downloadmailutils-8d1c338f4dd36424104eb28e1a6500648c9fb4b7.tar.gz
mailutils-8d1c338f4dd36424104eb28e1a6500648c9fb4b7.tar.bz2
Added to the repository
-rw-r--r--mail.local/testsuite/.cvsignore7
-rw-r--r--mail.local/testsuite/Data45
-rw-r--r--mail.local/testsuite/Makefile.am75
-rw-r--r--mail.local/testsuite/lib/DISTFILES1
-rw-r--r--mail.local/testsuite/lib/mail.local.exp104
-rw-r--r--mail.local/testsuite/mail.local/DISTFILES1
-rw-r--r--mail.local/testsuite/mail.local/deliver.exp96
7 files changed, 329 insertions, 0 deletions
diff --git a/mail.local/testsuite/.cvsignore b/mail.local/testsuite/.cvsignore
new file mode 100644
index 000000000..989f5903e
--- /dev/null
+++ b/mail.local/testsuite/.cvsignore
@@ -0,0 +1,7 @@
+Makefile
+Makefile.in
+*.log
+*.sum
+site.exp
+remote.exp
+data
diff --git a/mail.local/testsuite/Data b/mail.local/testsuite/Data
new file mode 100644
index 000000000..d3bb84409
--- /dev/null
+++ b/mail.local/testsuite/Data
@@ -0,0 +1,45 @@
+# This file is part of Mailutils testsuite.
+# Copyright (C) 2002, Free Software Foundation
+#
+# 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 2 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.
+#
+
+MESSAGE Simple mail
+FROM gray@gnu.org
+TO user
+BODY BEGIN
+From: gray@gnu.org
+To: bug-mailutils@gnu.org
+Subject: Simple mail
+
+This is a simple mail.
+Data goes here.
+BODY END
+MESSAGE END
+
+MESSAGE Second mail
+FROM gray@runasimi.org
+TO user
+BODY BEGIN
+From: gray@runasimi.org
+To: bug-mailutils@gnu.org
+Subject: Simple mail
+
+This is a simple mail.
+Data goes here.
+BODY END
+MESSAGE END
+
+# end of data \ No newline at end of file
diff --git a/mail.local/testsuite/Makefile.am b/mail.local/testsuite/Makefile.am
new file mode 100644
index 000000000..a87cc1cb0
--- /dev/null
+++ b/mail.local/testsuite/Makefile.am
@@ -0,0 +1,75 @@
+# This file is part of GNU Mailutils
+# Copyright (C) 2000,2001,2002 Free Software Foundation
+# See file COPYING in the distribution root directory for copying conditions.
+
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = mail.local
+RUNTESTFLAGS =
+CLEANFILES = *.log
+test_dirs = lib mail.local
+EXTRA_DIST = Data
+
+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 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
diff --git a/mail.local/testsuite/lib/DISTFILES b/mail.local/testsuite/lib/DISTFILES
new file mode 100644
index 000000000..090415056
--- /dev/null
+++ b/mail.local/testsuite/lib/DISTFILES
@@ -0,0 +1 @@
+mail.local.exp
diff --git a/mail.local/testsuite/lib/mail.local.exp b/mail.local/testsuite/lib/mail.local.exp
new file mode 100644
index 000000000..ce3371230
--- /dev/null
+++ b/mail.local/testsuite/lib/mail.local.exp
@@ -0,0 +1,104 @@
+# -*- tcl -*-
+# This file is part of Mailutils testsuite.
+# Copyright (C) 2002, Free Software Foundation
+#
+# 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 2 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.
+
+source $top_srcdir/testsuite/lib/mailutils.exp
+
+mu_init "--authentication generic --authorization virtdomain"
+mu_version
+if ![mu_check_capability ENABLE_VIRTUAL_DOMAINS] {
+ clone_output "WARNING: Support for virtual domains not compiled in"
+ clone_output "WARNING: Skipping tests for mail.local"
+ exit 0
+}
+
+mu_prepare_spools
+
+set ETC_DIR "$MU_DATA_DIR/etc"
+
+set output [remote_exec host "$MU_MAKESPOOL \
+ -subst \"s,@MU_SPOOL_DIR@,$MU_SPOOL_DIR,\" \
+ $MU_RC_DIR $ETC_DIR" ]
+if [lindex $output 0] {
+ perror "Cannot create ETC_DIR: [lindex $output 1]"
+ exit 1
+}
+append MU_TOOL_FLAGS " --virtual-passwd-dir $ETC_DIR"
+
+set mu_filename "$MU_SPOOL_DIR/INBOX"
+set env(MTA_DIAG) "$mu_filename"
+
+# mail_local_test [-message MESSAGE][-default (FAIL|XFAIL)]
+# [-input INPUT-LIST]
+# [-args ARGS][-pattern PATTERN-LIST][PATTERN...]
+# INPUT-LIST - List of input strings for MU_TOOL
+# PATTERN - Sequence to expect in return.
+# MESSAGE - [optional] message to output
+# ARGS - Additional arguments to MU_TOOL
+proc mail_local_test { args } {
+ global MU_TOOL
+ global top_builddir
+ global verbose
+ global suppress_flag;
+ global mu_filename
+ upvar timeout timeout
+
+ set default ""
+ set message ""
+ set invocation ""
+ set input ""
+ set pattern ""
+ set invocation ""
+
+ 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 [lindex $args $i]
+ } elseif {"$a" == "-input"} {
+ incr i
+ set input [lindex $args $i]
+ } elseif {"$a" == "-args"} {
+ incr i
+ set a [lindex $args $i]
+ if {[llength $a] > 0} {
+ append invocation $a
+ }
+ } else {
+ set args [lrange $args $i end]
+ break
+ }
+ }
+
+ if {"$message" == ""} {
+ set message [lindex $args 0]
+ }
+
+ if $verbose>2 then {
+ send_user "Message is \"$message\"\n"
+ }
+
+ return [mailer_test -default $default -message $message -input $input -pattern $pattern -file $mu_filename -args $invocation]
+}
+
+
diff --git a/mail.local/testsuite/mail.local/DISTFILES b/mail.local/testsuite/mail.local/DISTFILES
new file mode 100644
index 000000000..926763d1c
--- /dev/null
+++ b/mail.local/testsuite/mail.local/DISTFILES
@@ -0,0 +1 @@
+deliver.exp
diff --git a/mail.local/testsuite/mail.local/deliver.exp b/mail.local/testsuite/mail.local/deliver.exp
new file mode 100644
index 000000000..2c396dfe5
--- /dev/null
+++ b/mail.local/testsuite/mail.local/deliver.exp
@@ -0,0 +1,96 @@
+# -*- tcl -*-
+# This file is part of Mailutils testsuite.
+# Copyright (C) 2002, Free Software Foundation
+#
+# 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 2 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 chan [open ${srcdir}/Data r]
+
+# States are:
+# INITIAL 0
+# MESSAGE 1
+# BODY 2
+# PATTERN 3
+set state 0
+# Current pattern. Notice that it is cumulative (i.e. it is not reset
+# before each test) since the mailbox itself is cumulative too.
+set pattern [list]
+for {gets $chan line} {![eof $chan]} {gets $chan line} {
+ verbose "LINE $line" 1
+ switch -regexp -- "$line" {
+ "^#.*" { }
+ "^MESSAGE END" {
+ verbose "MAIL FROM $from" 1
+ verbose "MAIL TO $to" 1
+ verbose "INPUT $input" 1
+ verbose "PATTERN $pattern" 1
+ set args ""
+ if {$from != ""} {
+ append args " --from $from"
+ }
+ if {$to != ""} {
+ append args " ${to}@passwd"
+ }
+
+ if {$pattern == ""} {
+ set pattern [concat [list -re "From $from\[^\r\n\]*"] $input]
+ }
+ mail_local_test -message $message -input $input \
+ -pattern $pattern -args $args
+ lappend pattern ""
+ set state 0
+ }
+ "^MESSAGE" {
+ regexp "^MESSAGE (.*)" $line dummy message
+ set from ""
+ set to ""
+ set input [list]
+ set state 1
+ }
+ "^FROM" {
+ regexp "^FROM (.*)" $line dummy from
+ }
+ "^TO" {
+ regexp "^TO (.*)" $line dummy to
+ }
+ "^BODY BEGIN" {
+ set state 2
+ }
+ "^BODY END" {
+ set state 1
+ }
+ "^PATTERN BEGIN" {
+ set state 3
+ }
+ "^PATTERN END" {
+ set state 1
+ }
+ "^STOP" {
+ break
+ }
+ default {
+ if {$state == 2} {
+ lappend input $line
+ } elseif {$state == 3} {
+ lappend pattern $line
+ }
+ }
+ }
+}
+
+close $chan
+
+# End of deliver.exp
+

Return to:

Send suggestions and report system problems to the System administrator.