[gdb/testsuite] Use require for ensure_gdb_index
authorTom de Vries <tdevries@suse.de>
Mon, 11 Oct 2021 10:21:00 +0000 (12:21 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 11 Oct 2021 10:21:00 +0000 (12:21 +0200)
Replace:
...
if { [ensure_gdb_index $binfile] == -1 } {
    return -1
}
...
with:
...
require {ensure_gdb_index $binfile} != -1
...
and consequently, add a missing UNTESTED message.

Tested on x86_64-linux, both with native and target board readnow.

gdb/testsuite/gdb.base/with-mf.exp
gdb/testsuite/gdb.dwarf2/gdb-add-index-symlink.exp
gdb/testsuite/gdb.dwarf2/gdb-add-index.exp
gdb/testsuite/gdb.dwarf2/imported-unit-runto-main.exp
gdb/testsuite/gdb.rust/dwindex.exp
gdb/testsuite/lib/gdb.exp

index d0667b31183df9bc524ec15b50850d7b92818d63..a0f5b279f2de6403a3ca93c3c88f1b2da51e7d19 100644 (file)
@@ -24,9 +24,7 @@ if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \
     return -1
 }
 
-if { [ensure_gdb_index $binfile] == -1 } {
-    return -1
-}
+require {ensure_gdb_index $binfile} != -1
 
 clean_restart $binfile
 
index 74c558ad231dad88af6d7cc46534062bca8bae97..3f09aa8719b4e917987b167375d2a62425a2ac27 100644 (file)
@@ -29,9 +29,7 @@ with_test_prefix non-symlink {
        return -1
     }
 
-    if { [ensure_gdb_index $binfile] == -1 } {
-       return -1
-    }
+    require {ensure_gdb_index $binfile} != -1
 }
 
 # Regenerate exec without index.
index 2a83eb1ac236169ec7eaa7d83505bbc5815b5e4b..17c278e8af127414cd24e7d5cfcfe55171e49e2c 100644 (file)
@@ -27,9 +27,7 @@ if { [prepare_for_testing "failed to prepare" "${testfile}" \
     return -1
 }
 
-if { [ensure_gdb_index $binfile] == -1 } {
-    return -1
-}
+require {ensure_gdb_index $binfile} != -1
 
 # Ok, we have a copy of $binfile with an index.
 # Restart gdb and verify the index was used.
index 9034f4c00857b57ca9993424b858002753dfea9e..b3a7005a8341147e43776203d69c8f8bb4e13059 100644 (file)
@@ -74,9 +74,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
     return -1
 }
 
-if { [ensure_gdb_index $binfile] == -1 } {
-    return -1
-}
+require {ensure_gdb_index $binfile} != -1
 
 clean_restart ${binfile}
 
index 1bc61993240a7016101b90345b037b55ee424eb9..07de0b4b2a502955f6a4879bb67f068131b370fd 100644 (file)
@@ -26,9 +26,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug rust}]} {
     return -1
 }
 
-if {[ensure_gdb_index $binfile "-dwarf-5"] == -1} {
-    return -1
-}
+require {ensure_gdb_index $binfile -dwarf-5} != -1
 
 gdb_exit
 gdb_start
index c2e6595f5942f2d84e2e7cbe0021f66f87c56147..90131fe4ee7dde4429041e51417180083f809a01 100644 (file)
@@ -8247,6 +8247,10 @@ proc require { fn arg1 {arg2 ""} } {
 
     switch "$fn $op $val" {
        "gdb_skip_xml_test == 0" { set msg "missing xml support" }
+       "ensure_gdb_index $binfile != -1" -
+       "ensure_gdb_index $binfile -dwarf-5 != -1" {
+           set msg "Couldn't ensure index in binfile"
+       }
        default { set msg "$fn != $val" }
     }