From 0216141ac37843192e3525dda4cc3c58810ee195 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Mon, 14 Nov 2022 14:28:22 +0000 Subject: [PATCH] gdb/testsuite: remove use of then keyword from gdb.multi/*.exp 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.multi/ test script directory. There should be no changes in what is tested after this commit. --- gdb/testsuite/gdb.multi/base.exp | 8 ++++---- gdb/testsuite/gdb.multi/bkpt-multi-exec.exp | 4 ++-- gdb/testsuite/gdb.multi/dummy-frame-restore.exp | 4 ++-- gdb/testsuite/gdb.multi/info-threads.exp | 2 +- gdb/testsuite/gdb.multi/multi-arch-exec.exp | 2 +- gdb/testsuite/gdb.multi/multi-arch.exp | 4 ++-- gdb/testsuite/gdb.multi/multi-re-run.exp | 2 +- gdb/testsuite/gdb.multi/tids-gid-reset.exp | 8 ++++---- gdb/testsuite/gdb.multi/tids.exp | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/gdb/testsuite/gdb.multi/base.exp b/gdb/testsuite/gdb.multi/base.exp index 7f291996ef4..6c5042eb404 100644 --- a/gdb/testsuite/gdb.multi/base.exp +++ b/gdb/testsuite/gdb.multi/base.exp @@ -85,7 +85,7 @@ gdb_test_multiple "info inferior 2 3" "info inferior 2 3" { exp_continue } -re "$gdb_prompt $" { - if { !$see1 && $see2 && $see3 } then { + if {!$see1 && $see2 && $see3} { pass "info inferior 2 3" } else { fail "info inferior 2 3" @@ -111,7 +111,7 @@ gdb_test_multiple "info inferior 1-2" "info inferior 1-2" { exp_continue } -re "$gdb_prompt $" { - if { $see1 && $see2 && !$see3 } then { + if {$see1 && $see2 && !$see3} { pass "info inferior 1-2" } else { fail "info inferior 1-2" @@ -154,7 +154,7 @@ gdb_test "list commonfun" "from goodbye.*" "list commonfun in goodbye" # Let's run the hello program. gdb_test "inferior 1" ".*" "switch to inferior 1 to run it" -if { ![runto_main] } then { +if {![runto_main]} { return -1 } @@ -183,7 +183,7 @@ gdb_test_multiple "info inferiors" "check remove-inferiors" { exp_continue } -re "$gdb_prompt $" { - if { $see1 && !$see2 && !$see3 } then { + if {$see1 && !$see2 && !$see3} { pass "check remove-inferiors" } else { fail "check remove-inferiors" diff --git a/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp b/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp index cf7101bd5f4..43700016b4e 100644 --- a/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp +++ b/gdb/testsuite/gdb.multi/bkpt-multi-exec.exp @@ -19,7 +19,7 @@ if ![target_can_use_run_cmd] { # Until "catch exec" is implemented on other targets... # -if {![istarget "*-linux*"]} then { +if {![istarget "*-linux*"]} { return } @@ -49,7 +49,7 @@ clean_restart ${exec1} # Start the program running, and stop at main. # -if ![runto_main] then { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.multi/dummy-frame-restore.exp b/gdb/testsuite/gdb.multi/dummy-frame-restore.exp index 5accd7d4bd7..0cd1cf5a414 100644 --- a/gdb/testsuite/gdb.multi/dummy-frame-restore.exp +++ b/gdb/testsuite/gdb.multi/dummy-frame-restore.exp @@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}]} { # Inferior 1 stops at f1. -if ![runto f1] then { +if {![runto f1]} { return 0 } @@ -40,7 +40,7 @@ delete_breakpoints # Inferior 2 stops at f2. -if ![runto f2] then { +if {![runto f2]} { return 0 } diff --git a/gdb/testsuite/gdb.multi/info-threads.exp b/gdb/testsuite/gdb.multi/info-threads.exp index 5a4d611d628..650e7c6194f 100644 --- a/gdb/testsuite/gdb.multi/info-threads.exp +++ b/gdb/testsuite/gdb.multi/info-threads.exp @@ -24,7 +24,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {pthreads d return -1 } -if { ![runto_main] } then { +if {![runto_main]} { return -1 } diff --git a/gdb/testsuite/gdb.multi/multi-arch-exec.exp b/gdb/testsuite/gdb.multi/multi-arch-exec.exp index 3d77960988d..7899c223553 100644 --- a/gdb/testsuite/gdb.multi/multi-arch-exec.exp +++ b/gdb/testsuite/gdb.multi/multi-arch-exec.exp @@ -152,7 +152,7 @@ proc do_test { first_arch mode selected_thread } { set from_exec "$first_arch-multi-arch-exec" clean_restart ${from_exec} - if ![runto all_started] then { + if {![runto all_started]} { return -1 } diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp index b564e6caf25..a15b0217a9e 100644 --- a/gdb/testsuite/gdb.multi/multi-arch.exp +++ b/gdb/testsuite/gdb.multi/multi-arch.exp @@ -78,7 +78,7 @@ if { [build_executable "failed to prepare" ${exec2} "${srcfile2}" \ # Start inferior 1 clean_restart ${exec1} -if ![runto_main] then { +if {![runto_main]} { return } @@ -88,7 +88,7 @@ gdb_test "add-inferior" "Added inferior 2.*" "add empty inferior 2" gdb_test "inferior 2" "Switching to inferior 2.*" "switch to inferior 2" gdb_load ${binfile2} -if ![runto_main] then { +if {![runto_main]} { return } diff --git a/gdb/testsuite/gdb.multi/multi-re-run.exp b/gdb/testsuite/gdb.multi/multi-re-run.exp index 5af4fde4baf..04073c94545 100644 --- a/gdb/testsuite/gdb.multi/multi-re-run.exp +++ b/gdb/testsuite/gdb.multi/multi-re-run.exp @@ -80,7 +80,7 @@ proc test_re_run {re_run_inf} { # Run the steady inferior to a breakpoint, and let it stay stopped # there. - if ![runto all_started] then { + if {![runto all_started]} { return 0 } diff --git a/gdb/testsuite/gdb.multi/tids-gid-reset.exp b/gdb/testsuite/gdb.multi/tids-gid-reset.exp index 6cab573a1f8..27474b19e36 100644 --- a/gdb/testsuite/gdb.multi/tids-gid-reset.exp +++ b/gdb/testsuite/gdb.multi/tids-gid-reset.exp @@ -31,7 +31,7 @@ with_test_prefix "single-inferior" { with_test_prefix "before restart" { clean_restart ${testfile} - if { ![runto_main] } then { + if {![runto_main]} { return -1 } @@ -40,7 +40,7 @@ with_test_prefix "single-inferior" { with_test_prefix "restart" { gdb_continue_to_end - if { ![runto_main] } then { + if {![runto_main]} { return -1 } } @@ -66,7 +66,7 @@ with_test_prefix "multi-inferior" { gdb_test "inferior 2" "Switching to inferior 2 .*" "switch to inferior 2" gdb_load ${binfile} - if ![runto_main] then { + if {![runto_main]} { return } @@ -82,7 +82,7 @@ with_test_prefix "multi-inferior" { with_test_prefix "restart" { gdb_continue_to_end - if { ![runto_main] } then { + if {![runto_main]} { return -1 } } diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp index 23668caf18f..44face83860 100644 --- a/gdb/testsuite/gdb.multi/tids.exp +++ b/gdb/testsuite/gdb.multi/tids.exp @@ -31,7 +31,7 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {pthreads d return -1 } -if { ![runto_main] } then { +if {![runto_main]} { return -1 } -- 2.30.2