/[mailutils]/mailutils/testsuite/lib/mailutils.exp
ViewVC logotype

Diff of /mailutils/testsuite/lib/mailutils.exp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by gray, Tue Aug 20 20:23:43 2002 UTC revision 1.2 by gray, Wed Aug 21 15:27:44 2002 UTC
# Line 18  Line 18 
18    
19  verbose "STARTED" 1  verbose "STARTED" 1
20    
21  proc mu_init {} {  proc mu_init {args} {
22      global TOOL_EXECUTABLE      global TOOL_EXECUTABLE
23      global MU_TOOL      global MU_TOOL
24      global MU_SPOOL_SOURCE      global MU_SPOOL_SOURCE
# Line 27  proc mu_init {} { Line 27  proc mu_init {} {
27      global MU_FOLDER_DIR      global MU_FOLDER_DIR
28      global MU_RC_DIR      global MU_RC_DIR
29      global MU_MAKESPOOL      global MU_MAKESPOOL
30      global TOOL_NAME      global tool
31      global MU_TOOL_ARGS      global MU_TOOL_FLAGS
32        global MU_DATA_DIR
33      global base_dir      global base_dir
34      global top_srcdir      global top_srcdir
35      global objdir      global objdir
# Line 40  proc mu_init {} { Line 41  proc mu_init {} {
41    
42      if ![info exists MU_TOOL] {      if ![info exists MU_TOOL] {
43          if ![is_remote host] {          if ![is_remote host] {
44              set MU_TOOL [findfile $base_dir/../$TOOL_NAME "$base_dir/../$TOOL_NAME" [transform $TOOL_NAME]]              set MU_TOOL [findfile $base_dir/../$tool "$base_dir/../$tool" [transform $tool]]
45              set MU_SPOOL_SOURCE "$top_srcdir/testsuite/spool"              set MU_SPOOL_SOURCE "$top_srcdir/testsuite/spool"
46              set MU_FOLDER_SOURCE "$top_srcdir/testsuite/folder"              set MU_FOLDER_SOURCE "$top_srcdir/testsuite/folder"
47              set MU_SPOOL_DIR "$objdir/data/spool"              set MU_DATA_DIR "$objdir/data"
             set MU_FOLDER_DIR "$objdir/data/folder"  
48              set MU_RC_DIR "$top_srcdir/testsuite/etc"              set MU_RC_DIR "$top_srcdir/testsuite/etc"
49              set MU_MAKESPOOL "$top_srcdir/testsuite/makespool"              set MU_MAKESPOOL "$top_srcdir/testsuite/makespool"
50          } else {          } else {
51              if [info exists host_board] {              if [info exists host_board] {
52                  if [board_info $host_board exists top_builddir] {                  if [board_info $host_board exists top_builddir] {
53                      append MU_TOOL "[board_info $host_board top_builddir]/$TOOL_NAME/$TOOL_NAME"                      append MU_TOOL "[board_info $host_board top_builddir]/$tool/$tool"
54                  } elseif [board_info $host_board exists top_srcdir] {                  } elseif [board_info $host_board exists top_srcdir] {
55                      append MU_TOOL "[board_info $host_board top_srcdir]/$TOOL_NAME/$TOOL_NAME"                      append MU_TOOL "[board_info $host_board top_srcdir]/$tool/$tool"
56                  }                  }
57              }              }
58    
59              if ![info exists MU_TOOL] {              if ![info exists MU_TOOL] {
60                  perror "The test suite is not set up for the remote testing"                  perror "The test suite is not set up for the remote testing"
61                  perror "Please, read file README in $TOOL_NAME/testsuite subdirectory"                  perror "Please, read file README in $tool/testsuite subdirectory"
62                  perror "for instructions on how to set up it."                  perror "for instructions on how to set up it."
63                  exit 1                  exit 1
64              }              }
65              set MU_RC_DIR "[board_info $host_board top_srcdir]/etc"              set MU_RC_DIR "[board_info $host_board top_srcdir]/testsuite/etc"
66              set MU_SPOOL_SOURCE "[board_info $host_board top_srcdir]/spool"              set MU_SPOOL_SOURCE "[board_info $host_board top_srcdir]/spool"
67              set MU_FOLDER_SOURCE "[board_info $host_board top_srcdir]/folder"              set MU_FOLDER_SOURCE "[board_info $host_board top_srcdir]/folder"
68              set MU_SPOOL_DIR "[board_info $host_board objdir]/data/spool"              set MU_DATA_DIR "[board_info $host_board objdir]/data"
69              set MU_FOLDER_DIR "[board_info $host_board objdir]/data/folder"              set MU_MAKESPOOL "[board_info $host_board top_srcdir]/testsuite/makespool"
70              set MU_MAKESPOOL "[board_info $host_board top_srcdir]/makespool"          }
71    
72            set MU_SPOOL_DIR "$MU_DATA_DIR/spool"
73            set MU_FOLDER_DIR "$MU_DATA_DIR/folder"
74            set MU_TOOL_FLAGS "--mail-spool $MU_SPOOL_DIR"
75            for {set i 0} {$i < [llength $args]} {incr i} {
76                append MU_TOOL_FLAGS " [lindex $args $i]"
77          }          }
78      }      }
79  }  }
# Line 103  proc mu_version {} { Line 109  proc mu_version {} {
109      global MU_TOOL      global MU_TOOL
110      global MU_TOOL_FLAGS      global MU_TOOL_FLAGS
111      global MU_TOOL_VERSION      global MU_TOOL_VERSION
112        global MU_CAPABILITY
113        
114      if [info exists MU_TOOL_VERSION] {      if [info exists MU_TOOL_VERSION] {
115          return          return
116      }      }
117            
118      set output [remote_exec host "$MU_TOOL --version"]      set output [remote_exec host "$MU_TOOL --show-config-options"]
119      regexp " \[0-9\]\[^ \t\n\r\]+" "$output" MU_TOOL_VERSION      set flg [split [lindex $output 1]]          
120        for {set i 0} {$i < [llength $flg]} {incr i} {
121            if [regexp "(.*)=(.*)" [lindex $flg $i] var name value] {
122                set MU_CAPABILITY($name) $value
123            } else {
124                set MU_CAPABILITY([lindex $flg $i]) 1
125            }
126        }
127        set MU_TOOL_VERSION $MU_CAPABILITY(VERSION)
128    }
129    
130    proc mu_check_capability {args} {
131        global MU_CAPABILITY
132        
133        set name [lindex $args 0]
134        if ![info exists MU_CAPABILITY($name)] {
135            return 0
136        } else {
137            return $MU_CAPABILITY($name)
138        }
139  }  }
140    
141  ##  ##
# Line 263  proc mu_test { args } { Line 289  proc mu_test { args } {
289      for {set i 0} {$i < [llength $pattern]} {incr i} {      for {set i 0} {$i < [llength $pattern]} {incr i} {
290          regsub "\[ \t\]*$" [lindex ${pattern} $i] "" pat          regsub "\[ \t\]*$" [lindex ${pattern} $i] "" pat
291          verbose "i=$i, pat=$pat" 2          verbose "i=$i, pat=$pat" 2
         mu_expect $tmt {  
             -ex "$pat" {  
                 if { $expect_out(buffer) != $expect_out(0,string) } {  
                     verbose "Got \"$expect_out(buffer)\"" 2  
                     verbose "instead of expected \"$pat\\r\\n\"" 2  
                     set result 1  
                     break  
                 }  
                 mu_expect $tmt {  
                     -re "\[ \t]*\r\n" { }  
                     default {  
                         set result 1  
                         break  
                     }  
                     timeout {  
                         set result -2  
                         break  
                     }  
                     eof {  
                         set result -3  
                         break  
                     }  
                 }  
             }  
             default {  
                 set result 1  
                 break  
             }  
             timeout {  
                 set result -2  
                 break  
             }  
             eof {  
                 set result -3  
                 break  
             }  
         }  
     }  
292    
293            if [regexp -- "-re.*$" $pat] {
294               verbose "REGEX for $pat / [llength $pat] " 3
295               mu_expect $tmt {
296                   $pat { }
297                   default {
298                       set result 1
299                       break
300                   }
301                   timeout {
302                       set result -2
303                       break
304                   }
305                   eof {
306                       set result -3
307                       break
308                   }
309               }
310           } else {
311               mu_expect $tmt {
312                   -ex "$pat" {
313                       if { $expect_out(buffer) != $expect_out(0,string) } {
314                           verbose "Got \"$expect_out(buffer)\"" 2
315                           verbose "instead of expected \"$pat\\r\\n\"" 2
316                           set result 1
317                           break
318                       }
319                       mu_expect $tmt {
320                           -re "\[ \t]*\r\n" { }
321                           default {
322                               set result 1
323                               break
324                           }
325                           timeout {
326                               set result -2
327                               break
328                           }
329                           eof {
330                               set result -3
331                               break
332                           }
333                       }
334                   }
335                   default {
336                       set result 1
337                       break
338                   }
339                   timeout {
340                       set result -2
341                       break
342                   }
343                   eof {
344                       set result -3
345                       break
346                   }
347               }
348           }
349        }
350      return $result      return $result
351  }  }
352    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26