Be more stringent in testing.
Showing
1 changed file
with
21 additions
and
4 deletions
... | @@ -124,6 +124,7 @@ verbose "MAILRC is $srcdir/etc/mail.rc" 2 | ... | @@ -124,6 +124,7 @@ verbose "MAILRC is $srcdir/etc/mail.rc" 2 |
124 | return 1 | 124 | return 1 |
125 | } | 125 | } |
126 | } | 126 | } |
127 | mail_send "#\n" | ||
127 | return 0 | 128 | return 0 |
128 | } | 129 | } |
129 | 130 | ||
... | @@ -153,6 +154,14 @@ proc mail_send { string } { | ... | @@ -153,6 +154,14 @@ proc mail_send { string } { |
153 | } | 154 | } |
154 | 155 | ||
155 | proc mail_command { cmd } { | 156 | proc mail_command { cmd } { |
157 | global mail_prompt | ||
158 | mail_expect 30 { | ||
159 | -re "\[\r\n\]?${mail_prompt}$" {} | ||
160 | default { | ||
161 | perror "mail not initialized" | ||
162 | return 1 | ||
163 | } | ||
164 | } | ||
156 | set res [mail_send "$cmd\n"] | 165 | set res [mail_send "$cmd\n"] |
157 | mail_expect 30 { | 166 | mail_expect 30 { |
158 | -ex "${cmd}\r\n" { } | 167 | -ex "${cmd}\r\n" { } |
... | @@ -208,6 +217,7 @@ proc mail_expect { args } { | ... | @@ -208,6 +217,7 @@ proc mail_expect { args } { |
208 | } | 217 | } |
209 | } | 218 | } |
210 | } | 219 | } |
220 | |||
211 | global suppress_flag; | 221 | global suppress_flag; |
212 | global remote_suppress_flag; | 222 | global remote_suppress_flag; |
213 | global verbose | 223 | global verbose |
... | @@ -220,10 +230,10 @@ proc mail_expect { args } { | ... | @@ -220,10 +230,10 @@ proc mail_expect { args } { |
220 | } | 230 | } |
221 | } | 231 | } |
222 | 232 | ||
223 | verbose "RUNNING remote_expect host $gtimeout $notransfer" 2 | 233 | verbose "RUNNING remote_expect host $gtimeout $notransfer $expcode" 2 |
224 | 234 | ||
225 | set code [catch \ | 235 | set code [catch \ |
226 | {uplevel remote_expect host "$gtimeout $notransfer" $expcode} string]; | 236 | {uplevel remote_expect host $gtimeout $notransfer $expcode} string]; |
227 | if [info exists old_val] { | 237 | if [info exists old_val] { |
228 | set remote_suppress_flag $old_val; | 238 | set remote_suppress_flag $old_val; |
229 | } else { | 239 | } else { |
... | @@ -296,9 +306,16 @@ proc default_mail_test { args } { | ... | @@ -296,9 +306,16 @@ proc default_mail_test { args } { |
296 | set result 0 | 306 | set result 0 |
297 | for {set i 0} {$i < [llength $pattern]} {incr i} { | 307 | for {set i 0} {$i < [llength $pattern]} {incr i} { |
298 | verbose "i=$i, pat=[lindex ${pattern} $i]" 2 | 308 | verbose "i=$i, pat=[lindex ${pattern} $i]" 2 |
309 | set pat [lindex ${pattern} $i] | ||
299 | mail_expect $tmt { | 310 | mail_expect $tmt { |
300 | -ex "[lindex ${pattern} $i]" { } | 311 | -ex "$pat\r\n" { |
301 | -ex "[lindex ${pattern} $i]\r\n" { } | 312 | if { $expect_out(buffer) != $expect_out(0,string) } { |
313 | verbose "Got \"$expect_out(buffer)\"" 2 | ||
314 | verbose "instead of expected \"$pat\\r\\n\"" 2 | ||
315 | set result 1 | ||
316 | break | ||
317 | } | ||
318 | } | ||
302 | default { | 319 | default { |
303 | set result 1 | 320 | set result 1 |
304 | break | 321 | break | ... | ... |
-
Please register or sign in to post a comment