Commit 8d1c338f 8d1c338f4dd36424104eb28e1a6500648c9fb4b7 by Sergey Poznyakoff

Added to the repository

1 parent bb752c91
1 Makefile
2 Makefile.in
3 *.log
4 *.sum
5 site.exp
6 remote.exp
7 data
1 # This file is part of Mailutils testsuite.
2 # Copyright (C) 2002, Free Software Foundation
3 #
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software Foundation,
16 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 #
18
19 MESSAGE Simple mail
20 FROM gray@gnu.org
21 TO user
22 BODY BEGIN
23 From: gray@gnu.org
24 To: bug-mailutils@gnu.org
25 Subject: Simple mail
26
27 This is a simple mail.
28 Data goes here.
29 BODY END
30 MESSAGE END
31
32 MESSAGE Second mail
33 FROM gray@runasimi.org
34 TO user
35 BODY BEGIN
36 From: gray@runasimi.org
37 To: bug-mailutils@gnu.org
38 Subject: Simple mail
39
40 This is a simple mail.
41 Data goes here.
42 BODY END
43 MESSAGE END
44
45 # end of data
...\ No newline at end of file ...\ No newline at end of file
1 # This file is part of GNU Mailutils
2 # Copyright (C) 2000,2001,2002 Free Software Foundation
3 # See file COPYING in the distribution root directory for copying conditions.
4
5 AUTOMAKE_OPTIONS = dejagnu
6 DEJATOOL = mail.local
7 RUNTESTFLAGS =
8 CLEANFILES = *.log
9 test_dirs = lib mail.local
10 EXTRA_DIST = Data
11
12 dist-hook:
13 here=`cd $(top_builddir)/$(subdir) && pwd`; \
14 srcdir=`cd $(srcdir) && pwd`; \
15 distdir=`cd $(distdir) && pwd`; \
16 for dir in $(test_dirs); \
17 do \
18 cd $$srcdir;\
19 mkdir $$distdir/$$dir;\
20 cd $$dir;\
21 for file in DISTFILES `cat DISTFILES`; do \
22 d=$$srcdir/$$dir; \
23 if test -d $$d/$$file; then \
24 cp -pr $$d/$$file $$distdir/$$dir/$$file; \
25 else \
26 test -f $$distdir/$$dir/$$file \
27 || cp -p $$d/$$file $$distdir/$$dir/$$file || exit; \
28 fi; \
29 done;\
30 done;\
31 cd $$here
32
33 site.exp: Makefile remote.exp
34 @echo 'Making a new site.exp file...'
35 @test ! -f site.bak || rm -f site.bak
36 @echo '## these variables are automatically generated by make ##' > $@-t
37 @echo '# Do not edit here. If you wish to override these values' >> $@-t
38 @echo '# edit the last section' >> $@-t
39 @echo 'set tool $(DEJATOOL)' >> $@-t
40 @echo "set top_srcdir `cd $(top_srcdir); pwd`" >> $@-t
41 @echo "set srcdir `cd $(srcdir); pwd`" >> $@-t
42 @echo 'set objdir' `pwd` >> $@-t
43 @echo 'set host_alias "$(host_alias)"' >> $@-t
44 @echo 'set host_triplet $(host_triplet)' >> $@-t
45 @echo 'set target_alias "$(target_alias)"' >> $@-t
46 @echo 'set target_triplet $(target_triplet)' >> $@-t
47 @echo 'set build_alias "$(build_alias)"' >> $@-t
48 @echo 'set build_triplet $(build_triplet)' >> $@-t
49 @echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
50 @test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
51 @test ! -f site.exp || mv site.exp site.bak
52 @mv $@-t site.exp
53
54 remote.exp:;
55 @echo 'Making a new remote.exp file...'
56 @test ! -f remote.bak || rm -f remote.bak
57 @echo '## These variables are used to set up for the remote testing.' >> $@-t
58 @echo '## Please, read file README in this directory for instructions' >> $@-t
59 @echo '## on how to use this file' >> $@-t
60 @echo "set host_board `hostname`" >> $@-t
61 @echo 'set board_info($$host_board,connect) rlogin' >> $@-t
62 @echo 'set board_info($$host_board,shell_prompt) "\\$$ "' >> $@-t
63 @echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
64 @echo "set board_info(\$$host_board,srcdir) `cd $(srcdir); pwd`" >> $@-t
65 @echo "set board_info(\$$host_board,objdir) `pwd`" >> $@-t
66 @echo "set board_info(\$$host_board,top_srcdir) `cd $(top_srcdir); pwd`" >> $@-t
67 @echo "set board_info(\$$host_board,top_builddir) `cd $(top_builddir); pwd`" >> $@-t
68 @test ! -f remote.exp || mv remote.exp remote.bak
69 @mv $@-t remote.exp
70
71
72 DISTCLEANFILES=*.exp *.log *.sum
73
74 distclean-local:
75 -rm -rf data
1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, Free Software Foundation
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 source $top_srcdir/testsuite/lib/mailutils.exp
20
21 mu_init "--authentication generic --authorization virtdomain"
22 mu_version
23 if ![mu_check_capability ENABLE_VIRTUAL_DOMAINS] {
24 clone_output "WARNING: Support for virtual domains not compiled in"
25 clone_output "WARNING: Skipping tests for mail.local"
26 exit 0
27 }
28
29 mu_prepare_spools
30
31 set ETC_DIR "$MU_DATA_DIR/etc"
32
33 set output [remote_exec host "$MU_MAKESPOOL \
34 -subst \"s,@MU_SPOOL_DIR@,$MU_SPOOL_DIR,\" \
35 $MU_RC_DIR $ETC_DIR" ]
36 if [lindex $output 0] {
37 perror "Cannot create ETC_DIR: [lindex $output 1]"
38 exit 1
39 }
40 append MU_TOOL_FLAGS " --virtual-passwd-dir $ETC_DIR"
41
42 set mu_filename "$MU_SPOOL_DIR/INBOX"
43 set env(MTA_DIAG) "$mu_filename"
44
45 # mail_local_test [-message MESSAGE][-default (FAIL|XFAIL)]
46 # [-input INPUT-LIST]
47 # [-args ARGS][-pattern PATTERN-LIST][PATTERN...]
48 # INPUT-LIST - List of input strings for MU_TOOL
49 # PATTERN - Sequence to expect in return.
50 # MESSAGE - [optional] message to output
51 # ARGS - Additional arguments to MU_TOOL
52 proc mail_local_test { args } {
53 global MU_TOOL
54 global top_builddir
55 global verbose
56 global suppress_flag;
57 global mu_filename
58 upvar timeout timeout
59
60 set default ""
61 set message ""
62 set invocation ""
63 set input ""
64 set pattern ""
65 set invocation ""
66
67 for {set i 0} {$i < [llength $args]} {incr i} {
68 set a [lindex $args $i]
69 if {"$a" == "-default"} {
70 incr i
71 set default [lindex $args $i]
72 } elseif {"$a" == "-message"} {
73 incr i
74 set message [lindex $args $i]
75 } elseif {"$a" == "-pattern"} {
76 incr i
77 set pattern [lindex $args $i]
78 } elseif {"$a" == "-input"} {
79 incr i
80 set input [lindex $args $i]
81 } elseif {"$a" == "-args"} {
82 incr i
83 set a [lindex $args $i]
84 if {[llength $a] > 0} {
85 append invocation $a
86 }
87 } else {
88 set args [lrange $args $i end]
89 break
90 }
91 }
92
93 if {"$message" == ""} {
94 set message [lindex $args 0]
95 }
96
97 if $verbose>2 then {
98 send_user "Message is \"$message\"\n"
99 }
100
101 return [mailer_test -default $default -message $message -input $input -pattern $pattern -file $mu_filename -args $invocation]
102 }
103
104
1 # -*- tcl -*-
2 # This file is part of Mailutils testsuite.
3 # Copyright (C) 2002, Free Software Foundation
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 set chan [open ${srcdir}/Data r]
20
21 # States are:
22 # INITIAL 0
23 # MESSAGE 1
24 # BODY 2
25 # PATTERN 3
26 set state 0
27 # Current pattern. Notice that it is cumulative (i.e. it is not reset
28 # before each test) since the mailbox itself is cumulative too.
29 set pattern [list]
30 for {gets $chan line} {![eof $chan]} {gets $chan line} {
31 verbose "LINE $line" 1
32 switch -regexp -- "$line" {
33 "^#.*" { }
34 "^MESSAGE END" {
35 verbose "MAIL FROM $from" 1
36 verbose "MAIL TO $to" 1
37 verbose "INPUT $input" 1
38 verbose "PATTERN $pattern" 1
39 set args ""
40 if {$from != ""} {
41 append args " --from $from"
42 }
43 if {$to != ""} {
44 append args " ${to}@passwd"
45 }
46
47 if {$pattern == ""} {
48 set pattern [concat [list -re "From $from\[^\r\n\]*"] $input]
49 }
50 mail_local_test -message $message -input $input \
51 -pattern $pattern -args $args
52 lappend pattern ""
53 set state 0
54 }
55 "^MESSAGE" {
56 regexp "^MESSAGE (.*)" $line dummy message
57 set from ""
58 set to ""
59 set input [list]
60 set state 1
61 }
62 "^FROM" {
63 regexp "^FROM (.*)" $line dummy from
64 }
65 "^TO" {
66 regexp "^TO (.*)" $line dummy to
67 }
68 "^BODY BEGIN" {
69 set state 2
70 }
71 "^BODY END" {
72 set state 1
73 }
74 "^PATTERN BEGIN" {
75 set state 3
76 }
77 "^PATTERN END" {
78 set state 1
79 }
80 "^STOP" {
81 break
82 }
83 default {
84 if {$state == 2} {
85 lappend input $line
86 } elseif {$state == 3} {
87 lappend pattern $line
88 }
89 }
90 }
91 }
92
93 close $chan
94
95 # End of deliver.exp
96