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

Message ID 1747743801c7fca7b28cf71fccf455c0e55c630c.1668508386.git.aburgess@redhat.com
State Committed
Commit b0e16ca58d444a2b6dc2b4f71081d6c761d9712e
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.python/
test script directory.

There should be no changes in what is tested after this commit.
---
 gdb/testsuite/gdb.python/lib-types.exp        |  2 +-
 .../gdb.python/pretty-print-call-by-hand.exp  |  4 +--
 gdb/testsuite/gdb.python/py-bad-printers.exp  |  2 +-
 gdb/testsuite/gdb.python/py-block.exp         |  2 +-
 gdb/testsuite/gdb.python/py-breakpoint.exp    | 28 +++++++++----------
 gdb/testsuite/gdb.python/py-cmd.exp           |  2 +-
 gdb/testsuite/gdb.python/py-connection.exp    |  2 +-
 gdb/testsuite/gdb.python/py-disasm.exp        |  2 +-
 gdb/testsuite/gdb.python/py-events.exp        |  2 +-
 .../gdb.python/py-finish-breakpoint.exp       | 16 +++++------
 .../gdb.python/py-finish-breakpoint2.exp      |  2 +-
 gdb/testsuite/gdb.python/py-format-string.exp |  2 +-
 gdb/testsuite/gdb.python/py-frame-inline.exp  |  2 +-
 gdb/testsuite/gdb.python/py-frame.exp         |  2 +-
 .../gdb.python/py-framefilter-invalidarg.exp  |  2 +-
 gdb/testsuite/gdb.python/py-framefilter.exp   |  4 +--
 gdb/testsuite/gdb.python/py-inferior.exp      |  2 +-
 gdb/testsuite/gdb.python/py-infthread.exp     |  2 +-
 gdb/testsuite/gdb.python/py-nested-maps.exp   |  2 +-
 gdb/testsuite/gdb.python/py-objfile.exp       |  2 +-
 .../gdb.python/py-pending-frame-level.exp     |  2 +-
 gdb/testsuite/gdb.python/py-pp-maint.exp      |  2 +-
 gdb/testsuite/gdb.python/py-prettyprint.exp   |  4 +--
 gdb/testsuite/gdb.python/py-rbreak.exp        |  2 +-
 gdb/testsuite/gdb.python/py-record-btrace.exp |  2 +-
 gdb/testsuite/gdb.python/py-record-full.exp   |  2 +-
 .../gdb.python/py-recurse-unwind.exp          |  2 +-
 gdb/testsuite/gdb.python/py-shared.exp        |  2 +-
 gdb/testsuite/gdb.python/py-symbol.exp        |  6 ++--
 gdb/testsuite/gdb.python/py-symtab.exp        |  2 +-
 gdb/testsuite/gdb.python/py-template.exp      |  2 +-
 gdb/testsuite/gdb.python/py-type.exp          |  2 +-
 gdb/testsuite/gdb.python/py-unwind-inline.exp |  2 +-
 gdb/testsuite/gdb.python/py-unwind-maint.exp  |  2 +-
 .../gdb.python/py-unwind-user-regs.exp        |  2 +-
 gdb/testsuite/gdb.python/py-unwind.exp        |  2 +-
 gdb/testsuite/gdb.python/py-value.exp         |  4 +--
 gdb/testsuite/gdb.python/python.exp           |  6 ++--
 38 files changed, 66 insertions(+), 66 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.python/lib-types.exp b/gdb/testsuite/gdb.python/lib-types.exp
index a01e9d76219..35da9113621 100644
--- a/gdb/testsuite/gdb.python/lib-types.exp
+++ b/gdb/testsuite/gdb.python/lib-types.exp
@@ -27,7 +27,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
index eb3fc9e35fa..76386bb6df1 100644
--- a/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
+++ b/gdb/testsuite/gdb.python/pretty-print-call-by-hand.exp
@@ -47,7 +47,7 @@  proc start_test { breakpoint_comment } {
 
     clean_restart ${binfile}
 
-    if { ![runto_main] } then {
+    if {![runto_main]} {
 	untested "couldn't run to breakpoint"
 	return -1
     }
@@ -66,7 +66,7 @@  proc start_test { breakpoint_comment } {
 
 # Start by testing the "run" command, it can't leverage start_test
 with_test_prefix "run to frame" {
-    if { ![runto_main] } then {
+    if {![runto_main]} {
 	untested "couldn't run to main"
     }
 
diff --git a/gdb/testsuite/gdb.python/py-bad-printers.exp b/gdb/testsuite/gdb.python/py-bad-printers.exp
index 2ef7f487eda..01654ad024b 100644
--- a/gdb/testsuite/gdb.python/py-bad-printers.exp
+++ b/gdb/testsuite/gdb.python/py-bad-printers.exp
@@ -27,7 +27,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main ] then {
+if {![runto_main]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.python/py-block.exp b/gdb/testsuite/gdb.python/py-block.exp
index 0bc020aee9e..0a88aec56a0 100644
--- a/gdb/testsuite/gdb.python/py-block.exp
+++ b/gdb/testsuite/gdb.python/py-block.exp
@@ -27,7 +27,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp
index c3215b13d5c..e36e87dc291 100644
--- a/gdb/testsuite/gdb.python/py-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-breakpoint.exp
@@ -46,7 +46,7 @@  proc_with_prefix test_bkpt_basic { } {
     # We should start with no breakpoints.
     gdb_test "python print (gdb.breakpoints())" "\\(\\)"
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -128,7 +128,7 @@  proc_with_prefix test_bkpt_deletion { } {
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -163,7 +163,7 @@  proc_with_prefix test_bkpt_cond_and_cmds { } {
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -220,7 +220,7 @@  proc_with_prefix test_bkpt_invisible { } {
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -265,7 +265,7 @@  proc_with_prefix test_hardware_breakpoints { } {
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -293,7 +293,7 @@  proc_with_prefix test_watchpoints { } {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -316,7 +316,7 @@  proc_with_prefix test_bkpt_internal { } {
     if {$skip_hw_watchpoint_tests_p} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
     delete_breakpoints
@@ -364,7 +364,7 @@  proc_with_prefix test_bkpt_eval_funcs { } {
     if {$skip_hw_watchpoint_tests_p} {
 	gdb_test_no_output "set can-use-hw-watchpoints 0" ""
     }
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
     delete_breakpoints
@@ -477,7 +477,7 @@  proc_with_prefix test_bkpt_temporary { } {
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
     delete_breakpoints
@@ -595,7 +595,7 @@  proc_with_prefix test_bkpt_explicit_loc {} {
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -680,7 +680,7 @@  proc_with_prefix test_bkpt_qualified {} {
     set one_location_re "Breakpoint $decimal at $hex:.*line $decimal."
     set two_location_re "Breakpoint $decimal at $hex:.*2 locations."
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -749,7 +749,7 @@  proc_with_prefix test_bkpt_probe {} {
 	return -1
     }
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -766,7 +766,7 @@  proc_with_prefix test_catchpoints {} {
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -825,7 +825,7 @@  proc_with_prefix test_bkpt_auto_disable { } {
     # Start with a fresh gdb.
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
     delete_breakpoints
diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp
index 82f1c357518..aa95a459f46 100644
--- a/gdb/testsuite/gdb.python/py-cmd.exp
+++ b/gdb/testsuite/gdb.python/py-cmd.exp
@@ -27,7 +27,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-connection.exp b/gdb/testsuite/gdb.python/py-connection.exp
index 91315eb1af4..fc212fc09c0 100644
--- a/gdb/testsuite/gdb.python/py-connection.exp
+++ b/gdb/testsuite/gdb.python/py-connection.exp
@@ -29,7 +29,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-disasm.exp b/gdb/testsuite/gdb.python/py-disasm.exp
index 1f94d3e60f3..2fe20c39d83 100644
--- a/gdb/testsuite/gdb.python/py-disasm.exp
+++ b/gdb/testsuite/gdb.python/py-disasm.exp
@@ -27,7 +27,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} "debug"] }
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     fail "can't run to main"
     return 0
 }
diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp
index 94762739cd4..ce9342afaff 100644
--- a/gdb/testsuite/gdb.python/py-events.exp
+++ b/gdb/testsuite/gdb.python/py-events.exp
@@ -317,7 +317,7 @@  with_test_prefix "gdb exiting: normal" {
 with_test_prefix "gdb exiting: error" {
     clean_restart ${testfile}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	fail "cannot run to main."
 	return 0
     }
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
index c525337990e..2f6c2f78e67 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp
@@ -50,7 +50,7 @@  with_test_prefix "normal conditions" {
     clean_restart ${testfile}
     gdb_load_shlib ${lib_sl}
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -102,7 +102,7 @@  with_test_prefix "no debug symbol" {
 	"import python scripts"
     set cond_line [gdb_get_line_number "Condition Break."]
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -129,7 +129,7 @@  with_test_prefix "function returned by longjump" {
     gdb_test "source $python_file" "Python script imported.*" \
 	"import python scripts"
 
-    if ![runto call_longjmp_1] then {
+    if {![runto call_longjmp_1]} {
 	return
     }
 
@@ -157,7 +157,7 @@  with_test_prefix "finish in dummy frame" {
 	"import python scripts"
 
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -184,7 +184,7 @@  with_test_prefix "finish in normal frame" {
     gdb_test "source $python_file" "Python script imported.*" \
 	"import python scripts"
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -213,7 +213,7 @@  with_test_prefix "explicit inferior function call" {
     gdb_test "source $python_file" "Python script imported.*" \
 	"import python scripts"
 
-    if ![runto_main] then {
+    if {![runto_main]} {
 	return 0
     }
 
@@ -240,7 +240,7 @@  with_test_prefix "explicit inferior function call" {
 #
 
 with_test_prefix "inferior exit" {
-    if ![runto "test_exec_exit"] then {
+    if {![runto "test_exec_exit"]} {
 	return 0
     }
 
@@ -254,7 +254,7 @@  with_test_prefix "inferior exit" {
 #
 
 with_test_prefix "inferior exec" {
-    if ![runto "test_exec_exit"] then {
+    if {![runto "test_exec_exit"]} {
 	return 0
     }
 
diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
index 6ad0bef88ea..30758473d40 100644
--- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
+++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp
@@ -27,7 +27,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-format-string.exp b/gdb/testsuite/gdb.python/py-format-string.exp
index 45b08512c0c..26b18ce1ab0 100644
--- a/gdb/testsuite/gdb.python/py-format-string.exp
+++ b/gdb/testsuite/gdb.python/py-format-string.exp
@@ -52,7 +52,7 @@  proc prepare_gdb {exefile} {
   gdb_reinitialize_dir $srcdir/$subdir
   gdb_load ${exefile}
 
-  if ![runto_main] then {
+  if {![runto_main]} {
       perror "couldn't run to breakpoint"
       return
   }
diff --git a/gdb/testsuite/gdb.python/py-frame-inline.exp b/gdb/testsuite/gdb.python/py-frame-inline.exp
index 44726cae0c4..791749c27c6 100644
--- a/gdb/testsuite/gdb.python/py-frame-inline.exp
+++ b/gdb/testsuite/gdb.python/py-frame-inline.exp
@@ -24,7 +24,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp
index 56e1ecdcedd..27130a95d79 100644
--- a/gdb/testsuite/gdb.python/py-frame.exp
+++ b/gdb/testsuite/gdb.python/py-frame.exp
@@ -29,7 +29,7 @@  if { [skip_python_tests] } { continue }
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
index 5fbce55ef3a..81c434046a4 100644
--- a/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter-invalidarg.exp
@@ -51,7 +51,7 @@  gdb_load ${binfile}
 gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*" \
     "Test auto-load had loaded python scripts"
 
-if ![runto_main] then {
+if {![runto_main]} {
     perror "couldn't run to breakpoint"
     return
 }
diff --git a/gdb/testsuite/gdb.python/py-framefilter.exp b/gdb/testsuite/gdb.python/py-framefilter.exp
index 7a172e72d33..794d1c2944c 100644
--- a/gdb/testsuite/gdb.python/py-framefilter.exp
+++ b/gdb/testsuite/gdb.python/py-framefilter.exp
@@ -52,7 +52,7 @@  gdb_load ${binfile}
 gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*" \
     "Test auto-load had loaded python scripts"
 
-if ![runto_main] then {
+if {![runto_main]} {
     perror "couldn't run to breakpoint"
     return
 }
@@ -310,7 +310,7 @@  gdb_load ${binfile}
 # Verify gdb loaded the script.
 gdb_test "info auto-load python-scripts" "Yes.*${testfile}-gdb.py.*" \
     "Set autoload path for no debug info tests"
-if ![runto_main] then {
+if {![runto_main]} {
     perror "couldn't run to breakpoint"
     return
 }
diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp
index 552f9b17f4d..8fcd97a1b8d 100644
--- a/gdb/testsuite/gdb.python/py-inferior.exp
+++ b/gdb/testsuite/gdb.python/py-inferior.exp
@@ -37,7 +37,7 @@  switch [get_endianness] {
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-infthread.exp b/gdb/testsuite/gdb.python/py-infthread.exp
index a7754198e60..4ca2b86a63c 100644
--- a/gdb/testsuite/gdb.python/py-infthread.exp
+++ b/gdb/testsuite/gdb.python/py-infthread.exp
@@ -40,7 +40,7 @@  gdb_test_multiline "install new_thread event handler" \
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-nested-maps.exp b/gdb/testsuite/gdb.python/py-nested-maps.exp
index 70d4f771ec5..ea71a793aee 100644
--- a/gdb/testsuite/gdb.python/py-nested-maps.exp
+++ b/gdb/testsuite/gdb.python/py-nested-maps.exp
@@ -34,7 +34,7 @@  if { [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] } {
     return -1
 }
 
-if ![runto_main ] then {
+if {![runto_main]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index 9565c16af96..80f2e794947 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -27,7 +27,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-pending-frame-level.exp b/gdb/testsuite/gdb.python/py-pending-frame-level.exp
index 57ee6b634cc..3cf8d4d639e 100644
--- a/gdb/testsuite/gdb.python/py-pending-frame-level.exp
+++ b/gdb/testsuite/gdb.python/py-pending-frame-level.exp
@@ -26,7 +26,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-pp-maint.exp b/gdb/testsuite/gdb.python/py-pp-maint.exp
index 8d8974c94c5..19cabe847f2 100644
--- a/gdb/testsuite/gdb.python/py-pp-maint.exp
+++ b/gdb/testsuite/gdb.python/py-pp-maint.exp
@@ -32,7 +32,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main ] then {
+if {![runto_main]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp
index c6040059cea..46a346c194b 100644
--- a/gdb/testsuite/gdb.python/py-prettyprint.exp
+++ b/gdb/testsuite/gdb.python/py-prettyprint.exp
@@ -42,7 +42,7 @@  proc run_lang_tests {exefile lang} {
     gdb_reinitialize_dir $srcdir/$subdir
     gdb_load ${exefile}
 
-    if ![runto_main ] then {
+    if {![runto_main]} {
 	perror "couldn't run to breakpoint"
 	return
     }
@@ -198,7 +198,7 @@  gdb_start
 gdb_reinitialize_dir $srcdir/$subdir
 gdb_load ${binfile}
 
-if ![runto_main ] then {
+if {![runto_main]} {
     perror "couldn't run to breakpoint"
     return
 }
diff --git a/gdb/testsuite/gdb.python/py-rbreak.exp b/gdb/testsuite/gdb.python/py-rbreak.exp
index 4c641c9cb96..f32cffc6e57 100644
--- a/gdb/testsuite/gdb.python/py-rbreak.exp
+++ b/gdb/testsuite/gdb.python/py-rbreak.exp
@@ -27,7 +27,7 @@  if {[prepare_for_testing "failed to prepare" ${testfile} [list $srcfile $srcfile
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp
index e9fdd06154e..bbaf268c86a 100644
--- a/gdb/testsuite/gdb.python/py-record-btrace.exp
+++ b/gdb/testsuite/gdb.python/py-record-btrace.exp
@@ -35,7 +35,7 @@  if { [skip_python_tests] } {
     return -1
 }
 
-if ![runto_main ] then {
+if {![runto_main]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.python/py-record-full.exp b/gdb/testsuite/gdb.python/py-record-full.exp
index f3ccefa275c..52d6dd3da0b 100644
--- a/gdb/testsuite/gdb.python/py-record-full.exp
+++ b/gdb/testsuite/gdb.python/py-record-full.exp
@@ -35,7 +35,7 @@  if { [skip_python_tests] } {
     return -1
 }
 
-if ![runto_main ] then {
+if {![runto_main]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.python/py-recurse-unwind.exp b/gdb/testsuite/gdb.python/py-recurse-unwind.exp
index 6361417ca9c..711b8b0995f 100644
--- a/gdb/testsuite/gdb.python/py-recurse-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-recurse-unwind.exp
@@ -40,7 +40,7 @@  gdb_test "source ${pyfile}" "Python script imported" \
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-shared.exp b/gdb/testsuite/gdb.python/py-shared.exp
index 7075bc5ee36..8dfd53acd26 100644
--- a/gdb/testsuite/gdb.python/py-shared.exp
+++ b/gdb/testsuite/gdb.python/py-shared.exp
@@ -48,7 +48,7 @@  if { [skip_python_tests] } { continue }
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp
index ef4f86d005d..ad06b07c2c6 100644
--- a/gdb/testsuite/gdb.python/py-symbol.exp
+++ b/gdb/testsuite/gdb.python/py-symbol.exp
@@ -104,7 +104,7 @@  gdb_test "python print (gdb.lookup_static_symbol ('nonexistent') is None)" \
 gdb_test "python print (gdb.lookup_static_symbol ('qq') is None)" \
     "True" "lookup_static_symbol for global var"
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
@@ -212,7 +212,7 @@  gdb_test "python print (gdb.lookup_global_symbol ('(anonymous namespace)::anon')
 gdb_test "python print (gdb.lookup_static_symbol ('(anonymous namespace)::anon').value ())" \
     "10" "print value of anon"
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
@@ -240,7 +240,7 @@  gdb_test "python print (cplusfunc.addr_class == gdb.SYMBOL_LOC_BLOCK)" "True" "t
 # test as it unloads the object file in GDB.
 # Start with a fresh gdb.
 clean_restart ${binfile}
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp
index 90750669a83..470710872c1 100644
--- a/gdb/testsuite/gdb.python/py-symtab.exp
+++ b/gdb/testsuite/gdb.python/py-symtab.exp
@@ -27,7 +27,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp
index 729faef7966..25f3f52f4a3 100644
--- a/gdb/testsuite/gdb.python/py-template.exp
+++ b/gdb/testsuite/gdb.python/py-template.exp
@@ -43,7 +43,7 @@  proc test_template_arg {exefile type} {
 	return -1
     }
     gdb_load ${exefile}
-    if ![runto_main ] then {
+    if {![runto_main]} {
 	perror "couldn't run to breakpoint"
 	return
     }
diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp
index 20f5084c332..fbe56f35b4b 100644
--- a/gdb/testsuite/gdb.python/py-type.exp
+++ b/gdb/testsuite/gdb.python/py-type.exp
@@ -41,7 +41,7 @@  proc restart_gdb {exefile} {
   gdb_reinitialize_dir $srcdir/$subdir
   gdb_load ${exefile}
 
-  if ![runto_main ] then {
+  if {![runto_main]} {
       perror "couldn't run to breakpoint"
       return
   }
diff --git a/gdb/testsuite/gdb.python/py-unwind-inline.exp b/gdb/testsuite/gdb.python/py-unwind-inline.exp
index 6667e29e446..b316ec0a3f4 100644
--- a/gdb/testsuite/gdb.python/py-unwind-inline.exp
+++ b/gdb/testsuite/gdb.python/py-unwind-inline.exp
@@ -29,7 +29,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
 if { [skip_python_tests] } { continue }
 
 # The following tests require execution.
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-unwind-maint.exp b/gdb/testsuite/gdb.python/py-unwind-maint.exp
index 7c88219089d..28121caf6bb 100644
--- a/gdb/testsuite/gdb.python/py-unwind-maint.exp
+++ b/gdb/testsuite/gdb.python/py-unwind-maint.exp
@@ -29,7 +29,7 @@  if { [skip_python_tests] } { continue }
 
 set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py]
 
-if ![runto_main ] then {
+if {![runto_main]} {
     return -1
 }
 
diff --git a/gdb/testsuite/gdb.python/py-unwind-user-regs.exp b/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
index 3430cbc3fbe..182a5481b56 100644
--- a/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
+++ b/gdb/testsuite/gdb.python/py-unwind-user-regs.exp
@@ -47,7 +47,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
 # Skip all tests if Python scripting is not enabled.
 if { [skip_python_tests] } { continue }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-unwind.exp b/gdb/testsuite/gdb.python/py-unwind.exp
index 798e76525db..515e1c07f21 100644
--- a/gdb/testsuite/gdb.python/py-unwind.exp
+++ b/gdb/testsuite/gdb.python/py-unwind.exp
@@ -37,7 +37,7 @@  if { ![istarget x86_64-*-* ] || ![is_lp64_target] } { continue }
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp
index b88c4515c8c..c04c98da162 100644
--- a/gdb/testsuite/gdb.python/py-value.exp
+++ b/gdb/testsuite/gdb.python/py-value.exp
@@ -415,7 +415,7 @@  proc test_subscript_regression {exefile lang} {
  # Start with a fresh gdb.
  clean_restart ${exefile}
 
- if ![runto_main ] then {
+ if {![runto_main]} {
      perror "couldn't run to breakpoint"
      return
  }
@@ -652,7 +652,7 @@  test_add_to_history
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp
index 48ff07e91e5..15ec5256f2c 100644
--- a/gdb/testsuite/gdb.python/python.exp
+++ b/gdb/testsuite/gdb.python/python.exp
@@ -217,7 +217,7 @@  clean_restart ${testfile}
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
@@ -431,7 +431,7 @@  clean_restart ${testfile}
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
@@ -486,7 +486,7 @@  clean_restart ${testfile}
 
 # The following tests require execution.
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }