From b3d43d3be8208272573563943690fff25ee50c8f Mon Sep 17 00:00:00 2001 From: Ben Elliston Date: Sat, 8 Dec 2018 00:09:42 +1100 Subject: * runtest.exp, lib/utils.exp, lib/target.exp, lib/ssh.exp, lib/rsh.exp, lib/rlogin.exp, lib/remote.exp, lib/libgloss.exp, lib/framework.exp, lib/dg.exp, lib/dejagnu.exp, config/vxworks.exp, config/unix.exp, config/sim.exp, config/gdb_stub.exp, config/gdb-comm.exp, config/adb.exp, baseboards/multi-sim.exp, baseboards/cris-sim.exp, baseboards/basic-sim.exp, baseboards/basic-sid.exp, baseboards/androideabi.exp, testsuite/runtest.all/load_lib.exp, testsuite/libdejagnu/tunit.exp: Replace empty string comparisons using == and != with 'eq' and 'ne'. --- ChangeLog | 13 ++++ baseboards/androideabi.exp | 4 +- baseboards/basic-sid.exp | 8 +-- baseboards/basic-sim.exp | 2 +- baseboards/cris-sim.exp | 2 +- baseboards/multi-sim.exp | 2 +- config/adb.exp | 8 +-- config/gdb-comm.exp | 12 ++-- config/gdb_stub.exp | 4 +- config/sim.exp | 4 +- config/unix.exp | 4 +- config/vxworks.exp | 16 ++--- lib/dejagnu.exp | 2 +- lib/dg.exp | 4 +- lib/framework.exp | 14 ++--- lib/libgloss.exp | 118 ++++++++++++++++++------------------- lib/remote.exp | 60 +++++++++---------- lib/rlogin.exp | 2 +- lib/rsh.exp | 4 +- lib/ssh.exp | 4 +- lib/target.exp | 22 +++---- lib/utils.exp | 2 +- runtest.exp | 78 ++++++++++++------------ testsuite/libdejagnu/tunit.exp | 2 +- testsuite/runtest.all/load_lib.exp | 2 +- 25 files changed, 203 insertions(+), 190 deletions(-) diff --git a/ChangeLog b/ChangeLog index c671bbd..e2fc784 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2018-12-08 Ben Elliston + + * runtest.exp, lib/utils.exp, lib/target.exp, lib/ssh.exp, + lib/rsh.exp, lib/rlogin.exp, lib/remote.exp, lib/libgloss.exp, + lib/framework.exp, lib/dg.exp, lib/dejagnu.exp, + config/vxworks.exp, config/unix.exp, config/sim.exp, + config/gdb_stub.exp, config/gdb-comm.exp, config/adb.exp, + baseboards/multi-sim.exp, baseboards/cris-sim.exp, + baseboards/basic-sim.exp, baseboards/basic-sid.exp, + baseboards/androideabi.exp, testsuite/runtest.all/load_lib.exp, + testsuite/libdejagnu/tunit.exp: Replace empty string comparisons + using == and != with 'eq' and 'ne'. + 2018-12-07 Jacob Bachmeyer * testsuite/runtest.all/default_procs.tcl (lib_bool_test): New. diff --git a/baseboards/androideabi.exp b/baseboards/androideabi.exp index dfc25db..8a29ab6 100644 --- a/baseboards/androideabi.exp +++ b/baseboards/androideabi.exp @@ -36,7 +36,7 @@ proc adb_load { dest prog args } { # Default directory uses tmpfs, so it is the best place to run # tests to avoid excessive wear of flash. global android_tmp_dir - if { $android_tmp_dir != "" } { + if { $android_tmp_dir ne "" } { verbose -log "android temporary directory is set to $android_tmp_dir" 3 } else { set android_tmp_dir "/mnt/sdcard/.android_secure" @@ -66,7 +66,7 @@ proc adb_load { dest prog args } { set localfile "./[file tail $prog].[pid]" set remotefile "$android_tmp_dir/[file tail $prog].[pid]" set remotefile [remote_download $dest $prog $remotefile] - if { $remotefile == "" } { + if { $remotefile eq "" } { verbose -log "Download of $prog to [board_info $dest name] failed." 3 return "unresolved" } diff --git a/baseboards/basic-sid.exp b/baseboards/basic-sid.exp index 8bc87d1..d03bfed 100644 --- a/baseboards/basic-sid.exp +++ b/baseboards/basic-sid.exp @@ -27,9 +27,9 @@ proc find_sid { target_alias } { global tool_root_dir set try [lookfor_file ${tool_root_dir} sid/bsp/${target_alias}-sid] - if { $try != "" } { + if { $try ne "" } { set sid_build [lookfor_file ${tool_root_dir} sid/main/dynamic/sid] - if { $sid_build != "" } { set env(SID) $sid_build } + if { $sid_build ne "" } { set env(SID) $sid_build } return $try } @@ -45,7 +45,7 @@ proc find_sid_conf { config } { global srcdir set try [lookfor_file ${srcdir} sid/bsp/pregen/${config}.conf] - if { $try == "" } then { return ${config}.conf } else { return $try } + if { $try eq "" } then { return ${config}.conf } else { return $try } } # find_rawsid -- find a usable SID simulator. @@ -58,7 +58,7 @@ proc find_rawsid { } { global srcdir set try [lookfor_file ${tool_root_dir} sid/main/dynamic/sid] - if { $try == "" } { + if { $try eq "" } { set try "sid" } else { # testing build tree diff --git a/baseboards/basic-sim.exp b/baseboards/basic-sim.exp index f506fe7..96d5164 100644 --- a/baseboards/basic-sim.exp +++ b/baseboards/basic-sim.exp @@ -40,7 +40,7 @@ proc find_sim { target_alias sim_dir sim_name } { # We have to search because tool_root_dir may actually point to that blasted # "target" subdirectory. set try [lookfor_file ${tool_root_dir} sim/${sim_dir}/${sim_name}] - if { $try != "" } { + if { $try ne "" } { return $try } return ${target_alias}-${sim_name} diff --git a/baseboards/cris-sim.exp b/baseboards/cris-sim.exp index ff4a928..431a0ba 100644 --- a/baseboards/cris-sim.exp +++ b/baseboards/cris-sim.exp @@ -69,7 +69,7 @@ foreach x $board_variant_list { } } -if { ![board_info $board exists sim,options] && $cris_simopt != "" } { +if { ![board_info $board exists sim,options] && $cris_simopt ne "" } { set_board_info sim,options $cris_simopt } diff --git a/baseboards/multi-sim.exp b/baseboards/multi-sim.exp index 97801f7..6e854f5 100644 --- a/baseboards/multi-sim.exp +++ b/baseboards/multi-sim.exp @@ -58,7 +58,7 @@ proc dynamic_linker_flag { args } { set mflags "[board_info $board multilib_flags]" foreach i [get_library_dirlist] { set dynlinker [glob -nocomplain -directory $i ld-*.so] - if { $dynlinker != "" } break + if { $dynlinker ne "" } break } verbose "dynamic_linker_flag: -Wl,--dynamic-linker=$dynlinker" return "-Wl,--dynamic-linker=$dynlinker" diff --git a/config/adb.exp b/config/adb.exp index ee4ef2d..87d3d1a 100644 --- a/config/adb.exp +++ b/config/adb.exp @@ -23,7 +23,7 @@ proc adb_serial {} { # If the user has ADB_SERIAL set, use that, otherwise default to the # only device. set serial "[getenv ADB_SERIAL]" - if { $serial == "" } { + if { $serial eq "" } { set status [catch "exec adb devices |& wc -l" output] if { $output > 3 } { perror "Set ADB_SERIAL in your environment to specify the correct target device!" @@ -54,7 +54,7 @@ proc adb_open { hostname } { } set serial [adb_serial] - if { $serial != "" } { + if { $serial ne "" } { spawn adb [adb_serial] shell } else { spawn adb shell @@ -159,7 +159,7 @@ proc adb_exec { boardname cmd args } { # If CMD sends any output to stderr, exec will think it failed. More often # than not that will be true, but it doesn't catch the case where there is # no output but the exit code is non-zero. - if { $inp == "" } { + if { $inp eq "" } { set inp "/dev/null" } @@ -178,7 +178,7 @@ proc adb_exec { boardname cmd args } { regexp "XYZ(\[0-9\]*)ZYX" $output junk status verbose "adb_exec: status:$status text:$output" 4 - if { $status == "" } { + if { $status eq "" } { return [list -1 "Couldn't parse adb output, $output."] } regsub "XYZ(\[0-9\]*)ZYX\n?" $output "" output diff --git a/config/gdb-comm.exp b/config/gdb-comm.exp index 07ba25e..141e4ee 100644 --- a/config/gdb-comm.exp +++ b/config/gdb-comm.exp @@ -165,7 +165,7 @@ proc gdb_comm_start { dest } { # provided with one. if {![info exists GDB]} then { set GDB "[lookfor_file ${tool_root_dir} gdb/gdb]" - if { $GDB == "" } { + if { $GDB eq "" } { set GDB [transform gdb] } } @@ -218,7 +218,7 @@ proc quit_gdb { } { set spawn_id [board_info host fileid] - if { $spawn_id != "" && $spawn_id > -1 } { + if { $spawn_id ne "" && $spawn_id > -1 } { if { [remote_send host "quit\n"] eq "" } { remote_expect host 10 { -re ".*y or n.*$" { @@ -257,7 +257,7 @@ proc gdb_comm_load { dest prog args } { set argnames { "command-line arguments" "input file" "output file" } for { set x 0 } { $x < [llength $args] } { incr x } { - if { [lindex $args $x] != "" } { + if { [lindex $args $x] ne "" } { return [list "unsupported" "no support for [lindex $argnames $x] on this target"] } } @@ -399,7 +399,7 @@ proc gdb_comm_load { dest prog args } { # work would be necessary for things like the g++ testsuite which # use printf to indicate pass/fail status. - if { [gdb_comm_add_breakpoint _exit] != "" } { + if { [gdb_comm_add_breakpoint _exit] ne "" } { gdb_comm_add_breakpoint exit } gdb_comm_add_breakpoint abort @@ -528,7 +528,7 @@ proc gdb_comm_reload { dest prog aargs } { # how many times have we done this? set n_reloads [board_info $dest n_reloads] - if {$n_reloads == ""} { + if {$n_reloads eq ""} { set n_reloads 0 } @@ -539,7 +539,7 @@ proc gdb_comm_reload { dest prog aargs } { # how many times are we allowed to do this? set max [board_info $dest max_reload_reboots] - if {$max == ""} { + if {$max eq ""} { set max 15 } diff --git a/config/gdb_stub.exp b/config/gdb_stub.exp index 7d8cb0d..b86c8e5 100644 --- a/config/gdb_stub.exp +++ b/config/gdb_stub.exp @@ -29,7 +29,7 @@ proc gdb_stub_init { dest args } { if {![info exists GDB]} then { set GDB "[lookfor_file ${tool_root_dir} gdb/gdb]" - if { $GDB == "" } { + if { $GDB eq "" } { set GDB [transform gdb] } } @@ -475,7 +475,7 @@ proc gdb_stub_load { dest prog args } { set argnames { "command-line arguments" "input file" "output file" } for { set x 0 } { $x < [llength $args] } { incr x } { - if { [lindex $args $x] != "" } { + if { [lindex $args $x] ne "" } { return [list "unsupported" "no support for [lindex $argnames $x] on this target"] } } diff --git a/config/sim.exp b/config/sim.exp index b507742..8d9088c 100644 --- a/config/sim.exp +++ b/config/sim.exp @@ -62,7 +62,7 @@ proc sim_wait { dest timeout } { proc sim_load { dest prog args } { set inpfile "" if { [llength $args] > 1 } { - if { [lindex $args 1] != "" } { + if { [lindex $args 1] ne "" } { set inpfile "[lindex $args 1]" } } @@ -92,7 +92,7 @@ proc sim_load { dest prog args } { # Run the program with a limited amount of real time. While # this isn't as nice as limiting the amount of CPU time, it # will have to do. - if { $inpfile != "" } { + if { $inpfile ne "" } { set res [remote_spawn target "${cmd} < $inpfile" "readonly"] } else { set res [remote_spawn target "${cmd}"] diff --git a/config/unix.exp b/config/unix.exp index 893d514..0b8e124 100644 --- a/config/unix.exp +++ b/config/unix.exp @@ -62,7 +62,7 @@ proc unix_load { dest prog args } { } verbose "loading to $dest" 2 if {![isremote $dest]} { - if { "$inp" != "" } { + if { "$inp" ne "" } { set command "$prog $parg < $inp" } else { set command "$prog $parg" @@ -98,7 +98,7 @@ proc unix_load { dest prog args } { } else { set remotefile [file tail $prog] set remotefile [remote_download $dest $prog $remotefile] - if { $remotefile == "" } { + if { $remotefile eq "" } { verbose -log "Download of $prog to [board_info $dest name] failed." 3 return [list "unresolved" ""] } diff --git a/config/vxworks.exp b/config/vxworks.exp index 21f6c41..86ac884 100644 --- a/config/vxworks.exp +++ b/config/vxworks.exp @@ -30,7 +30,7 @@ proc ${board}_init { dest } { set desired_kernel [board_info $dest "kernel,$target_os"] - if { $desired_kernel == "" } { + if { $desired_kernel eq "" } { vxworks_final_init $dest # Nothing to see here, nothing to do. Move along. return @@ -112,7 +112,7 @@ proc ${board}_init { dest } { proc vxworks_final_init { dest } { if {[board_info $dest exists preload_obj]} { - if { [target_compile [board_info $dest preload_obj] foo.out object [board_info $dest preload_obj_flags]] == "" } { + if { [target_compile [board_info $dest preload_obj] foo.out object [board_info $dest preload_obj_flags]] eq "" } { vxworks_ld $dest foo.out } remote_file build delete foo.out @@ -130,7 +130,7 @@ proc vxworks_exec { dest program pargs inp outp } { return [list -1 "open failure"] } - if { $inp != "" } { + if { $inp ne "" } { set inp [remote_download $dest $inp] set suffix " < $inp" } else { @@ -159,7 +159,7 @@ proc vxworks_exec { dest program pargs inp outp } { set result [list -1 "unable to execute command"] } } - if { $suffix != "" } { + if { $suffix ne "" } { remote_file $dest delete $inp } return $result @@ -213,7 +213,7 @@ proc vxworks_open { dest args } { set shell_id [remote_raw_open $dest] - if { $shell_id == "" || $shell_id < 0 } { + if { $shell_id eq "" || $shell_id < 0 } { return -1 } @@ -243,7 +243,7 @@ proc vxworks_open { dest args } { if {[board_info $dest exists vxworks_homedir]} { set dir [board_info $dest vxworks_homedir] } - if { $dir != "" } { + if { $dir ne "" } { set status [remote_exec $dest "cd" "\"$dir\""] if {[lindex $status 0]} { perror "Error in cd to $dir--[lindex $status 1]" @@ -264,7 +264,7 @@ proc vxworks_ld { dest prog } { global decimal hex global board_info - if { $prog == "" } { + if { $prog eq "" } { return 1 } @@ -479,7 +479,7 @@ proc vxworks_load {dest prog args} { } } } - if { $result != "" } { + if { $result ne "" } { vxworks_unld $dest return [list $result $output] } diff --git a/lib/dejagnu.exp b/lib/dejagnu.exp index 8ca241a..d0766e6 100644 --- a/lib/dejagnu.exp +++ b/lib/dejagnu.exp @@ -89,7 +89,7 @@ proc host_compile {compline} { if { [lindex $status 0] != 0 } { verbose -log "compiler exited with status [lindex $status 0]" } - if { [lindex $status 1] != "" } { + if { [lindex $status 1] ne "" } { verbose -log "output is:\n[lindex $status 1]" 2 } diff --git a/lib/dg.exp b/lib/dg.exp index eacbe45..5232d2a 100644 --- a/lib/dg.exp +++ b/lib/dg.exp @@ -629,7 +629,7 @@ proc dg-test { args } { # We append the compilation flags, if any, to ensure that the test case # names are unique. - if { "$tool_flags" != "" } { + if { "$tool_flags" ne "" } { set name "$name $tool_flags" } @@ -751,7 +751,7 @@ proc dg-test { args } { # Remove messages from the tool that we can ignore. set comp_output [prune_warnings $comp_output] - if { [info procs ${tool}-dg-prune] != "" } { + if { [info procs ${tool}-dg-prune] ne "" } { set comp_output [${tool}-dg-prune $target_triplet $comp_output] switch -glob -- $comp_output { "::untested::*" { diff --git a/lib/framework.exp b/lib/framework.exp index fa0c0b0..9b11bd0 100644 --- a/lib/framework.exp +++ b/lib/framework.exp @@ -57,7 +57,7 @@ proc open_logs { } { global xml_file global xml - if { ${tool} == "" } { + if { ${tool} eq "" } { set tool testrun } catch "file delete -force -- $outdir/$tool.sum" @@ -148,7 +148,7 @@ proc is_remote { board } { } if { $board == "host" } { - if { [info exists host_board] && $host_board != "" } { + if { [info exists host_board] && $host_board ne "" } { verbose "board is $board, is remote" 3 return 1 } else { @@ -288,7 +288,7 @@ proc clone_output { message } { global sum_file global all_flag - if { $sum_file != "" } { + if { $sum_file ne "" } { puts $sum_file "$message" } @@ -349,7 +349,7 @@ proc log_and_exit {} { log_summary total # extract version number - if {[info procs ${tool}_version] != ""} { + if {[info procs ${tool}_version] ne ""} { if {[catch "${tool}_version" output]} { warning "${tool}_version failed:\n$output" } @@ -357,7 +357,7 @@ proc log_and_exit {} { close_logs verbose -log "runtest completed at [timestamp -format %c]" if {$mail_logs} { - if { ${tool} == "" } { + if { ${tool} eq "" } { set tool testrun } mail_file $outdir/$tool.sum $mailing_list "Dejagnu Summary Log" @@ -385,7 +385,7 @@ proc xml_tag { tag body } { proc xml_output { message } { global xml_file - if { $xml_file != "" } { + if { $xml_file ne "" } { puts $xml_file $message } } @@ -803,7 +803,7 @@ proc record_test { type message args } { } global multipass_name - if { $multipass_name != "" } { + if { $multipass_name ne "" } { set message [format "%s: %s: %s" "$type" "$multipass_name" "$message"] } else { set message "$type: $message" diff --git a/lib/libgloss.exp b/lib/libgloss.exp index 6a4fb0e..0e033df 100644 --- a/lib/libgloss.exp +++ b/lib/libgloss.exp @@ -85,7 +85,7 @@ proc libgloss_link_flags { args } { # set the proper paths for gcc if the target subdir exists, else assume we # have no libgloss support for this target. - if { $gloss_srcdir == "" } { + if { $gloss_srcdir eq "" } { return "" } if {[file exists [file join $gccpath libgloss $cpu]]} { @@ -120,7 +120,7 @@ proc newlib_link_flags { args } { } set ld_script_path [lookfor_file ${tool_root_dir} "ld/ldscripts"] - if { $ld_script_path != "" } { + if { $ld_script_path ne "" } { set result "-L[file dirname $ld_script_path]" } else { set result "" @@ -155,7 +155,7 @@ proc newlib_include_flags { args } { verbose "Newlib path is $gccpath/newlib" set newlib_dir [lookfor_file ${srcdir} newlib/libc/include/assert.h] - if { ${newlib_dir} != "" } { + if { ${newlib_dir} ne "" } { set newlib_dir [file dirname ${newlib_dir}] } # Note - we use -isystem rather than -I because newlib contains @@ -180,7 +180,7 @@ proc libio_include_flags { args } { set gccpath "[get_multilibs]" - if { $gccpath == "" } { + if { $gccpath eq "" } { set gccpath "$tool_root_dir" } @@ -188,12 +188,12 @@ proc libio_include_flags { args } { # linux doesn't build _G_config.h and the test above fails, so # we search for iostream.list too. - if { $libio_bin_dir == "" } { + if { $libio_bin_dir eq "" } { set libio_bin_dir [lookfor_file ${gccpath} libio/iostream.list] } set libio_src_dir [lookfor_file ${srcdir} libio/Makefile.in] - if { $libio_bin_dir != "" && $libio_src_dir != "" } { + if { $libio_bin_dir ne "" && $libio_src_dir ne "" } { set libio_src_dir [file dirname ${libio_src_dir}] set libio_bin_dir [file dirname ${libio_bin_dir}] # Note - unlike the newlib_include_flags proc above we use the -I @@ -215,7 +215,7 @@ proc libio_link_flags { args } { set gccpath "[get_multilibs]" set libio_dir [lookfor_file ${gccpath} libio/libio.a] - if { $libio_dir != "" } { + if { $libio_dir ne "" } { return "-L[file dirname ${libio_dir}]" } else { return "" @@ -235,23 +235,23 @@ proc g++_include_flags { args } { set flags "" set dir [lookfor_file ${srcdir} libg++] - if { ${dir} != "" } { + if { ${dir} ne "" } { # See comment in libio_include_flags about using -I. append flags " -I${dir} -I${dir}/src" } set dir [lookfor_file ${srcdir} libstdc++-v3] - if { ${dir} != "" } { + if { ${dir} ne "" } { append flags " -I${dir}/include -I${dir}/include/std -I${dir}/include/c_std -I${dir}/libsupc++" } set dir [lookfor_file ${gccpath} libstdc++-v3] - if { ${dir} != "" } { + if { ${dir} ne "" } { append flags " -I${dir}/include -I${dir}/include/${target_alias}" } set dir [lookfor_file ${srcdir} libstdc++] - if { ${dir} != "" } { + if { ${dir} ne "" } { append flags " -I${dir} -I${dir}/stl" } @@ -267,7 +267,7 @@ proc g++_link_flags { args } { set flags "" set ld_library_path "." - if { $gccpath != "" } { + if { $gccpath ne "" } { if {[file exists [file join ${gccpath} lib libstdc++.a]]} { append ld_library_path ":${gccpath}/lib" } @@ -293,21 +293,21 @@ proc g++_link_flags { args } { global tool_root_dir set libgpp [lookfor_file ${tool_root_dir} libg++] - if { $libgpp != "" } { + if { $libgpp ne "" } { append flags "-L${libgpp} " append ld_library_path ":${libgpp}" } set libstdcpp [lookfor_file ${tool_root_dir} libstdc++] - if { $libstdcpp != "" } { + if { $libstdcpp ne "" } { append flags "-L${libstdcpp} " append ld_library_path ":${libstdcpp}" } set libiberty [lookfor_file ${tool_root_dir} libiberty] - if { $libiberty != "" } { + if { $libiberty ne "" } { append flags "-L${libiberty} " } set librx [lookfor_file ${tool_root_dir} librx] - if { $librx != "" } { + if { $librx ne "" } { append flags "-L${librx} " } } @@ -327,7 +327,7 @@ proc libstdc++_include_flags { args } { set flags "" set dir [lookfor_file ${srcdir} libstdc++-v3] - if { ${dir} != "" } { + if { ${dir} ne "" } { # See comment in libio_include_flags about using -I. append flags " -I${dir}/include -I${dir}/include/std -I${dir}/include/c_std -I${dir}/libsupc++" } @@ -335,12 +335,12 @@ proc libstdc++_include_flags { args } { set gccpath [get_multilibs] set dir [lookfor_file ${gccpath} libstdc++-v3] - if { ${dir} != "" } { + if { ${dir} ne "" } { append flags " -I${dir}/include -I${dir}/include/${target_alias}" } set dir [lookfor_file ${srcdir} libstdc++] - if { ${dir} != "" } { + if { ${dir} ne "" } { append flags " -I${dir} -I${dir}/stl" } @@ -355,7 +355,7 @@ proc libstdc++_link_flags { args } { set libio_dir "" set flags "" - if { $gccpath != "" } { + if { $gccpath ne "" } { if {[file exists [file join ${gccpath} libstdc++ libstdc++.a]]} { append flags "-L${gccpath}/libstdc++ " append ld_library_path ":${gccpath}/libstdc++" @@ -370,16 +370,16 @@ proc libstdc++_link_flags { args } { global tool_root_dir set libstdcpp [lookfor_file ${tool_root_dir} libstdc++] - if { $libstdcpp != "" } { + if { $libstdcpp ne "" } { append flags "-L${libstdcpp} " append ld_library_path ":${libstdcpp}" } set libiberty [lookfor_file ${tool_root_dir} libiberty] - if { $libiberty != "" } { + if { $libiberty ne "" } { append flags "-L${libiberty} " } set librx [lookfor_file ${tool_root_dir} librx] - if { $librx != "" } { + if { $librx ne "" } { append flags "-L${librx} " } } @@ -421,7 +421,7 @@ proc get_multilibs { args } { set compiler [find_gcc] } - if { $compiler == "" } { + if { $compiler eq "" } { return "" } @@ -457,7 +457,7 @@ proc get_multilibs { args } { # extract the options and their directory names as know by gcc foreach i "[exec $compiler --print-multi-lib]" { - if {$extra != ""} { + if {$extra ne ""} { # string trimright would do the wrong thing if we included # the leading @@ in $extra set i [string trimright $i $extra] @@ -487,7 +487,7 @@ proc get_multilibs { args } { regsub -all " -" $moptions " " dirty_moptions set moptions "" foreach x [split $dirty_moptions " "] { - if { $x != "" && [lsearch -exact $moptions $x] < 0 } { + if { $x ne "" && [lsearch -exact $moptions $x] < 0 } { lappend moptions $x } } @@ -498,11 +498,11 @@ proc get_multilibs { args } { # search for the top level multilib directory set multitop [lookfor_file "${comp_base_dir}" "${target_alias}"] - if { $multitop == "" } { + if { $multitop eq "" } { set multitop [lookfor_file "${comp_base_dir}" "libraries"] - if { $multitop == "" } { + if { $multitop eq "" } { set multitop "[lookfor_file ${comp_base_dir} gcc/xgcc]" - if { $multitop != "" } { + if { $multitop ne "" } { set multitop [file dirname [file dirname $multitop]] } else { return "" @@ -512,7 +512,7 @@ proc get_multilibs { args } { set gccpath [eval exec "$compiler" --print-multi-directory $mopts] set gccpath [lindex $gccpath 0] - if { $gccpath != "" } { + if { $gccpath ne "" } { verbose "GCC path is $gccpath" if { [llength $args] == 0 } { set board_info($target_board,multitop) "$multitop/$gccpath" @@ -530,7 +530,7 @@ proc get_multilibs { args } { } } # if we find some - if {$multimatches != ""} { + if {$multimatches ne ""} { # Split it into a list of pairs. If an moptions are the first # of a pair, then replace it with the second. If an moption # is not in multimatches, we assume it's not a multilib option @@ -608,16 +608,16 @@ proc find_binutils_prog { name } { if {![isremote host]} { set file [lookfor_file $tool_root_dir $name] - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir ${name}-new] } - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir binutils/$name] } - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir binutils/${name}-new] } - if { $file != "" } { + if { $file ne "" } { set NAME "$file" } else { set NAME [transform $name] @@ -633,10 +633,10 @@ proc find_gcc {} { if {![isremote host]} { set file [lookfor_file $tool_root_dir xgcc] - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir gcc/xgcc] } - if { $file != "" } { + if { $file ne "" } { set CC "$file -B[file dirname $file]/" } else { set CC [transform gcc] @@ -652,10 +652,10 @@ proc find_gcj {} { if {![isremote host]} { set file [lookfor_file $tool_root_dir gcj] - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir gcc/gcj] } - if { $file != "" } { + if { $file ne "" } { set CC "$file -B[file dirname $file]/" } else { set CC [transform gcj] @@ -671,13 +671,13 @@ proc find_g++ {} { if {![isremote host]} { set file [lookfor_file $tool_root_dir xg++] - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir gcc/xg++] } - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir g++] } - if { $file != "" } { + if { $file ne "" } { set CC "$file -B[file dirname $file]/" } else { set CC [transform g++] @@ -693,10 +693,10 @@ proc find_gdc {} { if {![isremote host]} { set file [lookfor_file $tool_root_dir gdc] - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir gcc/gdc] } - if { $file != "" } { + if { $file ne "" } { set CC "$file -B[file dirname $file]/" } else { set CC [transform gdc] @@ -712,10 +712,10 @@ proc find_g77 {} { if {![isremote host]} { set file [lookfor_file $tool_root_dir g77] - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir gcc/g77] } - if { $file != "" } { + if { $file ne "" } { set CC "$file -B[file dirname $file]/" } else { set CC [transform g77] @@ -731,10 +731,10 @@ proc find_gfortran {} { if {![isremote host]} { set file [lookfor_file $tool_root_dir gfortran] - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir gcc/gfortran] } - if { $file != "" } { + if { $file ne "" } { set CC "$file -B[file dirname $file]/" } else { set CC [transform gfortran] @@ -750,10 +750,10 @@ proc find_gnatmake {} { if {![isremote host]} { set file [lookfor_file $tool_root_dir gnatmake] - if { $file == "" } { + if { $file eq "" } { set file [lookfor_file $tool_root_dir gcc/gnatmake] } - if { $file != "" } { + if { $file ne "" } { set root [file dirname $file] set CC "$file -I$root/ada/rts --GCC=$root/xgcc --GNATBIND=$root/gnatbind --GNATLINK=$root/gnatlink -cargs -B$root -largs --GCC=$root/xgcc -B$root -margs" } else { @@ -771,11 +771,11 @@ proc find_nm {} { set NM "" if {![isremote host]} { set NM [lookfor_file $tool_root_dir nm-new] - if {$NM == ""} { + if {$NM eq ""} { set NM [lookfor_file $tool_root_dir binutils/nm-new] } } - if { $NM == ""} { + if { $NM eq ""} { set NM [transform nm] } return $NM @@ -799,7 +799,7 @@ proc process_multilib_options { args } { regsub -all "^\[ \t\]*" "$x" "" x regsub -all "\[ \t\]*$" "$x" "" x - if { $x == "" } { + if { $x eq "" } { continue } switch -glob -- $x { @@ -869,11 +869,11 @@ proc find_gas { } { if {![isremote host]} { set AS [lookfor_file $tool_root_dir as-new] - if { $AS == "" } { + if { $AS eq "" } { set AS [lookfor_file $tool_root_dir gas/as-new] } } - if { $AS == "" } { + if { $AS eq "" } { set AS [transform as] } return $AS @@ -886,11 +886,11 @@ proc find_ld { } { if {![isremote host]} { set LD [lookfor_file $tool_root_dir ld-new] - if { $LD == "" } { + if { $LD eq "" } { set LD [lookfor_file $tool_root_dir ld/ld-new] } } - if { $LD == "" } { + if { $LD eq "" } { set LD [transform ld] } return $LD @@ -919,7 +919,7 @@ proc build_wrapper { gluefile } { if {[target_info exists wrap_compile_flags]} { lappend flags "additional_flags=[target_info wrap_compile_flags]" } - if { [target_compile ${libdir}/testglue.c ${gluefile} object $flags] == "" } { + if { [target_compile ${libdir}/testglue.c ${gluefile} object $flags] eq "" } { set gluefile [remote_download host ${gluefile} ${tool}_tg.o] return [list $gluefile $result] } else { @@ -945,7 +945,7 @@ proc winsup_include_flags { args } { verbose "Winsup path is $gccpath/winsup" set winsup_dir [lookfor_file ${srcdir} winsup/include/windows.h] - if { ${winsup_dir} != "" } { + if { ${winsup_dir} ne "" } { set winsup_dir [file dirname ${winsup_dir}] # See comment in libio_include_flags about using -I. return " -I${winsup_dir}" diff --git a/lib/remote.exp b/lib/remote.exp index f195341..f703f35 100644 --- a/lib/remote.exp +++ b/lib/remote.exp @@ -60,7 +60,7 @@ proc remote_raw_open { args } { # -1, then the process is killed if it doesn't exit gracefully. # proc close_wait_program { program_id pid {wres_varname ""} } { - if {$wres_varname != "" } { + if {$wres_varname ne "" } { upvar 1 $wres_varname wres } @@ -167,7 +167,7 @@ proc local_exec { commandline inp outp timeout } { } } else { # Use a command pipeline with open. - if { $inp != "" } { + if { $inp ne "" } { set inp "< $inp" set mode "r" } else { @@ -177,12 +177,12 @@ proc local_exec { commandline inp outp timeout } { set use_tee 0 # We add |& cat so that Tcl exec doesn't freak out if the # program writes to stderr. - if { $outp == "" } { + if { $outp eq "" } { set outp "|& cat" } else { set outpf "$outp" set outp "> $outp" - if { $inp != "" } { + if { $inp ne "" } { set use_tee 1 } } @@ -258,7 +258,7 @@ proc local_exec { commandline inp outp timeout } { set res "wait failed" } } - if { $r2 != 0 || $res != "" || ! $got_eof } { + if { $r2 != 0 || $res ne "" || ! $got_eof } { verbose "close result is $res" set status 1 } else { @@ -418,7 +418,7 @@ proc remote_reboot { host } { if {[board_info $host exists name]} { set host [board_info $host name] } - if { [info procs ${host}_init] != "" } { + if { [info procs ${host}_init] ne "" } { ${host}_init $host } return $status @@ -446,7 +446,7 @@ proc remote_download { dest file args } { } if { ![isremote $dest] } { - if { $destfile == "" || $destfile == $file } { + if { $destfile eq "" || $destfile == $file } { return $file } else { verbose -log "Downloading on $dest to $destfile: $file" 2 @@ -459,7 +459,7 @@ proc remote_download { dest file args } { # and write it (in case we copy onto it again) catch {exec chmod u+rw $destfile} } - if { $result != 0 || $output != "" } { + if { $result != 0 || $output ne "" } { perror "remote_download to $dest of $file to $destfile: $output" return "" } else { @@ -495,7 +495,7 @@ proc standard_download {dest file destfile} { set destfile "$destdir/$destfile" } - if { "$dest" != "" } { + if { "$dest" ne "" } { set result [rsh_download $dest $file $destfile] if { $result == $destfile } { return $orig_destfile @@ -513,7 +513,7 @@ proc standard_download {dest file destfile} { # and write it (in case we copy onto it again) catch {exec chmod u+rw $destfile} } - if { $result != 0 || $output != "" } { + if { $result != 0 || $output ne "" } { perror "remote_download to $dest of $file to $destfile: $output" return "" } else { @@ -529,7 +529,7 @@ proc remote_upload {dest srcfile args} { } if { ![isremote $dest] } { - if { $destfile == "" || $srcfile == $destfile } { + if { $destfile eq "" || $srcfile == $destfile } { return $srcfile } set result [catch "exec cp -p $srcfile $destfile" output] @@ -552,7 +552,7 @@ proc standard_upload { dest srcfile destfile } { set srcfile "$destdir/$srcfile" } - if { "$dest" != "" } { + if { "$dest" ne "" } { return [rsh_upload $dest $srcfile $destfile] } @@ -565,7 +565,7 @@ proc standard_upload { dest srcfile destfile } { # and write it (in case we copy onto it again) catch {exec chmod u+rw $destfile} } - if { $result != 0 || $output != "" } { + if { $result != 0 || $output ne "" } { perror "remote_upload to $dest of $srcfile to $destfile: $output" return "" } else { @@ -615,8 +615,8 @@ proc call_remote { type proc dest args } { # Close has to be handled specially. if { $proc eq "close" || $proc eq "open" } { foreach try "$high_prot [board_info $dest connect] telnet standard" { - if { $try != "" } { - if { [info procs "${try}_${proc}"] != "" } { + if { $try ne "" } { + if { [info procs "${try}_${proc}"] ne "" } { verbose "call_remote calling ${try}_${proc}" 3 set result [eval ${try}_${proc} \"$dest\" $args] break @@ -624,7 +624,7 @@ proc call_remote { type proc dest args } { } } set ft "[board_info $dest file_transfer]" - if { [info procs "${ft}_${proc}"] != "" } { + if { [info procs "${ft}_${proc}"] ne "" } { verbose "calling ${ft}_${proc} $dest $args" 3 set result2 [eval ${ft}_${proc} \"$dest\" $args] } @@ -639,8 +639,8 @@ proc call_remote { type proc dest args } { } foreach try "${high_prot} [board_info $dest file_transfer] [board_info $dest connect] telnet standard" { verbose "looking for ${try}_${proc}" 4 - if { $try != "" } { - if { [info procs "${try}_${proc}"] != "" } { + if { $try ne "" } { + if { [info procs "${try}_${proc}"] ne "" } { verbose "call_remote calling ${try}_${proc}" 3 return [eval ${try}_${proc} \"$dest\" $args] } @@ -767,7 +767,7 @@ proc standard_file { dest op args } { set file [remote_file $dest absolute $file] } set result [file dirname $file] - if { $result == "" } { + if { $result eq "" } { return "/" } return $result @@ -960,11 +960,11 @@ proc remote_load { dest prog args } { set dname [board_info $dest name] set cache "[getenv REMOTELOAD_CACHE]/$tool/$dname/[file tail $prog]" set empty [isremote $dest] - if { [board_info $dest exists is_simulator] || [getenv REMOTELOAD_CACHE] == "" } { + if { [board_info $dest exists is_simulator] || [getenv REMOTELOAD_CACHE] eq "" } { set empty 0 } else { for { set x 0 } {$x < [llength $args] } {incr x} { - if { [lindex $args $x] != "" } { + if { [lindex $args $x] ne "" } { set empty 0 break } @@ -1024,7 +1024,7 @@ proc remote_load { dest prog args } { # Not quite happy about the "pass" condition, but it makes sense if # you think about it for a while-- *why* did the test not pass? if { $empty && [lindex $result 0] == "pass" } { - if { [getenv LOAD_REMOTECACHE] != "" } { + if { [getenv LOAD_REMOTECACHE] ne "" } { set dir "[getenv REMOTELOAD_CACHE]/$tool/$dname" if {![file exists $dir]} { file mkdir $dir @@ -1083,7 +1083,7 @@ proc standard_load { dest prog args } { } set remotefile [file tail $prog] set remotefile [remote_download $dest $prog $remotefile] - if { $remotefile == "" } { + if { $remotefile eq "" } { verbose -log "Download of $prog to [board_info $dest name] failed." 3 return "unresolved" } @@ -1211,7 +1211,7 @@ proc check_for_board_status { variable } { # status message, then the absence of it means that the program # crashed, regardless of status found elsewhere (e.g. simulator exit # code). - if { [target_info needs_status_wrapper] != "" } then { + if { [target_info needs_status_wrapper] ne "" } then { set nomatch_return 2 } else { set nomatch_return -1 @@ -1225,7 +1225,7 @@ proc check_for_board_status { variable } { regsub "\[^0-9\]*$" $result "" result verbose "got board status $result" 3 verbose "output is $output" 3 - if { $result == "" } { + if { $result eq "" } { return $nomatch_return } else { return [expr {$result}] @@ -1259,7 +1259,7 @@ proc remote_expect { board timeout args } { set error_sect "" set save_next 0 - if { $spawn_id == "" } { + if { $spawn_id eq "" } { # This should be an invalid spawn id. set spawn_id 1000 } @@ -1305,7 +1305,7 @@ proc remote_expect { board timeout args } { if { ${x} == "eof" } { set save_next 1 } elseif { ${x} eq "default" || ${x} eq "timeout" } { - if { $error_sect == "" } { + if { $error_sect eq "" } { set save_next 1 } } @@ -1330,7 +1330,7 @@ proc remote_expect { board timeout args } { perror "$errorInfo $errorCode $string" } - if { $error_sect != "" } { + if { $error_sect ne "" } { set code [catch {uplevel $error_sect} string] } else { warning "remote_expect statement without a default case" @@ -1352,7 +1352,7 @@ proc remote_push_conn { host } { set name [board_info $host name] - if { $name == "" } { + if { $name eq "" } { return "fail" } @@ -1381,7 +1381,7 @@ proc remote_pop_conn { host } { set name [board_info $host name] - if { $name == "" } { + if { $name eq "" } { return "fail" } if {![info exists board_info($name,fileid_stack)]} { diff --git a/lib/rlogin.exp b/lib/rlogin.exp index b699831..cd1a583 100644 --- a/lib/rlogin.exp +++ b/lib/rlogin.exp @@ -140,7 +140,7 @@ proc rlogin_spawn { dest cmdline } { set ok 0 for { set i 0 } {$i <= 2 && ! $ok} { incr i } { set shell_id [remote_open $dest] - if { $shell_id != "" && $shell_id > 0 } { + if { $shell_id ne "" && $shell_id > 0 } { remote_send $dest "echo k\r" remote_expect $dest 20 { -re "\\(gdb\\)" { diff --git a/lib/rsh.exp b/lib/rsh.exp index 6852661..7cd9064 100644 --- a/lib/rsh.exp +++ b/lib/rsh.exp @@ -256,7 +256,7 @@ proc rsh_exec { boardname program pargs inp outp } { # If CMD sends any output to stderr, exec will think it failed. # More often than not that will be true, but it doesn't catch the # case where there is no output but the exit code is non-zero. - if { $inp == "" } { + if { $inp eq "" } { set inp "/dev/null" } @@ -279,7 +279,7 @@ proc rsh_exec { boardname program pargs inp outp } { set status "" } verbose "rsh_exec: status:$status text:$output" 4 - if { $status == "" } { + if { $status eq "" } { return [list -1 "Couldn't parse $RSH output, $output."] } regsub "XYZ(\[0-9\]*)ZYX\n?" $output "" output diff --git a/lib/ssh.exp b/lib/ssh.exp index c589ca9..91a3903 100644 --- a/lib/ssh.exp +++ b/lib/ssh.exp @@ -165,7 +165,7 @@ proc ssh_exec { boardname program pargs inp outp } { # If CMD sends any output to stderr, exec will think it failed. # More often than not that will be true, but it doesn't catch the # case where there is no output but the exit code is non-zero. - if { $inp == "" } { + if { $inp eq "" } { set inp "/dev/null" } @@ -190,7 +190,7 @@ proc ssh_exec { boardname program pargs inp outp } { set status "" } verbose "ssh_exec: status:$status text:$output" 4 - if { $status == "" } { + if { $status eq "" } { return [list -1 "Couldn't parse $SSH output, $output."] } regsub "XYZ(\[0-9\]*)ZYX\n?" $output "" output diff --git a/lib/target.exp b/lib/target.exp index 9268f4e..2573666 100644 --- a/lib/target.exp +++ b/lib/target.exp @@ -293,7 +293,7 @@ proc prune_warnings { text } { # proc target_compile {source destfile type options} { set target [target_info name] - if { [info procs ${target}_compile] != "" } { + if { [info procs ${target}_compile] ne "" } { return [${target}_compile $source $destfile $type $options] } else { return [default_target_compile $source $destfile $type $options] @@ -307,7 +307,7 @@ proc default_target_compile {source destfile type options} { global LDFLAGS_FOR_TARGET global compiler_flags - if { $destfile == "" && $type != "preprocess" && $type != "none" } { + if { $destfile eq "" && $type != "preprocess" && $type != "none" } { error "Must supply an output filename for the compile to default_target_compile" } @@ -459,7 +459,7 @@ proc default_target_compile {source destfile type options} { } if {[info exists CC_FOR_TARGET]} { - if { $compiler == "" } { + if { $compiler eq "" } { set compiler $CC_FOR_TARGET } } @@ -488,9 +488,9 @@ proc default_target_compile {source destfile type options} { } } - if { $compiler == "" } { + if { $compiler eq "" } { set compiler [board_info $dest compiler] - if { $compiler == "" } { + if { $compiler eq "" } { return "default_target_compile: No compiler to compile with" } } @@ -527,7 +527,7 @@ proc default_target_compile {source destfile type options} { if {[isnative]} { # This is a lose. catch "glob -nocomplain $tool_root_dir/libstdc++/libstdc++.so* $tool_root_dir/libstdc++/libstdc++.sl" tmp - if { ${tmp} != "" } { + if { ${tmp} ne "" } { if {[regexp ".*solaris2.*" $target_triplet]} { # Solaris 2 append add_flags " -R$tool_root_dir/libstdc++" @@ -607,7 +607,7 @@ proc default_target_compile {source destfile type options} { if {[isremote host]} { foreach x $source { set file [remote_download host $x] - if { $file == "" } { + if { $file eq "" } { warning "Unable to download $x to host." return "Unable to download $x to host." } else { @@ -622,7 +622,7 @@ proc default_target_compile {source destfile type options} { append add_flags " -o a.out" remote_file host delete a.out } else { - if { $destfile != "" } { + if { $destfile ne "" } { append add_flags " -o $destfile" } } @@ -670,7 +670,7 @@ proc default_target_compile {source destfile type options} { if { [lindex $status 0] != 0 } { verbose -log "compiler exited with status [lindex $status 0]" } - if { [lindex $status 1] != "" } { + if { [lindex $status 1] ne "" } { verbose "output is:\n[lindex $status 1]" 2 } if { [lindex $status 0] != 0 && "${comp_output}" eq "" } { @@ -726,7 +726,7 @@ proc default_target_assemble { source destfile flags } { if { [lindex $status 0] != 0 } { verbose -log "assembler exited with status [lindex $status 0]" } - if { [lindex $status 1] != "" } { + if { [lindex $status 1] ne "" } { verbose "assembler output is:\n[lindex $status 1]" 2 } return ${comp_output} @@ -818,7 +818,7 @@ proc default_link { board objects destfile flags } { if { [lindex $status 0] != 0 } { verbose -log "linker exited with status [lindex $status 0]" } - if { [lindex $status 1] != "" } { + if { [lindex $status 1] ne "" } { verbose "linker output is:\n[lindex $status 1]" 2 } return ${comp_output} diff --git a/lib/utils.exp b/lib/utils.exp index c0f1ab7..3c00b3f 100644 --- a/lib/utils.exp +++ b/lib/utils.exp @@ -45,7 +45,7 @@ proc getdirs { args } { } verbose "Looking in ${path} for directories that match \"${pattern}\"" 3 catch "glob ${path}/${pattern}" tmp - if { ${tmp} != "" } { + if { ${tmp} ne "" } { foreach i ${tmp} { if {[file isdirectory $i]} { switch -- "[file tail $i]" { diff --git a/runtest.exp b/runtest.exp index 2103c8b..ced4d1e 100644 --- a/runtest.exp +++ b/runtest.exp @@ -385,7 +385,7 @@ proc usage { } { send_user "\t--D\[0-1\]\t\tTcl debugger\n" send_user "\tscript.exp\[=arg(s)\]\tRun these tests only\n" if { [info exists tool] } { - if { [info procs ${tool}_option_help] != "" } { + if { [info procs ${tool}_option_help] ne "" } { ${tool}_option_help } } @@ -656,10 +656,10 @@ verbose "Using $libdir to find libraries" # config files. We allow $DEJAGNU to massage them though in case it would # ever want to do such a thing. # -if { $arg_host_triplet != "" } { +if { $arg_host_triplet ne "" } { set host_triplet $arg_host_triplet } -if { $arg_build_triplet != "" } { +if { $arg_build_triplet ne "" } { set build_triplet $arg_build_triplet } @@ -703,7 +703,7 @@ if {[expr {$build_triplet eq "" && $host_triplet eq ""}]} { } } verbose "Assuming build host is $build_triplet" - if { $host_triplet == "" } { + if { $host_triplet eq "" } { set host_triplet $build_triplet } } @@ -712,9 +712,9 @@ if {[expr {$build_triplet eq "" && $host_triplet eq ""}]} { # Figure out the target. If the target hasn't been specified, then we have to # assume we are native. # -if { $arg_target_triplet != "" } { +if { $arg_target_triplet ne "" } { set target_triplet $arg_target_triplet -} elseif { $target_triplet == "" } { +} elseif { $target_triplet eq "" } { set target_triplet $build_triplet verbose "Assuming native target is $target_triplet" 2 } @@ -778,7 +778,7 @@ proc setup_target_hook { whole_name name } { push_target $whole_name - if { [info procs ${whole_name}_init] != "" } { + if { [info procs ${whole_name}_init] ne "" } { ${whole_name}_init $whole_name } @@ -796,12 +796,12 @@ proc setup_target_hook { whole_name name } { proc cleanup_target_hook { name } { global tool # Clean up the target board. - if { [info procs "${name}_exit"] != "" } { + if { [info procs "${name}_exit"] ne "" } { ${name}_exit } # We also call the tool exit routine here. if {[info exists tool]} { - if { [info procs "${tool}_exit"] != "" } { + if { [info procs "${tool}_exit"] ne "" } { ${tool}_exit } } @@ -821,7 +821,7 @@ proc setup_host_hook { name } { unset board unset board_type push_host $name - if { [info procs ${name}_init] != "" } { + if { [info procs ${name}_init] ne "" } { ${name}_init $name } } @@ -838,7 +838,7 @@ proc setup_build_hook { name } { unset board unset board_type push_build $name - if { [info procs ${name}_init] != "" } { + if { [info procs ${name}_init] ne "" } { ${name}_init $name } } @@ -884,38 +884,38 @@ if {![info exists boards_dir]} { # # build values -if { $build_cpu == "" } { +if { $build_cpu eq "" } { regsub -- "-.*-.*" ${build_triplet} "" build_cpu } -if { $build_vendor == "" } { +if { $build_vendor eq "" } { regsub -- "^\[a-z0-9\]*-" ${build_triplet} "" build_vendor regsub -- "-.*" ${build_vendor} "" build_vendor } -if { $build_os == "" } { +if { $build_os eq "" } { regsub -- ".*-.*-" ${build_triplet} "" build_os } # host values -if { $host_cpu == "" } { +if { $host_cpu eq "" } { regsub -- "-.*-.*" ${host_triplet} "" host_cpu } -if { $host_vendor == "" } { +if { $host_vendor eq "" } { regsub -- "^\[a-z0-9\]*-" ${host_triplet} "" host_vendor regsub -- "-.*" ${host_vendor} "" host_vendor } -if { $host_os == "" } { +if { $host_os eq "" } { regsub -- ".*-.*-" ${host_triplet} "" host_os } # target values -if { $target_cpu == "" } { +if { $target_cpu eq "" } { regsub -- "-.*-.*" ${target_triplet} "" target_cpu } -if { $target_vendor == "" } { +if { $target_vendor eq "" } { regsub -- "^\[a-z0-9\]*-" ${target_triplet} "" target_vendor regsub -- "-.*" ${target_vendor} "" target_vendor } -if { $target_os == "" } { +if { $target_os eq "" } { regsub -- ".*-.*-" ${target_triplet} "" target_os } @@ -1193,7 +1193,7 @@ for { set i 0 } { $i < $argc } { incr i } { default { if {[info exists tool]} { - if { [info procs ${tool}_option_proc] != "" } { + if { [info procs ${tool}_option_proc] ne "" } { if {[${tool}_option_proc $option]} { continue } @@ -1352,7 +1352,7 @@ proc load_board_description { board_name args } { set dirlist {} if { [llength $args] > 1 } { set suffix [lindex $args 1] - if { ${suffix} != "" } { + if { ${suffix} ne "" } { foreach x ${boards_dir} { lappend dirlist ${x}/${suffix} } @@ -1450,7 +1450,7 @@ proc runtest { test_file_name } { set timestart [timestamp] if {[info exists tool]} { - if { [info procs "${tool}_init"] != "" } { + if { [info procs "${tool}_init"] ne "" } { ${tool}_init $test_file_name } } @@ -1475,7 +1475,7 @@ proc runtest { test_file_name } { } if {[info exists tool]} { - if { [info procs "${tool}_finish"] != "" } { + if { [info procs "${tool}_finish"] ne "" } { ${tool}_finish } } @@ -1526,7 +1526,7 @@ proc process_target_variants { target_list } { foreach x $list { foreach i [split $variant_list ","] { set name $x - if { $i != "" } { + if { $i ne "" } { append name "/" $i } lappend result $name @@ -1560,7 +1560,7 @@ proc iterate_target_variants_two { orig_target target variants } { set result {} } } - if { [lindex $variants 0] != "" } { + if { [lindex $variants 0] ne "" } { append target "/" [lindex $variants 0] return [concat $result [iterate_target_variants_two $orig_target $target [lrange $variants 1 end]]] } else { @@ -1575,7 +1575,7 @@ if {[info exists host_board]} { setup_host_hook $host_board } else { set hb [get_local_hostname] - if { $hb != "" } { + if { $hb ne "" } { setup_host_hook $hb } } @@ -1637,7 +1637,7 @@ foreach current_target $target_list { if { [info exists MULTIPASS] } { set multipass $MULTIPASS } - if { $multipass == "" } { + if { $multipass eq "" } { set multipass { "" } } @@ -1650,7 +1650,7 @@ foreach current_target $target_list { set pass "" } - if {$pass != ""} { + if {$pass ne ""} { set passes [list] foreach p $pass { foreach multipass_elem $multipass { @@ -1667,7 +1667,7 @@ foreach current_target $target_list { foreach pass $multipass { # multipass_name is set for `record_test' to use (see framework.exp). - if { [lindex $pass 0] != "" } { + if { [lindex $pass 0] ne "" } { set multipass_name [lindex $pass 0] clone_output "Running pass `$multipass_name' ..." } else { @@ -1693,7 +1693,7 @@ foreach current_target $target_list { # exist and there are no subdirectories in $srcdir, then # we default to srcdir. set test_top_dirs [lsort [getdirs -all ${srcdir} "${tool}*"]] - if { ${test_top_dirs} == "" } { + if { ${test_top_dirs} eq "" } { set test_top_dirs ${srcdir} } else { # JYG: @@ -1745,7 +1745,7 @@ foreach current_target $target_list { foreach x [array names all_runtests] { verbose "trying to glob ${srcdir}/${x}" 2 set s [glob -nocomplain ${srcdir}/$x] - if { $s != "" } { + if { $s ne "" } { set testlist [concat $testlist $s] } } @@ -1753,9 +1753,9 @@ foreach current_target $target_list { # # If we have a list of tests, run all of them. # - if { $testlist != "" } { + if { $testlist ne "" } { foreach test_name $testlist { - if { ${ignoretests} != "" } { + if { ${ignoretests} ne "" } { if { 0 <= [lsearch ${ignoretests} [file tail ${test_name}]]} { continue } @@ -1780,7 +1780,7 @@ foreach current_target $target_list { if { ${dir} != ${srcdir} } { # Ignore this directory if is a directory to be # ignored. - if {[info exists ignoredirs] && $ignoredirs != ""} { + if {[info exists ignoredirs] && $ignoredirs ne ""} { set found 0 foreach directory $ignoredirs { if {[string match "*${directory}*" $dir]} { @@ -1796,7 +1796,7 @@ foreach current_target $target_list { # Run the test if dir_to_run was specified as a # value (for example in MULTIPASS) and the test # directory matches that directory. - if {[info exists dir_to_run] && $dir_to_run != ""} { + if {[info exists dir_to_run] && $dir_to_run ne ""} { # JYG: dir_to_run might be a space delimited list # of directories. Look for match on each item. set found 0 @@ -1815,7 +1815,7 @@ foreach current_target $target_list { # by the user using --directory and the test # directory matches that directory if {[info exists cmdline_dir_to_run] \ - && $cmdline_dir_to_run != ""} { + && $cmdline_dir_to_run ne ""} { # JYG: cmdline_dir_to_run might be a space delimited # list of directories. Look for match on each item. set found 0 @@ -1834,11 +1834,11 @@ foreach current_target $target_list { } foreach test_name [lsort [find ${dir} *.exp]] { - if { ${test_name} == "" } { + if { ${test_name} eq "" } { continue } # Ignore this one if asked to. - if { ${ignoretests} != "" } { + if { ${ignoretests} ne "" } { if { 0 <= [lsearch ${ignoretests} [file tail ${test_name}]]} { continue } diff --git a/testsuite/libdejagnu/tunit.exp b/testsuite/libdejagnu/tunit.exp index 8b66b0a..f79c060 100644 --- a/testsuite/libdejagnu/tunit.exp +++ b/testsuite/libdejagnu/tunit.exp @@ -19,6 +19,6 @@ load_lib "dejagnu.exp" # Execute the test case, and analyse the output -if { [host_execute "unit"] != "" } { +if { [host_execute "unit"] ne "" } { perror "unit had an execution error" 0 } diff --git a/testsuite/runtest.all/load_lib.exp b/testsuite/runtest.all/load_lib.exp index 315272b..f3c6ef0 100644 --- a/testsuite/runtest.all/load_lib.exp +++ b/testsuite/runtest.all/load_lib.exp @@ -34,7 +34,7 @@ verbose "now added libdirs: $libdirs" 2 # the search_dirs again. Use another file for testing the lappend # worked. -if { [load_lib "subfile2"] == ""} { +if { [load_lib "subfile2"] eq ""} { pass "load_lib subfile2 loaded" } else { fail "load_lib subfile2 not found" -- cgit v1.2.3