[08/14] gdb/testsuite: remove use of then keyword from gdb.trace/*.exp

Message ID c3f17e60ad6ab43dfc26aa78b216b84a800bb188.1668508386.git.aburgess@redhat.com
State Committed
Commit 89c6d320b24567b6385e9dd92b3d4671c9796143
Headers
Series Remove all uses of 'then' keyword from the testsuite |

Commit Message

Andrew Burgess Nov. 15, 2022, 10:42 a.m. UTC
  The canonical form of 'if' in modern TCL is 'if {} {}'.  But there's
still a bunch of places in the testsuite where we make use of the
'then' keyword, and sometimes these get copies into new tests, which
just spreads poor practice.

This commit removes all use of the 'then' keyword from the gdb.trace/
test script directory.

There should be no changes in what is tested after this commit.
---
 gdb/testsuite/gdb.trace/actions.exp               |  4 ++--
 gdb/testsuite/gdb.trace/backtrace.exp             |  4 ++--
 gdb/testsuite/gdb.trace/change-loc.exp            |  2 +-
 gdb/testsuite/gdb.trace/collection.exp            |  2 +-
 gdb/testsuite/gdb.trace/deltrace.exp              |  6 +++---
 gdb/testsuite/gdb.trace/infotrace.exp             |  4 ++--
 gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp |  2 +-
 gdb/testsuite/gdb.trace/mi-tsv-changed.exp        |  2 +-
 gdb/testsuite/gdb.trace/no-attach-trace.exp       |  2 +-
 gdb/testsuite/gdb.trace/packetlen.exp             |  2 +-
 gdb/testsuite/gdb.trace/passc-dyn.exp             |  6 +++---
 gdb/testsuite/gdb.trace/passcount.exp             |  4 ++--
 gdb/testsuite/gdb.trace/report.exp                |  4 ++--
 gdb/testsuite/gdb.trace/save-trace.exp            |  2 +-
 gdb/testsuite/gdb.trace/strace.exp                |  2 +-
 gdb/testsuite/gdb.trace/tfind.exp                 | 10 +++++-----
 gdb/testsuite/gdb.trace/tracecmd.exp              |  2 +-
 gdb/testsuite/gdb.trace/tspeed.exp                |  4 ++--
 gdb/testsuite/gdb.trace/tsv.exp                   |  6 +++---
 gdb/testsuite/gdb.trace/unavailable.exp           |  2 +-
 gdb/testsuite/gdb.trace/while-dyn.exp             |  2 +-
 gdb/testsuite/gdb.trace/while-stepping.exp        |  2 +-
 22 files changed, 38 insertions(+), 38 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.trace/actions.exp b/gdb/testsuite/gdb.trace/actions.exp
index c14fb27e3f6..397b30e484b 100644
--- a/gdb/testsuite/gdb.trace/actions.exp
+++ b/gdb/testsuite/gdb.trace/actions.exp
@@ -42,7 +42,7 @@  gdb_file_cmd $binfile
 # all subsequent line numbers are relative to this first one (baseline)
 
 set baseline  [gdb_find_recursion_test_baseline $srcfile]
-if { $baseline == -1 } then {
+if {$baseline == -1} {
     fail "could not find gdb_recursion_test function"
     return
 }
@@ -57,7 +57,7 @@  gdb_delete_tracepoints
 set trcpt1 [gdb_gettpnum gdb_c_test]
 set trcpt2 [gdb_gettpnum gdb_asm_test]
 set trcpt3 [gdb_gettpnum $testline1]
-if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
+if {$trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0} {
     fail "setting tracepoints"
     return
 }
diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp
index ec068b20d4a..20f0a388afc 100644
--- a/gdb/testsuite/gdb.trace/backtrace.exp
+++ b/gdb/testsuite/gdb.trace/backtrace.exp
@@ -35,7 +35,7 @@  if ![runto_main] {
     return -1
 }
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 
@@ -106,7 +106,7 @@  all tests in this module will fail."
     }
 }
 
-if { $return_me == 1 } then {
+if {$return_me == 1} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index 5e31d0c77f6..4710b8d0952 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -53,7 +53,7 @@  if ![runto_main] {
     return -1
 }
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return -1
 }
diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp
index c261b3c824d..c290684e0d8 100644
--- a/gdb/testsuite/gdb.trace/collection.exp
+++ b/gdb/testsuite/gdb.trace/collection.exp
@@ -796,7 +796,7 @@  proc gdb_trace_collection_test {} {
 
 runto_main
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 }
diff --git a/gdb/testsuite/gdb.trace/deltrace.exp b/gdb/testsuite/gdb.trace/deltrace.exp
index 1e2f10f7636..605223aa3db 100644
--- a/gdb/testsuite/gdb.trace/deltrace.exp
+++ b/gdb/testsuite/gdb.trace/deltrace.exp
@@ -43,7 +43,7 @@  gdb_file_cmd $binfile
 # define relative source line numbers:
 # all subsequent line numbers are relative to this first one (baseline)
 set baseline [gdb_find_recursion_test_baseline $srcfile]
-if { $baseline == -1 } then {
+if {$baseline == -1} {
     fail "could not find gdb_recursion_test function"
     return
 }
@@ -81,7 +81,7 @@  gdb_delete_tracepoints
 set trcpt1 [gdb_gettpnum gdb_c_test]
 set trcpt2 [gdb_gettpnum gdb_asm_test]
 set trcpt3 [gdb_gettpnum $testline1]
-if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
+if {$trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0} {
     fail "setting tracepoints"
     return
 }
@@ -159,7 +159,7 @@  gdb_delete_tracepoints
 set trcpt1 [gdb_gettpnum gdb_c_test]
 set trcpt2 [gdb_gettpnum gdb_asm_test]
 set trcpt3 [gdb_gettpnum $testline1]
-if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
+if {$trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0} {
     fail "setting tracepoints"
     return
 }
diff --git a/gdb/testsuite/gdb.trace/infotrace.exp b/gdb/testsuite/gdb.trace/infotrace.exp
index 1504fb36508..912e29123d3 100644
--- a/gdb/testsuite/gdb.trace/infotrace.exp
+++ b/gdb/testsuite/gdb.trace/infotrace.exp
@@ -47,7 +47,7 @@  gdb_file_cmd $binfile
 gdb_delete_tracepoints
 set c_test_num [gdb_gettpnum gdb_c_test]
 set asm_test_num [gdb_gettpnum gdb_asm_test]
-if { $c_test_num <= 0 || $asm_test_num <= 0 } then {
+if {$c_test_num <= 0 || $asm_test_num <= 0} {
     fail "setting tracepoints"
     return
 }
@@ -111,7 +111,7 @@  if {[gdb_test "" "Breakpoint ${decimal}, main.*" "run to main"] != 0} {
     return -1
 }
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 }
diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
index 517e0394e06..abf5fec1ba2 100644
--- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
@@ -69,7 +69,7 @@  proc test_reconnect { } {
 	clean_restart $executable
 	gdb_load_shlib $lib_sl1
 	gdb_load_shlib $lib_sl2
-	if ![runto_main] then {
+	if {![runto_main]} {
 	    return 0
 	}
 	# Create tracepoints on marker and main, and leave them in the
diff --git a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
index 96251c900e7..a2cfa70b8f3 100644
--- a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
@@ -151,7 +151,7 @@  proc test_upload_tsv { } {
 	}
 
 	clean_restart $testfile
-	if ![runto_main] then {
+	if {![runto_main]} {
 	    return 0
 	}
 
diff --git a/gdb/testsuite/gdb.trace/no-attach-trace.exp b/gdb/testsuite/gdb.trace/no-attach-trace.exp
index b16ca83afa6..67a908de575 100644
--- a/gdb/testsuite/gdb.trace/no-attach-trace.exp
+++ b/gdb/testsuite/gdb.trace/no-attach-trace.exp
@@ -30,7 +30,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
 # can start programs ("run"), such as e.g., extended-remote gdbserver.
 clean_restart $testfile
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 }
diff --git a/gdb/testsuite/gdb.trace/packetlen.exp b/gdb/testsuite/gdb.trace/packetlen.exp
index 9f019acaa00..0330e82c1a0 100644
--- a/gdb/testsuite/gdb.trace/packetlen.exp
+++ b/gdb/testsuite/gdb.trace/packetlen.exp
@@ -37,7 +37,7 @@  gdb_test "tfind none"  ".*" ""
 runto_main
 gdb_reinitialize_dir $srcdir/$subdir
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 
diff --git a/gdb/testsuite/gdb.trace/passc-dyn.exp b/gdb/testsuite/gdb.trace/passc-dyn.exp
index 747e4207dd0..63f4788d07b 100644
--- a/gdb/testsuite/gdb.trace/passc-dyn.exp
+++ b/gdb/testsuite/gdb.trace/passc-dyn.exp
@@ -34,7 +34,7 @@  gdb_load $binfile
 runto_main
 gdb_reinitialize_dir $srcdir/$subdir
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 
@@ -50,7 +50,7 @@  if { ![gdb_target_supports_trace] } then {
 
 set baseline [gdb_find_recursion_test_baseline $srcfile]
 
-if { $baseline == -1 } then {
+if {$baseline == -1} {
     fail "could not find gdb_recursion_test function"
     return
 }
@@ -74,7 +74,7 @@  gdb_delete_tracepoints
 set tdp2 [gdb_gettpnum "$testline2"]
 set tdp3 [gdb_gettpnum "$testline3"]
 set tdp4 [gdb_gettpnum "$testline4"]
-if { $tdp2 <= 0 || $tdp3 <= 0 || $tdp4 <= 0 } then {
+if {$tdp2 <= 0 || $tdp3 <= 0 || $tdp4 <= 0} {
     fail "setting tracepoints"
     return
 }
diff --git a/gdb/testsuite/gdb.trace/passcount.exp b/gdb/testsuite/gdb.trace/passcount.exp
index 52c95c53367..bbb3be7d583 100644
--- a/gdb/testsuite/gdb.trace/passcount.exp
+++ b/gdb/testsuite/gdb.trace/passcount.exp
@@ -40,7 +40,7 @@  gdb_file_cmd $binfile
 # define relative source line numbers:
 # all subsequent line numbers are relative to this first one (baseline)
 set baseline  [gdb_find_recursion_test_baseline $srcfile]
-if { $baseline == -1 } then {
+if {$baseline == -1} {
     fail "could not find gdb_recursion_test function"
     return
 }
@@ -55,7 +55,7 @@  gdb_delete_tracepoints
 set trcpt1 [gdb_gettpnum gdb_c_test]
 set trcpt2 [gdb_gettpnum gdb_asm_test]
 set trcpt3 [gdb_gettpnum $testline1]
-if { $trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0 } then {
+if {$trcpt1 <= 0 || $trcpt2 <= 0 || $trcpt3 <= 0} {
     fail "setting tracepoints"
     return
 }
diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
index 7b3678d29f3..33e803bd4fe 100644
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -35,7 +35,7 @@  gdb_load $binfile
 runto_main
 gdb_reinitialize_dir $srcdir/$subdir
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 
@@ -111,7 +111,7 @@  all tests in this module will fail."
     } 
 }
 
-if { $return_me == 1 } then {
+if {$return_me == 1} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.trace/save-trace.exp b/gdb/testsuite/gdb.trace/save-trace.exp
index 0eac0b5503c..ddeb20360aa 100644
--- a/gdb/testsuite/gdb.trace/save-trace.exp
+++ b/gdb/testsuite/gdb.trace/save-trace.exp
@@ -41,7 +41,7 @@  gdb_file_cmd $binfile
 # define relative source line numbers:
 # all subsequent line numbers are relative to this first one (baseline)
 set baseline  [gdb_find_recursion_test_baseline $srcfile]
-if { $baseline == -1 } then {
+if {$baseline == -1} {
     fail "could not find gdb_recursion_test function"
     return
 }
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index d015381899b..2e754891903 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -370,7 +370,7 @@  gdb_load_shlib $libipa
 if ![runto_main] {
     return -1
 }
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     # At this point, the socket file has been created.  We must make sure it is
     # removed when we return here.  GDB detaches inferior so that the socket
     # file can be removed.  Note that GDB simply kill inferior doesn't remove
diff --git a/gdb/testsuite/gdb.trace/tfind.exp b/gdb/testsuite/gdb.trace/tfind.exp
index 57b7b2fad70..66b744fc11b 100644
--- a/gdb/testsuite/gdb.trace/tfind.exp
+++ b/gdb/testsuite/gdb.trace/tfind.exp
@@ -65,7 +65,7 @@  gdb_test "help tfind trace" "Select a trace frame by tracepoint number.*" \
 runto_main
 gdb_reinitialize_dir $srcdir/$subdir
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 
@@ -77,7 +77,7 @@  if { ![gdb_target_supports_trace] } then {
 # define relative source line numbers:
 # all subsequent line numbers are relative to this first one (baseline)
 set baseline  [gdb_find_recursion_test_baseline $srcfile]
-if { $baseline == -1 } then {
+if {$baseline == -1} {
     fail "could not find gdb_recursion_test function"
     return
 }
@@ -123,7 +123,7 @@  gdb_test_multiple "tstart" "6.1: tstart" {
     }
 }
 
-if { $return_me == 1 } then {
+if {$return_me == 1} {
     return -1
 }
 
@@ -154,7 +154,7 @@  gdb_test_multiple "tstop" "7.1: tstop" {
     }
 }
 
-if { $return_me == 1 } then {
+if {$return_me == 1} {
     return -1
 }
 
@@ -164,7 +164,7 @@  gdb_test "tstatus" "Trace stopped by a tstop command.*" \
 
 ## record starting PC
 set save_pc [gdb_readexpr "(unsigned long) \$pc"]
-if { $save_pc == -1 } then {
+if {$save_pc == -1} {
     fail "could not read PC"
     return
 }
diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp
index c2ec95a7a4e..4bc16b1d344 100644
--- a/gdb/testsuite/gdb.trace/tracecmd.exp
+++ b/gdb/testsuite/gdb.trace/tracecmd.exp
@@ -40,7 +40,7 @@  gdb_file_cmd $binfile
 # define relative source line numbers:
 # all subsequent line numbers are relative to this first one (baseline)
 set baseline  [gdb_find_recursion_test_baseline $srcfile]
-if { $baseline == -1 } then {
+if {$baseline == -1} {
     fail "could not find gdb_recursion_test function"
     return
 }
diff --git a/gdb/testsuite/gdb.trace/tspeed.exp b/gdb/testsuite/gdb.trace/tspeed.exp
index ba64176596b..80ec962c042 100644
--- a/gdb/testsuite/gdb.trace/tspeed.exp
+++ b/gdb/testsuite/gdb.trace/tspeed.exp
@@ -139,7 +139,7 @@  proc_with_prefix gdb_fast_trace_speed_test { } {
 	}
 
     # If the fast tracepoint couldn't be set, don't bother with the run.
-    if { $run_ftrace == 1 } then {
+    if {$run_ftrace == 1} {
 
 	# Begin the test.
 	run_trace_experiment
@@ -160,7 +160,7 @@  gdb_load_shlib $ipalib
 
 runto_main
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 }
diff --git a/gdb/testsuite/gdb.trace/tsv.exp b/gdb/testsuite/gdb.trace/tsv.exp
index abf858963de..e51e7d654b1 100644
--- a/gdb/testsuite/gdb.trace/tsv.exp
+++ b/gdb/testsuite/gdb.trace/tsv.exp
@@ -113,7 +113,7 @@  runto_main
 gdb_reinitialize_dir $srcdir/$subdir
 
 # The rest of the testing needs actual tracing to work.
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 }
@@ -121,7 +121,7 @@  if { ![gdb_target_supports_trace] } then {
 gdb_delete_tracepoints
 set trcpt1 [gdb_gettpnum gdb_c_test]
 
-if { $trcpt1 <= 0 } then {
+if {$trcpt1 <= 0} {
     fail "setting tracepoints"
     return
 }
@@ -200,7 +200,7 @@  gdb_test_multiple "target ctf ${tracefile}.ctf" "" {
 # Restart.
 clean_restart ${binfile}
 
-if ![runto_main] then {
+if {![runto_main]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 9e1124edc6e..82a6014c1bc 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -731,7 +731,7 @@  proc gdb_trace_collection_test {} {
 
 runto_main
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 }
diff --git a/gdb/testsuite/gdb.trace/while-dyn.exp b/gdb/testsuite/gdb.trace/while-dyn.exp
index c77bad73c2d..0085e0aad48 100644
--- a/gdb/testsuite/gdb.trace/while-dyn.exp
+++ b/gdb/testsuite/gdb.trace/while-dyn.exp
@@ -36,7 +36,7 @@  gdb_load $binfile
 runto_main
 gdb_reinitialize_dir $srcdir/$subdir
 
-if { ![gdb_target_supports_trace] } then {
+if {![gdb_target_supports_trace]} {
     unsupported "current target does not support trace"
     return 1
 }
diff --git a/gdb/testsuite/gdb.trace/while-stepping.exp b/gdb/testsuite/gdb.trace/while-stepping.exp
index 77641b8a130..3d1b29bab02 100644
--- a/gdb/testsuite/gdb.trace/while-stepping.exp
+++ b/gdb/testsuite/gdb.trace/while-stepping.exp
@@ -44,7 +44,7 @@  gdb_file_cmd $binfile
 
 gdb_delete_tracepoints
 set trcpt1 [gdb_gettpnum gdb_c_test]
-if { $trcpt1 <= 0 } then {
+if {$trcpt1 <= 0} {
     fail "could not find gdb_c_test function"
     return
 }