summaryrefslogtreecommitdiff
path: root/mail.remote/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'mail.remote/testsuite')
-rw-r--r--mail.remote/testsuite/Data179
-rw-r--r--mail.remote/testsuite/Makefile.am76
-rw-r--r--mail.remote/testsuite/lib/DISTFILES1
-rw-r--r--mail.remote/testsuite/lib/mail.remote.exp119
-rw-r--r--mail.remote/testsuite/mail.remote/DISTFILES1
-rw-r--r--mail.remote/testsuite/mail.remote/send.exp83
6 files changed, 459 insertions, 0 deletions
diff --git a/mail.remote/testsuite/Data b/mail.remote/testsuite/Data
new file mode 100644
index 000000000..df11ee064
--- /dev/null
+++ b/mail.remote/testsuite/Data
@@ -0,0 +1,179 @@
+# 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
+BODY BEGIN
+From: gray@gnu.org
+To: bug-mailutils@gnu.org
+Subject: Simple mail
+
+This is a simple mail.
+Data goes here.
+BODY END
+
+PATTERN BEGIN
+ENVELOPE FROM: gray@gnu.org
+ENVELOPE TO: <bug-mailutils@gnu.org>
+ 0: From: gray@gnu.org
+ 1: To: bug-mailutils@gnu.org
+ 2: Subject: Simple mail
+ 3:
+ 4: This is a simple mail.
+ 5: Data goes here.
+ 6:
+END OF MESSAGE
+PATTERN END
+MESSAGE END
+
+MESSAGE Explicit from
+FROM gray@localhost
+BODY BEGIN
+From: gray@gnu.org
+To: bug-mailutils@gnu.org
+Subject: Explicit from test.
+
+This is a simple mail.
+Data goes here.
+BODY END
+
+PATTERN BEGIN
+ENVELOPE FROM: gray@localhost
+ENVELOPE TO: <bug-mailutils@gnu.org>
+ 0: From: gray@gnu.org
+ 1: To: bug-mailutils@gnu.org
+ 2: Subject: Explicit from test.
+ 3:
+ 4: This is a simple mail.
+ 5: Data goes here.
+ 6:
+END OF MESSAGE
+PATTERN END
+MESSAGE END
+
+MESSAGE Explicit To
+TO alainm@gnu.org jbailey@gnu.org
+BODY BEGIN
+From: gray@gnu.org
+Subject: Expicit destinations
+
+This is a test for working explicit destinations.
+BODY END
+PATTERN BEGIN
+ENVELOPE FROM: gray@gnu.org
+ENVELOPE TO: <alainm@gnu.org>,<jbailey@gnu.org>
+ 0: To: <alainm@gnu.org>,<jbailey@gnu.org>
+ 1: From: gray@gnu.org
+ 2: Subject: Expicit destinations
+ 3:
+ 4: This is a test for working explicit destinations.
+ 5:
+END OF MESSAGE
+PATTERN END
+MESSAGE END
+
+MESSAGE CC
+BODY BEGIN
+From: gray@gnu.org
+To: bug-mailutils@gnu.org
+Cc: alainm@gnu.org
+Subject: Carbon copy test
+
+CC works.
+BODY END
+PATTERN BEGIN
+ENVELOPE FROM: gray@gnu.org
+ENVELOPE TO: <bug-mailutils@gnu.org>,<alainm@gnu.org>
+ 0: From: gray@gnu.org
+ 1: To: bug-mailutils@gnu.org
+ 2: Cc: alainm@gnu.org
+ 3: Subject: Carbon copy test
+ 4:
+ 5: CC works.
+ 6:
+END OF MESSAGE
+PATTERN END
+MESSAGE END
+
+MESSAGE BCC
+BODY BEGIN
+From: gray@gnu.org
+To: alainm@gnu.org
+Bcc: bug-mailutils@gnu.org
+Subject: Blind carbon copy test.
+
+Bcc works too.
+BODY END
+PATTERN BEGIN
+ENVELOPE FROM: gray@gnu.org
+ENVELOPE TO: <alainm@gnu.org>
+ 0: From: gray@gnu.org
+ 1: To: alainm@gnu.org
+ 2: Subject: Blind carbon copy test.
+ 3:
+ 4: Bcc works too.
+ 5:
+END OF MESSAGE
+ENVELOPE FROM: gray@gnu.org
+ENVELOPE TO: <bug-mailutils@gnu.org>
+ 0: Bcc: bug-mailutils@gnu.org
+ 1: From: gray@gnu.org
+ 2: To: alainm@gnu.org
+ 3: Subject: Blind carbon copy test.
+ 4:
+ 5: Bcc works too.
+ 6:
+END OF MESSAGE
+PATTERN END
+MESSAGE END
+
+MESSAGE Complex
+TO root@localhost
+BODY BEGIN
+From: gray@gnu.org
+Cc: "Alain Magloire" <alainm@gnu.org>, "Jeff Bailey" <jbailey@gnu.org>
+Bcc: bug-mailutils@gnu.org
+Subject: A complex test
+
+It works?
+BODY END
+PATTERN BEGIN
+ENVELOPE FROM: gray@gnu.org
+ENVELOPE TO: <root@localhost>,<alainm@gnu.org>,<jbailey@gnu.org>
+ 0: To: <root@localhost>,<alainm@gnu.org>,<jbailey@gnu.org>
+ 1: From: gray@gnu.org
+ 2: Cc: "Alain Magloire" <alainm@gnu.org>, "Jeff Bailey" <jbailey@gnu.org>
+ 3: Subject: A complex test
+ 4:
+ 5: It works?
+ 6:
+END OF MESSAGE
+ENVELOPE FROM: gray@gnu.org
+ENVELOPE TO: <bug-mailutils@gnu.org>
+ 0: To: <bug-mailutils@gnu.org>
+ 1: Bcc: bug-mailutils@gnu.org
+ 2: From: gray@gnu.org
+ 3: Cc: "Alain Magloire" <alainm@gnu.org>, "Jeff Bailey" <jbailey@gnu.org>
+ 4: Subject: A complex test
+ 5:
+ 6: It works?
+ 7:
+END OF MESSAGE
+PATTERN END
+MESSAGE END
+
+# End of data
diff --git a/mail.remote/testsuite/Makefile.am b/mail.remote/testsuite/Makefile.am
new file mode 100644
index 000000000..59f4e87d5
--- /dev/null
+++ b/mail.remote/testsuite/Makefile.am
@@ -0,0 +1,76 @@
+# 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
+SMTP_DEJATOOL = mail.remote
+DEJATOOL = @RUN_SMTP_DEJATOOL@
+RUNTESTFLAGS =
+CLEANFILES = *.log
+test_dirs = lib mail.remote
+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 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,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.remote/testsuite/lib/DISTFILES b/mail.remote/testsuite/lib/DISTFILES
new file mode 100644
index 000000000..c46b9858f
--- /dev/null
+++ b/mail.remote/testsuite/lib/DISTFILES
@@ -0,0 +1 @@
+mail.remote.exp
diff --git a/mail.remote/testsuite/lib/mail.remote.exp b/mail.remote/testsuite/lib/mail.remote.exp
new file mode 100644
index 000000000..d3098884d
--- /dev/null
+++ b/mail.remote/testsuite/lib/mail.remote.exp
@@ -0,0 +1,119 @@
+# -*- 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
+mu_prepare_spools
+set mu_filename "$MU_FOLDER_DIR/mta.diag"
+set env(MTA_DIAG) "$mu_filename"
+
+# mailer_remote_test [-message MESSAGE][-default (FAIL|XFAIL)]
+# [-from FROM][-to TO][-pattern PATTERN-LIST][PATTERN...]
+# PATTERN - Sequence to expect in return.
+# MESSAGE - [optional] message to output
+proc mailer_remote_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 ""
+ 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
+ }
+ }
+
+ set res [remote_spawn host "${top_builddir}/examples/mta -bd"]
+ if { $res < 0 || $res == "" } {
+ perror "Spawning mta failed."
+ return 1
+ }
+
+ remote_expect host 60 {
+ -re "\[0-9\]\[0-9\]*" {
+ set port $expect_out(buffer)
+ set url "smtp://127.0.0.1:$port"
+ verbose "URL: $url" 1
+ }
+ default {
+ perror "Spawning mta failed."
+ return 1
+ }
+ }
+
+ verbose "Spawning $MU_TOOL --mailer $url $invocation" 1
+
+ set res [remote_spawn host "$MU_TOOL --mailer $url $invocation"]
+ if { $res < 0 || $res == "" } {
+ perror "Spawning $MU_TOOL $invocation failed."
+ return 1;
+ }
+
+ if {"$message" == ""} {
+ set message [lindex $args 0]
+ }
+
+ if $verbose>2 then {
+ send_user "Message is \"$message\"\n"
+ }
+
+ set result ""
+ verbose "INPUT: $input" 1
+ for {set i 0} {$result == "" && $i < [llength $input]} {incr i} {
+ set s [lindex $input $i]
+ verbose "SEND: $s" 1
+ set result [mu_send "[lindex $input $i]\n"]
+ verbose "RESULT: $result"
+ }
+
+ mu_send ""
+
+ remote_wait host 60
+
+ return [mu_test_file -default $default -message $message -pattern $pattern $mu_filename]
+}
+
+
diff --git a/mail.remote/testsuite/mail.remote/DISTFILES b/mail.remote/testsuite/mail.remote/DISTFILES
new file mode 100644
index 000000000..6a29f1d22
--- /dev/null
+++ b/mail.remote/testsuite/mail.remote/DISTFILES
@@ -0,0 +1 @@
+send.exp
diff --git a/mail.remote/testsuite/mail.remote/send.exp b/mail.remote/testsuite/mail.remote/send.exp
new file mode 100644
index 000000000..a2cd1b8ad
--- /dev/null
+++ b/mail.remote/testsuite/mail.remote/send.exp
@@ -0,0 +1,83 @@
+# -*- 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]
+
+set state 0
+set command ""
+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"
+ }
+ mailer_remote_test -message $message -input $input -pattern $pattern -args $args
+ set state 0
+ }
+ "^MESSAGE" {
+ regexp "^MESSAGE (.*)" $line dummy message
+ set from ""
+ set to ""
+ set input [list]
+ set pattern [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 send.exp \ No newline at end of file

Return to:

Send suggestions and report system problems to the System administrator.