Commit b7bac135 b7bac135f5c8b7d870d1d0edb477363f8e0339ac by Sergey Poznyakoff

Added to repository

1 parent b4cdd7ae
Makefile
Makefile.in
*.log
*.sum
site.exp
remote.exp
data
AUTOMAKE_OPTIONS = dejagnu
DEJATOOL = imap4d
RUNTESTFLAGS =
CLEANFILES = *.log
test_dirs = lib imap4d
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
anystate.exp
examine.exp
# -*- 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.
imap4d_start
imap4d_test "CAPABILITY" \
"CAPABILITY IMAP4rev1 NAMESPACE X-VERSION" \
"OK"
imap4d_test "NOOP"
imap4d_test "NAMESPACE" "BAD"
# -*- 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.
imap4d_start
imap4d_auth "user!passwd" "guessme"
set UIDVALIDITY [clock seconds]
imap4d_test "EXAMINE INBOX"\
"95 EXISTS"\
"95 RECENT"\
"OK \[UIDVALIDITY $UIDVALIDITY\] UID valididy status"\
"OK \[UIDNEXT 96\] Predicted next uid"\
"OK \[UNSEEN 1\] first unseen messsage"\
"FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)"\
"OK \[PERMANENTFLAGS ()\] No Permanent flags"\
"OK \[READ-ONLY\] EXAMINE Completed"
imap4d_test "SELECT INBOX"\
"95 EXISTS"\
"95 RECENT"\
"OK \[UIDVALIDITY $UIDVALIDITY\] UID valididy status"\
"OK \[UIDNEXT 96\] Predicted next uid"\
"OK \[UNSEEN 1\] first unseen messsage "\
"FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)"\
"OK \[PERMANENTFLAGS (\\Answered \\Deleted \\Seen)\] Permanent flags"\
"OK \[READ-WRITE\] SELECT Completed"
imap4d_test "STATUS INBOX (MESSAGES RECENT UNSEEN UIDVALIDITY UIDNEXT)" \
"STATUS INBOX (MESSAGES 95 RECENT 95 UNSEEN 95 UIDVALIDITY $UIDVALIDITY UIDNEXT 96 )" \
"OK"
imap4d_test "STATUS mbox1 (MESSAGES RECENT UNSEEN UIDNEXT)" \
"STATUS mbox1 (MESSAGES 4 RECENT 4 UNSEEN 4 UIDNEXT 5 )" \
"OK"
set U [clock seconds]
imap4d_test "EXAMINE mbox1" \
"4 EXISTS"\
"4 RECENT"\
"OK \[UIDVALIDITY $U\] UID valididy status"\
"OK \[UIDNEXT 5\] Predicted next uid"\
"OK \[UNSEEN 1\] first unseen messsage"\
"FLAGS (\\Answered \\Flagged \\Deleted \\Seen \\Draft)"\
"OK \[PERMANENTFLAGS ()\] No Permanent flags"\
"OK \[READ-ONLY\] EXAMINE Completed"
# -*- 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.
imap4d_start
imap4d_auth "user!passwd" "guessme"
imap4d_test "LIST \"~\" \"*\""\
"LIST (\\NoInferiors) \"/\" ~/mbox1"\
"LIST (\\NoInferiors) \"/\" ~/mbox"\
"LIST (\\NoInferiors) \"/\" ~/teaparty.mbox"\
"OK LIST Completed"
imap4d_test "LIST \"~\" \"%\""\
"LIST (\\NoInferiors) \"/\" ~/mbox1"\
"LIST (\\NoInferiors) \"/\" ~/mbox"\
"LIST (\\NoInferiors) \"/\" ~/teaparty.mbox"\
"OK LIST Completed"
imap4d_test "LIST \"\" \"*\""\
"LIST (\\NoInferiors) NIL INBOX"\
"LIST (\\NoInferiors) \"/\" mbox1"\
"LIST (\\NoInferiors) \"/\" mbox"\
"LIST (\\NoInferiors) \"/\" teaparty.mbox"\
"OK LIST Completed"
imap4d_test "LIST \"/\" \"*\""\
"NO LIST The requested item could not be found."
imap4d_test "LIST \"$MU_DATA_DIR\" \"*\""\
"LIST (\\NoSelect) \"/\" $MU_DATA_DIR/etc"\
"LIST (\\NoInferiors) \"/\" $MU_DATA_DIR/etc/mail.rc"\
"LIST (\\NoInferiors) \"/\" $MU_DATA_DIR/etc/passwd"\
"LIST (\\NoSelect) \"/\" $MU_DATA_DIR/spool"\
"LIST (\\NoInferiors) \"/\" $MU_DATA_DIR/spool/mbox1"\
"LIST (\\NoInferiors) \"/\" $MU_DATA_DIR/spool/mbox"\
"LIST (\\NoInferiors) \"/\" $MU_DATA_DIR/spool/teaparty.mbox"\
"LIST (\\NoSelect) \"/\" $MU_DATA_DIR/folder"\
"LIST (\\NoInferiors) \"/\" $MU_DATA_DIR/folder/one"\
"LIST (\\NoInferiors) \"/\" $MU_DATA_DIR/folder/two"\
"OK"
imap4d_test "LIST \"$MU_DATA_DIR\" \"%\""\
"LIST (\\NoSelect) \"/\" $MU_DATA_DIR/etc"\
"LIST (\\NoSelect) \"/\" $MU_DATA_DIR/spool"\
"LIST (\\NoSelect) \"/\" $MU_DATA_DIR/folder"\
"OK"
imap4d_test "LIST \"$MU_DATA_DIR/folder\" \"one\""\
"LIST (\\NoInferiors) \"/\" $MU_DATA_DIR/folder/one"\
"OK"
# Well, I doubt if this is quite OK with the RFC, but at least it does
# not contradict it. The first INBOX refers to the reserved word meaning
# "the primary mailbox for this user on this server", the second one is
# the actual filename.
imap4d_test "LIST \"\" INBOX"\
"LIST (\\NoInferiors) NIL INBOX"\
"LIST (\\NoInferiors) \"/\" INBOX"\
"OK"
# -*- 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 USE_VIRTUAL_DOMAINS] {
clone_output "WARNING: Support for virtual domains not compiled in"
clone_output "WARNING: Skipping tests for imap4d"
exit 0
}
set IMAP4D_ETC_DIR "$MU_DATA_DIR/etc"
set output [remote_exec host "$MU_MAKESPOOL \
-subst \"s,@MU_SPOOL_DIR@,$MU_SPOOL_DIR,\" \
$MU_RC_DIR $IMAP4D_ETC_DIR" ]
if [lindex $output 0] {
perror "Cannot create $IMAP4D_ETC_DIR: [lindex $output 1]"
exit 1
}
append MU_TOOL_FLAGS " --virtual-passwd-dir $IMAP4D_ETC_DIR \
--shared-namespace $MU_DATA_DIR"
set IMAP4D_TAG 0
### Only procedures should come after this point.
proc imap4d_version {} {
global MU_TOOL
global MU_TOOL_FLAGS
global MU_TOOL_VERSION
mu_version
if ![is_remote host] {
clone_output "[which $MU_TOOL] version $MU_TOOL_VERSION"
} else {
clone_output "$MU_TOOL on remote host version $MU_TOOL_VERSION"
}
}
proc default_imap4d_start {args} {
global verbose
global MU_TOOL
global MU_TOOL_FLAGS
global expect_out
mu_version
set args [lindex $args 0]
if [info exists MU_TOOL_FLAGS] {
set sw $MU_TOOL_FLAGS
} else {
set sw ""
}
if [llength $args] {
append sw $args
}
if [info exists host_board] {
if [board_info $host_board exists top_srcdir] {
append sw " --mail-spool [board_info $host_board top_srcdir]/mail/testsuite/spool"
}
}
set imap4d_cmd "$MU_TOOL $sw"
verbose "Spawning $imap4d_cmd"
set res [remote_spawn host $imap4d_cmd]
if { $res < 0 || $res == "" } {
perror "Spawning $imap4d_cmd failed."
return 1;
}
mu_expect 360 {
-re "\\* OK IMAP4rev1 Debugging mode.*\r\n" {
verbose "imap4d initialized."
}
default {
perror "imap4d not initialized"
exit 1
}
}
return 0
}
proc default_imap4d_stop {} {
verbose "Stopping imap4d"
}
proc imap4d_start {args} {
global MU_SPOOL_DIR
verbose "Starting pop3d"
set reuse_spool 0
for {set i 0} {$i < [llength $args]} {incr i} {
set a [lindex $args $i]
if {"$a" == "-reuse-spool"} {
set reuse_spool 1
} else {
break;
}
}
if {$reuse_spool == 0} {
mu_prepare_spools
set output [remote_exec host \
"cp $MU_SPOOL_DIR/teaparty.mbox $MU_SPOOL_DIR/INBOX"]
if [lindex $output 0] {
perror "Cannot create $MU_SPOOL_DIR/INBOX: [lindex $output 1]"
exit 1
}
}
return [default_imap4d_start [concat [lrange $args $i end]]]
}
proc imap4d_stop {} {
return [default_imap4d_stop];
}
##
proc imap4d_make_command { string } {
global IMAP4D_TAG
incr IMAP4D_TAG
return "$IMAP4D_TAG $string"
}
proc imap4d_send { string } {
return [mu_send "$string"]
}
proc imap4d_command { cmd } {
return [mu_command [imap4d_make_command $cmd]]
}
proc imap4d_exit {} {
if [imap4d_test "LOGOUT"\
"BYE Session terminating." \
"OK LOGOUT Completed"] {
perror "LOGOUT failed"
exit 1
}
return 0
}
proc imap4d_auth {args} {
set user [lindex $args 0]
set pass [lindex $args 1]
if [imap4d_test "LOGIN $user $pass"] {
perror "Failed to authorize."
exit 1
}
}
# imap4d_test [-message MESSAGE][-default (FAIL|XFAIL)]
# COMMAND [UNTAGGED...][TAGGED]
# COMMAND - Command to send.
# UNTAGGED - A list of untagged responses to expect in return.
# TAGGED - A tagged response to expect in return. Defaults to "OK"
# MESSAGE - [optional] message to output
proc imap4d_test { args } {
global verbose
global suppress_flag;
global IMAP4D_TAG
upvar timeout timeout
set default ""
set message ""
for {set i 0} {$i < [llength $args]} {incr i} {
set a [lindex $args $i]
if {"$a" == "-default"} {
set default [lindex $args [expr $i + 1]]
incr i
} elseif {"$a" == "-message"} {
set message [lindex $args [expr $i + 1]]
incr i
} 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"
}
set command [imap4d_make_command [lindex $args 0]]
set pattern [list]
set len [expr [llength $args] - 1]
if {$len >= 2} {
for {set i 1} {$i <= [expr $len - 1]} {incr i} {
set pattern [concat $pattern [list "* [lindex $args $i]"]]
}
set tagged [lindex $args end]
} elseif {$len == 1} {
set tagged [lindex $args end]
} else {
set tagged "OK"
}
set pattern [concat $pattern [list "$IMAP4D_TAG $tagged"]]
set result [mu_test $command $pattern]
if {$result == 0} {
pass "$message"
} elseif {$result == 1} {
if { "$default" == "" || "$default" != "FAIL" } {
fail "$message"
} else {
xfail "$message"
set result 0
}
} elseif {$result == -2} {
fail "$message (timeout)"
} elseif {$result == -3} {
fail "$message (eof)"
} else {
fail "$message"
}
return $result
}
Makefile
Makefile.in