mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-24 04:00:07 +08:00
gdb/testsuite: remove use of then keyword from gdb.threads/*.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.threads/ test script directory. There should be no changes in what is tested after this commit.
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# This only works on targets with the Linux kernel.
|
||||
if ![istarget *-*-linux*] then {
|
||||
if {![istarget *-*-linux*]} {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
standard_testfile
|
||||
|
||||
# This only works with on Linux targets.
|
||||
if ![istarget *-*-linux*] then {
|
||||
if {![istarget *-*-linux*]} {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -205,7 +205,7 @@ proc_with_prefix test_detach_command {condition_eval target_non_stop non_stop di
|
||||
gdb_test "inferior 2" "Switching to .*"
|
||||
|
||||
gdb_load $::binfile
|
||||
if ![runto setup_done] then {
|
||||
if {![runto setup_done]} {
|
||||
fail "can't run to setup_done"
|
||||
kill_wait_spawned_process $test_spawn_id
|
||||
return
|
||||
|
@ -26,7 +26,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ proc do_test { detach-on-fork } {
|
||||
|
||||
set GDBFLAGS $saved_gdbflags
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ gdb_start
|
||||
gdb_reinitialize_dir $srcdir/$subdir
|
||||
|
||||
gdb_load ${binfile}
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ proc probe_displaced_stepping_support {} {
|
||||
clean_restart $binfile
|
||||
|
||||
gdb_test_no_output "set displaced on"
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ proc do_test { cond_bp_target detach_on_fork displaced } {
|
||||
clean_restart $binfile
|
||||
set GDBFLAGS $saved_gdbflags
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -24,7 +24,7 @@ clean_restart ${testfile}
|
||||
|
||||
gdb_test_no_output "set non-stop on"
|
||||
|
||||
if { ! [ runto_main ] } then {
|
||||
if {![runto_main]} {
|
||||
return -1
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ set objfile $binfile.o
|
||||
set corefile $binfile.test
|
||||
set core0file ${binfile}0.test
|
||||
|
||||
if [istarget "*-*-linux"] then {
|
||||
if {[istarget "*-*-linux"]} {
|
||||
set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
} else {
|
||||
set target_cflags ""
|
||||
@ -55,7 +55,7 @@ set nl "\[\r\n\]+"
|
||||
|
||||
set timeout 30
|
||||
|
||||
if { ! [ runto_main ] } then {
|
||||
if {![runto_main]} {
|
||||
return -1
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ proc test {threaded} {
|
||||
return -1
|
||||
}
|
||||
|
||||
if { ![runto_main] } then {
|
||||
if {![runto_main]} {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
# This only works with Linux configurations.
|
||||
if ![istarget *-*-linux-gnu*] then {
|
||||
if {![istarget *-*-linux-gnu*]} {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ clean_restart ${binfile}
|
||||
|
||||
gdb_test_no_output "set can-use-hw-watchpoints 1" ""
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
|
||||
|
||||
clean_restart "${binfile}"
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ if {[prepare_for_testing "failed to prepare" \
|
||||
return -1
|
||||
}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ proc do_test { non_stop cond_bp_target } {
|
||||
clean_restart $binfile
|
||||
set GDBFLAGS $saved_gdbflags
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ standard_testfile
|
||||
# carriage return)
|
||||
set horiz "\[^\n\r\]*"
|
||||
|
||||
if [istarget "*-*-linux"] then {
|
||||
if {[istarget "*-*-linux"]} {
|
||||
set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
} else {
|
||||
set target_cflags ""
|
||||
@ -79,7 +79,7 @@ proc all_threads_running {} {
|
||||
}
|
||||
}
|
||||
|
||||
if { $return_me == 1 } then {
|
||||
if {$return_me == 1} {
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ proc test_startup {} {
|
||||
}
|
||||
}
|
||||
|
||||
if { $return_me == 1 } then {
|
||||
if {$return_me == 1} {
|
||||
return 0
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ proc check_control_c {} {
|
||||
|
||||
# Verify that all threads are running.
|
||||
with_test_prefix "after startup" {
|
||||
if [all_threads_running] then {
|
||||
if {[all_threads_running]} {
|
||||
pass "all threads running after startup"
|
||||
}
|
||||
}
|
||||
@ -219,7 +219,7 @@ proc check_control_c {} {
|
||||
|
||||
# Verify that all threads can be run again after a ^C stop.
|
||||
with_test_prefix "after continue" {
|
||||
if [all_threads_running] then {
|
||||
if {[all_threads_running]} {
|
||||
pass "all threads running after continuing from ^C stop"
|
||||
}
|
||||
}
|
||||
@ -345,9 +345,9 @@ proc check_qcs {} {
|
||||
|
||||
}
|
||||
|
||||
if [runto_main] then {
|
||||
if [test_startup] then {
|
||||
if [check_control_c] then {
|
||||
if {[runto_main]} {
|
||||
if {[test_startup]} {
|
||||
if {[check_control_c]} {
|
||||
warning "Could not stop child with ^C; skipping rest of tests.\n"
|
||||
return
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ if { [gdb_compile_pthreads \
|
||||
|
||||
clean_restart $executable
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,7 @@ proc test { step_over } {
|
||||
with_test_prefix "step-over $step_over" {
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ proc test { schedlock } {
|
||||
with_test_prefix "schedlock $schedlock" {
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ proc test { command } {
|
||||
with_test_prefix "$command" {
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ proc test { sigtrap_thread } {
|
||||
with_test_prefix "sigtrap thread $sigtrap_thread" {
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto "thread_function"] then {
|
||||
if {![runto "thread_function"]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ if {[prepare_for_testing "failed to prepare" \
|
||||
return -1
|
||||
}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ gdb_test_multiple "info threads" "collect thread id" {
|
||||
}
|
||||
}
|
||||
|
||||
if { [info exists thread6] } then {
|
||||
if {[info exists thread6]} {
|
||||
gdb_test "echo $thread6\\n" "$thread6" "got thread ids"
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ gdb_test_multiple "info threads" "collect thread id" {
|
||||
}
|
||||
}
|
||||
|
||||
if { [info exists process6] } then {
|
||||
if {[info exists process6]} {
|
||||
gdb_test "echo $process6\\n" "$process6" "got process ids"
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ gdb_test_multiple "info threads" "collect thread id" {
|
||||
}
|
||||
}
|
||||
|
||||
if { [info exists lwp6] } then {
|
||||
if {[info exists lwp6]} {
|
||||
gdb_test "echo $lwp6\\n" "$lwp6" "got lwp ids"
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ gdb_test "thread find threadname_1" \
|
||||
# Test 'thread find' with thread ids, if any.
|
||||
#
|
||||
|
||||
if { [info exists thread6] } then {
|
||||
if {[info exists thread6]} {
|
||||
gdb_test "thread find $thread6" \
|
||||
"Thread 6 has .*$thread6.*" "find thread id 6"
|
||||
gdb_test "thread find $thread5" \
|
||||
@ -145,7 +145,7 @@ if { [info exists thread6] } then {
|
||||
# Test 'thread find' with process ids, if any.
|
||||
#
|
||||
|
||||
if { [info exists process6] } then {
|
||||
if {[info exists process6]} {
|
||||
gdb_test "thread find $process6" \
|
||||
"Thread 6 has .*$process6.*" "find process id 6"
|
||||
gdb_test "thread find $process5" \
|
||||
@ -164,7 +164,7 @@ if { [info exists process6] } then {
|
||||
# Test 'thread find' with lwp ids, if any.
|
||||
#
|
||||
|
||||
if { [info exists lwp6] } then {
|
||||
if {[info exists lwp6]} {
|
||||
gdb_test "thread find $lwp6" \
|
||||
"Thread 6 has .*$lwp6.*" "find lwp id 6"
|
||||
gdb_test "thread find $lwp5" \
|
||||
@ -197,7 +197,7 @@ gdb_test_multiple "thread find threadname_\[345\]" "test regular exp" {
|
||||
exp_continue
|
||||
}
|
||||
-re ".*$gdb_prompt $" {
|
||||
if { $see3 && $see4 && $see5 && !$see1 && !$see2 && !$see6 } then {
|
||||
if {$see3 && $see4 && $see5 && !$see1 && !$see2 && !$see6} {
|
||||
pass "test regular exp"
|
||||
} else {
|
||||
fail "test regular exp"
|
||||
@ -219,7 +219,7 @@ gdb_test_multiple "info threads 2 4 6" "info threads 2 4 6" {
|
||||
exp_continue
|
||||
}
|
||||
-re "$gdb_prompt $" {
|
||||
if { $see2 && $see4 && $see6 && !$see1 && !$see3 && !$see5 } then {
|
||||
if {$see2 && $see4 && $see6 && !$see1 && !$see3 && !$see5} {
|
||||
pass "info threads 2 4 6"
|
||||
} else {
|
||||
fail "info threads 2 4 6"
|
||||
@ -241,7 +241,7 @@ gdb_test_multiple "info threads 3-5" "info threads 3-5" {
|
||||
exp_continue
|
||||
}
|
||||
-re "$gdb_prompt $" {
|
||||
if { $see3 && $see4 && $see5 && !$see1 && !$see2 && !$see6 } then {
|
||||
if {$see3 && $see4 && $see5 && !$see1 && !$see2 && !$see6} {
|
||||
pass "info threads 3-5"
|
||||
} else {
|
||||
fail "info threads 3-5"
|
||||
@ -265,7 +265,7 @@ gdb_test_multiple "info threads 3-3" "info threads 3-3" {
|
||||
exp_continue
|
||||
}
|
||||
-re ".*$gdb_prompt $" {
|
||||
if { $see3 && !$see1 && !$see2 && !$see4 && !$see5 && !$see6 } then {
|
||||
if {$see3 && !$see1 && !$see2 && !$see4 && !$see5 && !$see6} {
|
||||
pass "info threads 3-3"
|
||||
} else {
|
||||
fail "info threads 3-3"
|
||||
|
@ -41,7 +41,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
|
||||
|
||||
clean_restart ${binfile}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
# This test has only been verified with Linux targets, and would need
|
||||
# to be generalized to support other targets
|
||||
if ![istarget *-*-linux*] then {
|
||||
if {![istarget *-*-linux*]} {
|
||||
return
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ proc test_thread_messages {enabled} {
|
||||
|
||||
# The initial thread may log a 'New Thread' message, but we don't
|
||||
# check for it.
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 1
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ clean_restart ${binfile}
|
||||
# Run to `main' where we begin our tests.
|
||||
#
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
|
||||
}
|
||||
|
||||
clean_restart ${binfile}
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
standard_testfile
|
||||
|
||||
if [istarget "*-*-linux"] then {
|
||||
if {[istarget "*-*-linux"]} {
|
||||
set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
} else {
|
||||
set target_cflags ""
|
||||
@ -27,7 +27,7 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
|
||||
}
|
||||
|
||||
clean_restart ${binfile}
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
|
||||
clean_restart ${binfile}
|
||||
gdb_load_shlib ${binfile_lib}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
|
||||
clean_restart ${binfile}
|
||||
gdb_load_shlib ${binfile_lib}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,7 @@ load_lib gdb-python.exp
|
||||
|
||||
standard_testfile tls.c tls2.c
|
||||
|
||||
if [istarget "*-*-linux"] then {
|
||||
if {[istarget "*-*-linux"]} {
|
||||
set target_cflags "-D_MIT_POSIX_THREADS"
|
||||
} else {
|
||||
set target_cflags ""
|
||||
@ -167,7 +167,7 @@ gdb_test_multiple "print a_thread_local" "" {
|
||||
}
|
||||
}
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ proc test_vfork {detach} {
|
||||
|
||||
clean_restart $binfile
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ proc test_vfork {detach} {
|
||||
|
||||
clean_restart $binfile
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ gdb_test_no_output "set can-use-hw-watchpoints 1" ""
|
||||
# Run to `main' where we begin our tests.
|
||||
#
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ gdb_test_no_output "set can-use-hw-watchpoints 1" ""
|
||||
# Run to `main' where we begin our tests.
|
||||
#
|
||||
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ clean_restart ${binfile}
|
||||
gdb_test_no_output "set can-use-hw-watchpoints 1" ""
|
||||
|
||||
# Run to `main' where we begin our tests.
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user