65 |
|
|
66 |
set args [lindex $args 0] |
set args [lindex $args 0] |
67 |
if [info exists MU_TOOL_FLAGS] { |
if [info exists MU_TOOL_FLAGS] { |
68 |
set sw $MU_TOOL_FLAGS |
set sw "$MU_TOOL_FLAGS " |
69 |
} else { |
} else { |
70 |
set sw "" |
set sw "" |
71 |
} |
} |
110 |
proc imap4d_start {args} { |
proc imap4d_start {args} { |
111 |
global MU_SPOOL_DIR |
global MU_SPOOL_DIR |
112 |
|
|
113 |
verbose "Starting pop3d" |
verbose "Starting imap4d" |
114 |
|
|
115 |
set reuse_spool 0 |
set reuse_spool 0 |
116 |
for {set i 0} {$i < [llength $args]} {incr i} { |
for {set i 0} {$i < [llength $args]} {incr i} { |
179 |
} |
} |
180 |
} |
} |
181 |
|
|
182 |
# imap4d_test [-message MESSAGE][-default (FAIL|XFAIL)] |
# imap4d_test [-message MESSAGE][-default (FAIL|XFAIL)][-long][-silent] |
183 |
# COMMAND [UNTAGGED...][TAGGED] |
# COMMAND [UNTAGGED...][TAGGED] |
184 |
# COMMAND - Command to send. |
# COMMAND - Command to send. |
185 |
# UNTAGGED - A list of untagged responses to expect in return. |
# UNTAGGED - A list of untagged responses to expect in return. |
186 |
# TAGGED - A tagged response to expect in return. Defaults to "OK" |
# TAGGED - A tagged response to expect in return. Defaults to "OK" |
187 |
# MESSAGE - [optional] message to output |
# MESSAGE - [optional] message to output |
188 |
proc imap4d_test { args } { |
proc imap4d_test {args} { |
|
global verbose |
|
|
global suppress_flag; |
|
189 |
global IMAP4D_TAG |
global IMAP4D_TAG |
190 |
upvar timeout timeout |
global verbose |
191 |
|
|
192 |
set default "" |
set default "" |
193 |
set message "" |
set message "" |
194 |
|
set long 0 |
195 |
|
set silent 0 |
196 |
for {set i 0} {$i < [llength $args]} {incr i} { |
for {set i 0} {$i < [llength $args]} {incr i} { |
197 |
set a [lindex $args $i] |
set a [lindex $args $i] |
198 |
if {"$a" == "-default"} { |
if {"$a" == "-default"} { |
201 |
} elseif {"$a" == "-message"} { |
} elseif {"$a" == "-message"} { |
202 |
set message [lindex $args [expr $i + 1]] |
set message [lindex $args [expr $i + 1]] |
203 |
incr i |
incr i |
204 |
|
} elseif {"$a" == "-long"} { |
205 |
|
set long 1 |
206 |
|
} elseif {"$a" == "-silent"} { |
207 |
|
set silent 1 |
208 |
} else { |
} else { |
209 |
set args [lrange $args $i end] |
set args [lrange $args $i end] |
210 |
break |
break |
219 |
send_user "Message is \"$message\"\n" |
send_user "Message is \"$message\"\n" |
220 |
} |
} |
221 |
|
|
222 |
set command [imap4d_make_command [lindex $args 0]] |
set command [lindex $args 0] |
223 |
|
if {$long} { |
224 |
|
set command_data [lindex $args 1] |
225 |
|
set args [lrange $args 1 end] |
226 |
|
} |
227 |
|
|
228 |
set pattern [list] |
set pattern [list] |
229 |
set len [expr [llength $args] - 1] |
set len [expr [llength $args] - 1] |
230 |
|
|
259 |
set tagged "OK" |
set tagged "OK" |
260 |
} |
} |
261 |
|
|
262 |
set pattern [concat $pattern [list "$IMAP4D_TAG $tagged"]] |
if {$long} { |
263 |
set result [mu_test $command $pattern] |
set command "$command {[string length $command_data]}" |
264 |
|
imap4d_command $command |
265 |
if {$result == 0} { |
set pattern [concat $pattern [list "$IMAP4D_TAG $tagged"]] |
266 |
pass "$message" |
|
267 |
} elseif {$result == 1} { |
mu_expect 360 { |
268 |
if { "$default" == "" || "$default" != "FAIL" } { |
-re "^\\+ GO AHEAD.*$" { } |
269 |
fail "$message" |
default { |
270 |
} else { |
perror "imap4d_long_test failed" |
271 |
xfail "$message" |
return 1 |
272 |
set result 0 |
} |
273 |
} |
} |
274 |
} elseif {$result == -2} { |
|
275 |
fail "$message (timeout)" |
verbose "Sending $command_data" 3 |
276 |
} elseif {$result == -3} { |
mu_send $command_data |
277 |
fail "$message (eof)" |
|
278 |
|
set s [split $command_data "\n"] |
279 |
|
set s [lrange $s 0 [expr [llength $s] - 2]] |
280 |
|
set result [mu_expect_list 360 [concat $s $pattern]] |
281 |
} else { |
} else { |
282 |
fail "$message" |
set command [imap4d_make_command $command] |
283 |
|
set pattern [concat $pattern [list "$IMAP4D_TAG $tagged"]] |
284 |
|
set result [mu_test $command $pattern] |
285 |
|
} |
286 |
|
|
287 |
|
if {!$silent} { |
288 |
|
if {$result == 0} { |
289 |
|
pass "$message" |
290 |
|
} elseif {$result == 1} { |
291 |
|
if { "$default" == "" || "$default" != "FAIL" } { |
292 |
|
fail "$message" |
293 |
|
} else { |
294 |
|
xfail "$message" |
295 |
|
set result 0 |
296 |
|
} |
297 |
|
} elseif {$result == -2} { |
298 |
|
fail "$message (timeout)" |
299 |
|
} elseif {$result == -3} { |
300 |
|
fail "$message (eof)" |
301 |
|
} else { |
302 |
|
fail "$message" |
303 |
|
} |
304 |
} |
} |
305 |
return $result |
return $result |
306 |
} |
} |
307 |
|
|
308 |
|
|