Remove "then" from test suite

Message ID 20241212151240.2264889-1-tromey@adacore.com
State New
Headers
Series Remove "then" from test suite |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Tom Tromey Dec. 12, 2024, 3:12 p.m. UTC
  This removes the "then" keyword from the test suite.  Andrew did this
once before, but some new ones crept in.

This also adds braces to the "if" conditions and normalizes the
failures to just use "return".
---
 gdb/testsuite/gdb.ada/str_chars.exp                        | 4 ++--
 gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp           | 4 ++--
 gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp             | 4 ++--
 gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp        | 4 ++--
 gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp               | 4 ++--
 gdb/testsuite/gdb.base/value-history-unavailable.exp       | 5 ++---
 gdb/testsuite/gdb.python/py-connection-removed.exp         | 4 ++--
 gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp | 4 ++--
 gdb/testsuite/gdb.python/py-watchpoint.exp                 | 2 +-
 9 files changed, 17 insertions(+), 18 deletions(-)
  

Comments

Tom Tromey Jan. 6, 2025, 2:01 p.m. UTC | #1
>>>>> "Tom" == Tom Tromey <tromey@adacore.com> writes:

Tom> This removes the "then" keyword from the test suite.  Andrew did this
Tom> once before, but some new ones crept in.

Tom> This also adds braces to the "if" conditions and normalizes the
Tom> failures to just use "return".

I'm checking this in.

Tom
  

Patch

diff --git a/gdb/testsuite/gdb.ada/str_chars.exp b/gdb/testsuite/gdb.ada/str_chars.exp
index 6d494d3ee2c..f459e3cb6d3 100644
--- a/gdb/testsuite/gdb.ada/str_chars.exp
+++ b/gdb/testsuite/gdb.ada/str_chars.exp
@@ -28,8 +28,8 @@  if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" }
 clean_restart ${testfile}
 
 set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.adb]
-if ![runto "foo.adb:$bp_location" ] then {
-  return -1
+if {![runto "foo.adb:$bp_location"]} {
+    return
 }
 
 gdb_test "print Arg" \
diff --git a/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp b/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp
index 4319623ebc4..8b7c14812a1 100644
--- a/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp
+++ b/gdb/testsuite/gdb.arch/aarch64-pseudo-unwind.exp
@@ -31,8 +31,8 @@  if { [prepare_for_testing "failed to prepare" ${testfile} \
 
 clean_restart ${binfile}
 
-if ![runto_main] then {
-    fail "could not run to main"
+if {![runto_main]} {
+    return
 }
 
 gdb_breakpoint break_here_asm temporary
diff --git a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp
index f035f8706e7..fa82bef6448 100644
--- a/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp
+++ b/gdb/testsuite/gdb.arch/amd64-pseudo-unwind.exp
@@ -34,8 +34,8 @@  if { [prepare_for_testing "failed to prepare" ${testfile} \
 
 clean_restart ${binfile}
 
-if ![runto_main] then {
-    fail "could not run to main"
+if {![runto_main]} {
+    return
 }
 
 gdb_breakpoint break_here_asm temporary
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp
index a8ffab06edf..bfedff245c7 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind-legacy.exp
@@ -36,8 +36,8 @@  if { [prepare_for_testing "failed to prepare" ${testfile} \
 
 clean_restart ${binfile}
 
-if ![runto_main] then {
-    fail "could not run to main"
+if {![runto_main]} {
+    return
 }
 
 gdb_breakpoint break_here_asm temporary
diff --git a/gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp b/gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp
index 0a915c54191..004c606759f 100644
--- a/gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp
+++ b/gdb/testsuite/gdb.arch/arm-pseudo-unwind.exp
@@ -31,8 +31,8 @@  if { [prepare_for_testing "failed to prepare" ${testfile} \
 
 clean_restart ${binfile}
 
-if ![runto_main] then {
-    fail "could not run to main"
+if {![runto_main]} {
+    return
 }
 
 gdb_breakpoint break_here_asm temporary
diff --git a/gdb/testsuite/gdb.base/value-history-unavailable.exp b/gdb/testsuite/gdb.base/value-history-unavailable.exp
index 0086706bc90..8dc25dbc521 100644
--- a/gdb/testsuite/gdb.base/value-history-unavailable.exp
+++ b/gdb/testsuite/gdb.base/value-history-unavailable.exp
@@ -21,9 +21,8 @@  if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-if ![runto_main] then {
-    perror "couldn't run to breakpoint"
-    continue
+if {![runto_main]} {
+    return
 }
 
 set target_char_mask [get_valueof "/u" "a.x\[0]" "255" "get target char mask"]
diff --git a/gdb/testsuite/gdb.python/py-connection-removed.exp b/gdb/testsuite/gdb.python/py-connection-removed.exp
index 117075a6b6a..28c71da865f 100644
--- a/gdb/testsuite/gdb.python/py-connection-removed.exp
+++ b/gdb/testsuite/gdb.python/py-connection-removed.exp
@@ -33,8 +33,8 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] then {
-    return 0
+if {![runto_main]} {
+    return
 }
 
 # Register a callback that will trigger when a connection is removed
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp
index 84e839b2117..4aed5c5ea93 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint-deletion.exp
@@ -25,8 +25,8 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
     return -1
 }
 
-if ![runto_main] then {
-    return 0
+if {![runto_main]} {
+    return
 }
 
 # For remote host testing
diff --git a/gdb/testsuite/gdb.python/py-watchpoint.exp b/gdb/testsuite/gdb.python/py-watchpoint.exp
index a3c0d7d03ea..93619562d3a 100644
--- a/gdb/testsuite/gdb.python/py-watchpoint.exp
+++ b/gdb/testsuite/gdb.python/py-watchpoint.exp
@@ -25,7 +25,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile]} {
 
 require allow_python_tests
 
-if ![runto_main] then {
+if {![runto_main]} {
     return
 }