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

Message ID d5acef8e53e30fe9c18eac05f610805808fc224d.1668508387.git.aburgess@redhat.com
State Committed
Commit bde43e8dbeaf4c9b05514f0c749623db453747bb
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.reverse/
test script directory.

There should be no changes in what is tested after this commit.
---
 gdb/testsuite/gdb.reverse/consecutive-precsave.exp     |  6 +++---
 gdb/testsuite/gdb.reverse/consecutive-reverse.exp      |  6 +++---
 gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp      |  2 +-
 gdb/testsuite/gdb.reverse/i386-precsave.exp            |  2 +-
 gdb/testsuite/gdb.reverse/i386-reverse.exp             |  2 +-
 gdb/testsuite/gdb.reverse/i386-sse-reverse.exp         |  2 +-
 gdb/testsuite/gdb.reverse/i387-env-reverse.exp         |  2 +-
 gdb/testsuite/gdb.reverse/i387-stack-reverse.exp       |  2 +-
 gdb/testsuite/gdb.reverse/insn-reverse.exp             |  2 +-
 .../gdb.reverse/next-reverse-bkpt-over-sr.exp          |  2 +-
 gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp |  6 +++---
 gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp  |  6 +++---
 gdb/testsuite/gdb.reverse/sigall-precsave.exp          | 10 +++++-----
 gdb/testsuite/gdb.reverse/sigall-reverse.exp           | 10 +++++-----
 gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp       |  2 +-
 15 files changed, 31 insertions(+), 31 deletions(-)
  

Patch

diff --git a/gdb/testsuite/gdb.reverse/consecutive-precsave.exp b/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
index 5d2c8105a1f..d1d1aa2b061 100644
--- a/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/consecutive-precsave.exp
@@ -83,7 +83,7 @@  set testmsg "stopped at bp, 2nd instr"
 gdb_test_multiple "step" $testmsg {
     -re -wrap "Breakpoint $decimal, ($hex) in foo.*" {
 	set stop_addr $expect_out(1,string)
-	if [eval expr "$foo2_addr == $stop_addr"] then {
+	if {[eval expr "$foo2_addr == $stop_addr"]} {
 	    pass "stopped at bp, 2nd instr"
 	} else {
 	    fail "stopped at bp, 2nd instr (wrong address)"
@@ -94,7 +94,7 @@  gdb_test_multiple "step" $testmsg {
        set stop_addr_is_stmt [hex_in_list $stop_addr $is_stmt]
        if { ! $stop_addr_is_stmt } {
            fail "stopped at bp, 2nd instr (missing hex prefix)"
-       } elseif [eval expr "$foo2_addr == $stop_addr"] then {
+       } elseif {[eval expr "$foo2_addr == $stop_addr"]} {
            pass "stopped at bp, 2nd instr"
        } else {
            fail "stopped at bp, 2nd instr (wrong address)"
@@ -116,7 +116,7 @@  set test_msg "stopped at bp in reverse, 1st instr"
 gdb_test_multiple "step" "$test_msg" {
     -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
 	set stop_addr $expect_out(1,string)
-	if [eval expr "$foo1_addr == $stop_addr"] then {
+	if {[eval expr "$foo1_addr == $stop_addr"]} {
 	    pass "$test_msg"
 	} else {
 	    fail "$test_msg (wrong address)"
diff --git a/gdb/testsuite/gdb.reverse/consecutive-reverse.exp b/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
index 955cb4903e0..99d83328feb 100644
--- a/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/consecutive-reverse.exp
@@ -63,7 +63,7 @@  set testmsg "stopped at bp, 2nd instr"
 gdb_test_multiple "step" $testmsg {
     -re -wrap "Breakpoint $decimal, ($hex) in foo.*" {
 	set stop_addr $expect_out(1,string)
-	if [eval expr "$foo2_addr == $stop_addr"] then {
+	if {[eval expr "$foo2_addr == $stop_addr"]} {
 	    pass "stopped at bp, 2nd instr"
 	} else {
 	    fail "stopped at bp, 2nd instr (wrong address)"
@@ -74,7 +74,7 @@  gdb_test_multiple "step" $testmsg {
        set stop_addr_is_stmt [hex_in_list $stop_addr $is_stmt]
        if { ! $stop_addr_is_stmt } {
            fail "stopped at bp, 2nd instr (missing hex prefix)"
-       } elseif [eval expr "$foo2_addr == $stop_addr"] then {
+       } elseif {[eval expr "$foo2_addr == $stop_addr"]} {
            pass "stopped at bp, 2nd instr"
        } else {
            fail "stopped at bp, 2nd instr (wrong address)"
@@ -96,7 +96,7 @@  set test_msg "stopped at bp in reverse, 1st instr"
 gdb_test_multiple "step" "$test_msg" {
     -re "Breakpoint $decimal, ($hex) in foo.*$gdb_prompt $" {
 	set stop_addr $expect_out(1,string)
-	if [eval expr "$foo1_addr == $stop_addr"] then {
+	if {[eval expr "$foo1_addr == $stop_addr"]} {
 	    pass "$test_msg"
 	} else {
 	    fail "$test_msg (wrong address)"
diff --git a/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp b/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp
index 2a204748d98..5bfe14788c6 100644
--- a/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp
+++ b/gdb/testsuite/gdb.reverse/finish-reverse-bkpt.exp
@@ -29,7 +29,7 @@  if { [prepare_for_testing "failed to prepare" "$testfile" $srcfile] } {
     return -1
 }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.reverse/i386-precsave.exp b/gdb/testsuite/gdb.reverse/i386-precsave.exp
index 54580474430..fbf80b89c05 100644
--- a/gdb/testsuite/gdb.reverse/i386-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/i386-precsave.exp
@@ -25,7 +25,7 @@  if ![supports_process_record] {
 }
 
 
-if ![is_x86_like_target] then {
+if {![is_x86_like_target]} {
     verbose "Skipping i386 reverse tests."
     return
 }
diff --git a/gdb/testsuite/gdb.reverse/i386-reverse.exp b/gdb/testsuite/gdb.reverse/i386-reverse.exp
index 15c18dad205..6f6458c776e 100644
--- a/gdb/testsuite/gdb.reverse/i386-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-reverse.exp
@@ -24,7 +24,7 @@  if ![supports_reverse] {
 }
 
 
-if ![is_x86_like_target] then {
+if {![is_x86_like_target]} {
     verbose "Skipping i386 reverse tests."
     return
 }
diff --git a/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp b/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
index 9713e896f59..ac56cd4e50d 100644
--- a/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i386-sse-reverse.exp
@@ -24,7 +24,7 @@  if ![supports_reverse] {
 }
 
 
-if ![istarget "*86*-*linux*"] then {
+if {![istarget "*86*-*linux*"]} {
     verbose "Skipping i386 reverse tests."
     return
 }
diff --git a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
index 53fee0986df..efc7c847d59 100644
--- a/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i387-env-reverse.exp
@@ -16,7 +16,7 @@ 
 # This file is part of the gdb testsuite.
 
 
-if ![is_x86_like_target] then {
+if {![is_x86_like_target]} {
     verbose "Skipping i387 reverse float tests."
     return
 }
diff --git a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
index cadd4f76035..f88c1dc0b86 100644
--- a/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/i387-stack-reverse.exp
@@ -16,7 +16,7 @@ 
 # This file is part of the gdb testsuite.
 
 
-if ![is_x86_like_target] then {
+if {![is_x86_like_target]} {
     verbose "Skipping i387 reverse float tests."
     return
 }
diff --git a/gdb/testsuite/gdb.reverse/insn-reverse.exp b/gdb/testsuite/gdb.reverse/insn-reverse.exp
index c5437ecef6f..82ae39f9cd9 100644
--- a/gdb/testsuite/gdb.reverse/insn-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/insn-reverse.exp
@@ -26,7 +26,7 @@  if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
 	 [list debug]]} {
     return -1
 }
-if { ![runto_main] } then {
+if {![runto_main]} {
     return
 }
 
diff --git a/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp b/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp
index 6ef56d30e7b..71d915d20a9 100644
--- a/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp
+++ b/gdb/testsuite/gdb.reverse/next-reverse-bkpt-over-sr.exp
@@ -33,7 +33,7 @@  if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } {
     return -1
 }
 
-if ![runto_main] then {
+if {![runto_main]} {
     return 0
 }
 
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
index 066d307fbcd..bca7399bcdf 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_2_06.exp
@@ -37,18 +37,18 @@  set gen_src record_test_isa_2_06.c
 set executable record_test_isa_2_06
 set options [list debug]
 
-if {![istarget "powerpc*"]} then {
+if {![istarget "powerpc*"]} {
     verbose "Skipping PowerPC ISA 2.06 instruction record_test_2_06."
     return
 }
 
-if {[build_executable "failed to prepare" $executable $srcfile $options] == -1} then {
+if {[build_executable "failed to prepare" $executable $srcfile $options] == -1} {
     return -1
 }
 
 clean_restart $executable
 
-if ![runto_main] then {
+if {![runto_main]} {
     untested "could not run to main"
     return
 }
diff --git a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
index 79f04f65b64..b4cddfac8fe 100644
--- a/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
+++ b/gdb/testsuite/gdb.reverse/ppc_record_test_isa_3_1.exp
@@ -37,19 +37,19 @@  standard_testfile
 set gen_src record_test_isa_3_1.c
 set executable record_test_isa_3_1
 
-if {![istarget "powerpc*"] || [skip_power_isa_3_1_tests] } then  {
+if {![istarget "powerpc*"] || [skip_power_isa_3_1_tests]}  {
     verbose "Skipping PowerPC ISA 3.1 instruction record_test."
     return
 }
 
 set options [list additional_flags=-mcpu=power10 debug]
-if {[build_executable "failed to prepare" $executable $srcfile $options] == -1} then {
+if {[build_executable "failed to prepare" $executable $srcfile $options] == -1} {
     return -1
 }
 
 clean_restart $executable
 
-if ![runto_main] then {
+if {![runto_main]} {
     untested "could not run to main"
     return
 }
diff --git a/gdb/testsuite/gdb.reverse/sigall-precsave.exp b/gdb/testsuite/gdb.reverse/sigall-precsave.exp
index 991a6b0656a..d8761753971 100644
--- a/gdb/testsuite/gdb.reverse/sigall-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/sigall-precsave.exp
@@ -47,7 +47,7 @@  proc test_one_sig {nextsig} {
 
     set need_another_continue 1
     set missed_handler 0
-    if $this_sig_supported then {
+    if {$this_sig_supported} {
 	if { $thissig == "IO" } {
 	    setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
 	}
@@ -66,7 +66,7 @@  proc test_one_sig {nextsig} {
 	}
     }
 
-    if $need_another_continue then {
+    if {$need_another_continue} {
 	if { $thissig == "URG" } {
 	    setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
 	}
@@ -86,7 +86,7 @@  proc test_one_sig {nextsig} {
 	}
     }
 
-    if { $missed_handler == "0" } then {
+    if {$missed_handler == "0"} {
 	set testmsg "advance to $nextsig"
         gdb_test_multiple "signal 0" $testmsg {
 	    -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
@@ -132,14 +132,14 @@  proc test_one_sig_reverse {prevsig} {
 	    exp_continue
 	}
 	-re "Breakpoint.*kill.*$gdb_prompt " {
-	    if { $saw_signal } then {
+	    if {$saw_signal} {
 		pass "$testmsg (handled)"
 	    } else {
 		xfail "$testmsg (handled)"
 	    }
 	}
 	-re "No more reverse-execution history.*kill.*$gdb_prompt " {
-	    if { $saw_signal } then {
+	    if {$saw_signal} {
 		pass "$testmsg (handled)"
 	    } else {
 		xfail "$testmsg (handled)"
diff --git a/gdb/testsuite/gdb.reverse/sigall-reverse.exp b/gdb/testsuite/gdb.reverse/sigall-reverse.exp
index 36fdb74a66f..7078067a71e 100644
--- a/gdb/testsuite/gdb.reverse/sigall-reverse.exp
+++ b/gdb/testsuite/gdb.reverse/sigall-reverse.exp
@@ -47,7 +47,7 @@  proc test_one_sig {nextsig} {
 
     set need_another_continue 1
     set missed_handler 0
-    if $this_sig_supported then {
+    if {$this_sig_supported} {
 	if { $thissig == "IO" } {
 	    setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
 	}
@@ -72,7 +72,7 @@  proc test_one_sig {nextsig} {
 	}
     }
 
-    if $need_another_continue then {
+    if {$need_another_continue} {
 	if { $thissig == "URG" } {
 	    setup_xfail "i*86-pc-linuxoldld-gnu" "i*86-pc-linuxaout-gnu"
 	}
@@ -92,7 +92,7 @@  proc test_one_sig {nextsig} {
 	}
     }
 
-    if { $missed_handler == "0" } then {
+    if {$missed_handler == "0"} {
 	set testmsg "advance to $nextsig"
         gdb_test_multiple "signal 0" $testmsg {
 	    -re "Breakpoint.*gen_$nextsig.*kill.*$gdb_prompt $" {
@@ -138,14 +138,14 @@  proc test_one_sig_reverse {prevsig} {
 	    exp_continue
 	}
 	-re "Breakpoint.*kill.*$gdb_prompt " {
-	    if { $saw_signal } then {
+	    if {$saw_signal} {
 		pass "$testmsg (handled)"
 	    } else {
 		xfail "$testmsg (handled)"
 	    }
 	}
 	-re "No more reverse-execution history.*kill.*$gdb_prompt " {
-	    if { $saw_signal } then {
+	    if {$saw_signal} {
 		pass "$testmsg (handled)"
 	    } else {
 		xfail "$testmsg (handled)"
diff --git a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
index 4a81a618efc..21844e54d01 100644
--- a/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
+++ b/gdb/testsuite/gdb.reverse/test_ioctl_TCSETSW.exp
@@ -22,7 +22,7 @@  if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
     return -1
 }
 
-if ![runto_main] then {
+if {![runto_main]} {
     untested "could not run to main"
     continue
 }