diff options
-rw-r--r-- | ChangeLog | 16 | ||||
-rw-r--r-- | baseboards/androideabi.exp | 2 | ||||
-rw-r--r-- | baseboards/multi-sim.exp | 10 | ||||
-rw-r--r-- | config/unix.exp | 2 | ||||
-rw-r--r-- | lib/debugger.exp | 4 | ||||
-rw-r--r-- | lib/dg.exp | 8 | ||||
-rw-r--r-- | lib/framework.exp | 11 | ||||
-rw-r--r-- | lib/remote.exp | 2 | ||||
-rw-r--r-- | lib/utils.exp | 6 | ||||
-rw-r--r-- | runtest.exp | 4 | ||||
-rw-r--r-- | testsuite/lib/util-defs.exp | 4 | ||||
-rw-r--r-- | testsuite/runtest.all/config.test | 6 |
12 files changed, 44 insertions, 31 deletions
@@ -1,3 +1,19 @@ +2018-12-06 Ben Elliston <bje@gnu.org> + + * 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. + 2018-12-06 Jacob Bachmeyer <jcb62281@gmail.com> * testsuite/runtest.all/utils.test: Add Tcl mode marker for Emacs. diff --git a/baseboards/androideabi.exp b/baseboards/androideabi.exp index 950a2fb..dfc25db 100644 --- a/baseboards/androideabi.exp +++ b/baseboards/androideabi.exp @@ -101,7 +101,7 @@ proc adb_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/baseboards/multi-sim.exp b/baseboards/multi-sim.exp index ede174f..97801f7 100644 --- a/baseboards/multi-sim.exp +++ b/baseboards/multi-sim.exp @@ -78,23 +78,23 @@ proc rpath_flags { args } { # libraries, if testing a built but not installed compiler it will not # find libraries like libstdc++.so or libgfortran.so so we add the # extra hack/search so it can work. - if {[string match "." $rpathdir]} { - if {[string match $i "libstdc++.so"]} { + if {$rpathdir eq "."} { + if {$i eq "libstdc++.so"} { if {[file exists "$gccpath/libstdc++-v3/src/.libs/libstdc++.so"]} { set rpathflags "$rpathflags -Wl,-rpath=$gccpath/libstdc++-v3/src/.libs" } } - if {[string match $i "libgfortran.so"]} { + if {$i eq "libgfortran.so"} { if {[file exists "$gccpath/libgfortran/.libs/libgfortran.so"]} { set rpathflags "$rpathflags -Wl,-rpath=$gccpath/libgfortran/.libs" } } - if {[string match $i "libatomic.so"]} { + if {$i eq "libatomic.so"} { if {[file exists "$gccpath/libatomic/.libs/libatomic.so"]} { set rpathflags "$rpathflags -Wl,-rpath=$gccpath/libatomic/.libs" } } - if {[string match $i "libgomp.so"]} { + if {$i eq "libgomp.so"} { if {[file exists "$gccpath/libgomp/.libs/libgomp.so"]} { set rpathflags "$rpathflags -Wl,-rpath=$gccpath/libgomp/.libs" } diff --git a/config/unix.exp b/config/unix.exp index 2a3432b..893d514 100644 --- a/config/unix.exp +++ b/config/unix.exp @@ -133,7 +133,7 @@ proc unix_load { dest prog args } { setenv SHLIB_PATH $orig_ld_library_path verbose "Executed $prog, status $status" 2 - if {![string match "" $output]} { + if {$output ne ""} { verbose -- "$output" 2 } if { $status == 0 } { 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" } } @@ -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 diff --git a/runtest.exp b/runtest.exp index 4657bd7..1fa36fe 100644 --- a/runtest.exp +++ b/runtest.exp @@ -1727,8 +1727,8 @@ foreach current_target $target_list { set temp_top_dirs "" set prev_dir "" foreach dir "${test_top_dirs}" { - if { [string length ${prev_dir}] == 0 || - [string first "${prev_dir}/" ${dir}] == -1} { + if {$prev_dir eq "" || \ + [string first "${prev_dir}/" ${dir}] == -1} { # the first top dir entry, or an entry that # does not share the previous entry's entire # pathname, record it as a valid top dir entry. diff --git a/testsuite/lib/util-defs.exp b/testsuite/lib/util-defs.exp index 834a14a..a22f268 100644 --- a/testsuite/lib/util-defs.exp +++ b/testsuite/lib/util-defs.exp @@ -46,7 +46,7 @@ proc util_test { args } { verbose "The pattern to match is \"$pattern\"" 2 if [info exists file] { - if ![string match "" $file] { + if {$file ne ""} { if ![file exists $file] { perror "$file doesn't exist" return -1 @@ -93,7 +93,7 @@ proc util_start { args } { send_log "Spawning \"$cmd $cmd_arg $file\"\n" } catch "exec $cmd $cmd_arg $file" comp_output - if ![string match "" $comp_output] { + if {$comp_output ne ""} { send_log "$comp_output\n" } return $comp_output diff --git a/testsuite/runtest.all/config.test b/testsuite/runtest.all/config.test index 48999a7..b0d21bf 100644 --- a/testsuite/runtest.all/config.test +++ b/testsuite/runtest.all/config.test @@ -53,7 +53,7 @@ if [isbuild hppa-ibm-macos ] { } # test default argument for isbuild -if [string compare [isbuild] $build_triplet] { +if {[isbuild] eq $build_triplet} { puts "FAILED: isbuild with no arguments" } else { puts "PASSED: isbuild with no arguments" @@ -79,7 +79,7 @@ if [ishost hppa-ibm-macos] { } # test default argument for ishost -if [string compare [ishost] $host_triplet] { +if {[ishost] eq $host_triplet} { puts "FAILED: ishost with no arguments" } else { puts "PASSED: ishost with no arguments" @@ -105,7 +105,7 @@ if [istarget hppa-ibm-macos] { } # test default argument for istarget -if [string compare [istarget] $target_triplet] { +if {[istarget] eq $target_triplet} { puts "FAILED: istarget with no arguments" } else { puts "PASSED: istarget with no arguments" |