aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Elliston <bje@gnu.org>2018-12-06 18:05:05 +1100
committerBen Elliston <bje@gnu.org>2018-12-06 18:05:05 +1100
commitd439887f64b9c7c146d9a9062b459d08c43f2a12 (patch)
tree2a2921cdef799eb805e6ec027ed258bbf72deec3 /lib
parenta8e4dbd2a65255a1470962994b2888fc8ee3b9bc (diff)
downloaddejagnu-d439887f64b9c7c146d9a9062b459d08c43f2a12.zip
dejagnu-d439887f64b9c7c146d9a9062b459d08c43f2a12.tar.gz
dejagnu-d439887f64b9c7c146d9a9062b459d08c43f2a12.tar.bz2
* runtest.exp: Replace [string match] commands involving literal
strings and variables known to not be Tcl glob patterns with eq and ne. * config/unix.exp: Likewise. * lib/debugger.exp: Likewise. * lib/dg.exp: Likewise. * lib/framework.exp: Likewise. * lib/remote.exp: Likewise. * lib/utils.exp: Likewise. * baseboards/androideabi.exp: Likewise. * baseboards/multi-sim.exp: Likewise. * testsuite/lib/util-defs.exp: Likewise. * testsuite/runtest.all/config.test: Likewise.
Diffstat (limited to 'lib')
-rw-r--r--lib/debugger.exp4
-rw-r--r--lib/dg.exp8
-rw-r--r--lib/framework.exp11
-rw-r--r--lib/remote.exp2
-rw-r--r--lib/utils.exp6
5 files changed, 14 insertions, 17 deletions
diff --git a/lib/debugger.exp b/lib/debugger.exp
index 8831251..abcbb2d 100644
--- a/lib/debugger.exp
+++ b/lib/debugger.exp
@@ -63,13 +63,13 @@ proc dumpwatch { args } {
set tmp ""
if { [catch "uplevel 1 array name $i" names] } {
set tmp [uplevel 1 trace vinfo $i]
- if {![string match "" $tmp]} {
+ if {$tmp ne ""} {
puts "$i $tmp"
}
} else {
foreach k $names {
set tmp [uplevel 1 trace vinfo [set i]($k)]
- if {![string match "" $tmp]} {
+ if {$tmp ne ""} {
puts "[set i]($k) = $tmp"
}
}
diff --git a/lib/dg.exp b/lib/dg.exp
index 23f9512..eacbe45 100644
--- a/lib/dg.exp
+++ b/lib/dg.exp
@@ -186,7 +186,7 @@ proc dg-get-options { prog } {
set result ""
set tmp [grep $prog "{\[ \t\]\+dg-\[-a-z\]\+\[ \t\]\+.*\[ \t\]\+}" line]
- if {![string match "" $tmp]} {
+ if {$tmp ne ""} {
foreach i $tmp {
regexp "(\[0-9\]+)\[ \t\]+{\[ \t\]+(dg-\[-a-z\]+)\[ \t\]+(.*)\[ \t\]+}\[^\}\]*(\n|$)" $i i line cmd args
append result " { $cmd $line $args }"
@@ -783,7 +783,7 @@ proc dg-test { args } {
if {${dg-excess-errors-flag}} {
setup_xfail "*-*-*"
}
- if {![string match "" $comp_output]} {
+ if {$comp_output ne ""} {
fail "$name (test for excess errors)"
send_log "Excess errors:\n$comp_output\n"
} else {
@@ -842,7 +842,7 @@ proc dg-test { args } {
# of the program can be delayed until here. Ditto for other situations.
# It would be a bit cumbersome though.
- if {![string match ${dg-final-code} ""]} {
+ if {${dg-final-code} ne ""} {
regsub -all "\\\\(\[{}\])" ${dg-final-code} "\\1" dg-final-code
# Note that the use of `args' here makes this a varargs proc.
proc dg-final-proc { args } ${dg-final-code}
@@ -879,7 +879,7 @@ proc dg-finish { } {
# There may be a bit of duplication (eg: resetting prms_id), leave it.
# Let's keep these procs robust.
global tool
- if {![string match "" [info procs ${tool}_finish]]} {
+ if {[info procs ${tool}_finish] ne ""} {
${tool}_finish
}
}
diff --git a/lib/framework.exp b/lib/framework.exp
index a635a03..fa0c0b0 100644
--- a/lib/framework.exp
+++ b/lib/framework.exp
@@ -103,7 +103,7 @@ proc isbuild { { pattern "" } } {
if {![info exists build_triplet]} {
set build_triplet ${host_triplet}
}
- if {[string match "" $pattern]} {
+ if {$pattern eq ""} {
return $build_triplet
}
verbose "Checking pattern \"$pattern\" with $build_triplet" 2
@@ -198,7 +198,7 @@ proc is3way {} {
proc ishost { { pattern "" } } {
global host_triplet
- if {[string match "" $pattern]} {
+ if {$pattern eq ""} {
return $host_triplet
}
verbose "Checking pattern \"$pattern\" with $host_triplet" 2
@@ -219,7 +219,7 @@ proc istarget { { args "" } } {
global target_triplet
# if no arg, return the config string
- if {[string match "" $args]} {
+ if {$args eq ""} {
if {[info exists target_triplet]} {
return $target_triplet
} else {
@@ -248,10 +248,7 @@ proc isnative { } {
global target_triplet
global build_triplet
- if {[string match $build_triplet $target_triplet]} {
- return 1
- }
- return 0
+ return [string equal $build_triplet $target_triplet]
}
# unknown -- called by expect if a proc is called that doesn't exist
diff --git a/lib/remote.exp b/lib/remote.exp
index 3761a7d..389f895 100644
--- a/lib/remote.exp
+++ b/lib/remote.exp
@@ -1107,7 +1107,7 @@ proc standard_load { dest prog args } {
set status [lindex $status 0]
verbose -log "Executed $prog, status $status" 2
- if {![string match "" $output]} {
+ if {$output ne ''} {
verbose -log -- "$output" 2
}
if { $status == 0 } {
diff --git a/lib/utils.exp b/lib/utils.exp
index eb9865a..80c4951 100644
--- a/lib/utils.exp
+++ b/lib/utils.exp
@@ -231,7 +231,7 @@ proc grep { args } {
while { [gets $fd cur_line]>=0 } {
incr i
if {[regexp -- "$pattern" $cur_line match]} {
- if {![string match "" $options]} {
+ if {$options ne ""} {
foreach opt $options {
switch -- $opt {
"line" {
@@ -285,7 +285,7 @@ proc prune { lst pattern } {
# Eg: RUNTESTFLAGS="bar.exp=foo1.c foo2.c foo3*.c bar/baz*.c"
#
proc runtest_file_p { runtests testcase } {
- if {[string length [lindex $runtests 1]]} {
+ if {[lindex $runtests 1] ne ""} {
foreach ptn [lindex $runtests 1] {
if {[string match "*/$ptn" $testcase]} {
return 1
@@ -352,7 +352,7 @@ proc diff { file_1 file_2 } {
set line_a [lindex ${list_a} ${i}]
set line_b [lindex ${list_b} ${i}]
- if {[string compare ${line_a} ${line_b}]} {
+ if {$line_a eq $line_b} {
verbose -log "line #${i}" 2
verbose -log "\< ${line_a}" 2
verbose -log "\> ${line_b}" 2