This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[testsuite] Use [string compare] instead of eq and ne
- From: Pedro Alves <pedro_alves at portugalmail dot pt>
- To: gdb-patches at sourceware dot org
- Date: Mon, 29 Oct 2007 22:54:22 +0000
- Subject: [testsuite] Use [string compare] instead of eq and ne
Hi,
My kubuntu 6.06 comes with a version of expect that doesn't
understand eq or ne operators. I can't see them being used
anywhere else in the whole testsuite, so I take it they
shouldn't really be used.
Without this patch, the sepdebug.exp was untested
due to tcl errors.
Cheers,
Pedro Alves
2007-10-29 Pedro Alves <pedro_alves@portugalmail.pt>
* lib/gdb.exp, gdb.base/sepdebug.exp: Replace usage of eq and ne
with [string compare].
---
gdb/testsuite/gdb.base/sepdebug.exp | 6 +++---
gdb/testsuite/lib/gdb.exp | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
Index: src/gdb/testsuite/gdb.base/sepdebug.exp
===================================================================
--- src.orig/gdb/testsuite/gdb.base/sepdebug.exp 2007-10-29 20:33:26.000000000 +0000
+++ src/gdb/testsuite/gdb.base/sepdebug.exp 2007-10-29 20:34:20.000000000 +0000
@@ -955,7 +955,7 @@ test_different_dir debuglink "${objdir}/
# NT_GNU_BUILD_ID / .note.gnu.build-id test:
set build_id_debug_filename [build_id_debug_filename_get $binfile]
-if {$build_id_debug_filename eq ""} {
+if ![string compare $build_id_debug_filename ""] then {
unsupported "build-id is not supported by the compiler"
# Spare debug files may confuse testsuite runs in the future.
@@ -964,10 +964,10 @@ if {$build_id_debug_filename eq ""} {
set build_id_debugself_filename [build_id_debug_filename_get $debugfile]
set test "build-id support by binutils"
set xfail 0
- if {$build_id_debugself_filename eq ""} {
+ if ![string compare $build_id_debugself_filename ""] then {
unsupported $test
set xfail 1
- } elseif {$build_id_debugself_filename ne $build_id_debug_filename} {
+ } elseif {[string compare $build_id_debugself_filename $build_id_debug_filename] != 0} then {
fail $test
} else {
pass $test
Index: src/gdb/testsuite/lib/gdb.exp
===================================================================
--- src.orig/gdb/testsuite/lib/gdb.exp 2007-10-29 20:33:14.000000000 +0000
+++ src/gdb/testsuite/lib/gdb.exp 2007-10-29 20:33:30.000000000 +0000
@@ -2505,7 +2505,7 @@ proc build_id_debug_filename_get { exec
set data [read $fi]
close $fi
file delete $tmp
- if {$data eq ""} {
+ if ![string compare $data ""] then {
return ""
}
# Convert it to hex.