gdb/testsuite: remove use of then keyword from gdb.trace/*.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.trace/ test script directory. There should be no changes in what is tested after this commit.
This commit is contained in:
parent
b8ffa8b327
commit
89c6d320b2
22 changed files with 38 additions and 38 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -151,7 +151,7 @@ proc test_upload_tsv { } {
|
|||
}
|
||||
|
||||
clean_restart $testfile
|
||||
if ![runto_main] then {
|
||||
if {![runto_main]} {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue