Commit 816bb944 816bb94466d15ce8b726deeea1d1b7050310bfef by Sergey Poznyakoff

(mu_exec): added -arg-list option.

1 parent a11cb59d
...@@ -116,7 +116,7 @@ proc mu_start {args} { ...@@ -116,7 +116,7 @@ proc mu_start {args} {
116 } 116 }
117 117
118 # mu_exec [-retcode N][-message S][-default (FAIL | XFAIL)][-arg S...] 118 # mu_exec [-retcode N][-message S][-default (FAIL | XFAIL)][-arg S...]
119 # [PATTERN...] 119 # [-pattern PATTERN-LIST][PATTERN...]
120 # 120 #
121 # Executes $MU_TOOL and checks whether it returns with the given exit status 121 # Executes $MU_TOOL and checks whether it returns with the given exit status
122 # and its output matches supplied PATTERN. 122 # and its output matches supplied PATTERN.
...@@ -158,12 +158,25 @@ proc mu_exec {args} { ...@@ -158,12 +158,25 @@ proc mu_exec {args} {
158 } elseif {"$opt" == "-arg"} { 158 } elseif {"$opt" == "-arg"} {
159 append sw " [lindex $args [expr $i + 1]]" 159 append sw " [lindex $args [expr $i + 1]]"
160 incr i 160 incr i
161 } elseif {"$opt" == "-arg-list"} {
162 incr i
163 set s [lindex $args $i]
164 for {set j 0} {$j < [llength $s]} {incr j} {
165 append sw " [lindex $s $j]"
166 }
167 } elseif {"$opt" == "-pattern"} {
168 set pattern [lindex $args [expr $i + 1]]
169 incr i
161 } else { 170 } else {
162 break 171 break
163 } 172 }
164 } 173 }
165 174
175 if [info exists pattern] {
176 set args [concat $pattern [lrange $args $i end]]
177 } else {
166 set args [lrange $args $i end] 178 set args [lrange $args $i end]
179 }
167 180
168 if [info exists host_board] { 181 if [info exists host_board] {
169 if [board_info $host_board exists top_srcdir] { 182 if [board_info $host_board exists top_srcdir] {
...@@ -528,7 +541,7 @@ proc mu_test { args } { ...@@ -528,7 +541,7 @@ proc mu_test { args } {
528 } 541 }
529 542
530 set result 0 543 set result 0
531 for {set i 0} {$i < [llength $pattern]} {incr i} { 544 for {set i 0} {$result == 0 && $i < [llength $pattern]} {incr i} {
532 set regexp 0 545 set regexp 0
533 switch -regexp -- "[lindex ${pattern} $i]" { 546 switch -regexp -- "[lindex ${pattern} $i]" {
534 ^-re.*$ { set regexp 1; incr i } 547 ^-re.*$ { set regexp 1; incr i }
...@@ -578,6 +591,7 @@ proc mu_test { args } { ...@@ -578,6 +591,7 @@ proc mu_test { args } {
578 break 591 break
579 } 592 }
580 } 593 }
594 verbose "RES: $result"
581 if {$result == 0} { 595 if {$result == 0} {
582 mu_expect $tmt { 596 mu_expect $tmt {
583 -re "\[ \t]*\r\n" { } 597 -re "\[ \t]*\r\n" { }
......