diff options
author | Tom de Vries <tdevries@suse.de> | 2021-09-25 09:28:57 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-09-25 09:28:57 +0200 |
commit | 98bf5c02cfe9d13428a55c0da8d5f150d7c1fc54 (patch) | |
tree | dd14355db3a17a81c81669abf4ad792fb733615e /gdb/testsuite/gdb.base | |
parent | 99d0d99649c12b2bdccaeb788d5d0f0d0dff4d5d (diff) | |
download | gdb-98bf5c02cfe9d13428a55c0da8d5f150d7c1fc54.zip gdb-98bf5c02cfe9d13428a55c0da8d5f150d7c1fc54.tar.gz gdb-98bf5c02cfe9d13428a55c0da8d5f150d7c1fc54.tar.bz2 |
[gdb/testsuite] Minimize gdb restarts
Minimize gdb restarts, applying the following rules:
- don't use prepare_for_testing unless necessary
- don't use clean_restart unless necessary
Also, if possible, replace build_for_executable + clean_restart
with prepare_for_testing for brevity.
Touches 68 test-cases.
Tested on x86_64-linux.
Diffstat (limited to 'gdb/testsuite/gdb.base')
32 files changed, 17 insertions, 48 deletions
diff --git a/gdb/testsuite/gdb.base/access-mem-running.exp b/gdb/testsuite/gdb.base/access-mem-running.exp index 6990d90..9dec5bc 100644 --- a/gdb/testsuite/gdb.base/access-mem-running.exp +++ b/gdb/testsuite/gdb.base/access-mem-running.exp @@ -17,7 +17,7 @@ standard_testfile -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] == -1} { +if {[build_executable "failed to prepare" $testfile $srcfile {debug}] == -1} { return -1 } diff --git a/gdb/testsuite/gdb.base/attach-pie-noexec.exp b/gdb/testsuite/gdb.base/attach-pie-noexec.exp index ae3d0bc..85161fa 100644 --- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp +++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp @@ -24,7 +24,6 @@ if { [prepare_for_testing "failed to prepare" $executable "" [list debug pie]] } return -1 } -clean_restart $executable set arch "" set test "show architecture" gdb_test_multiple $test $test { diff --git a/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp b/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp index d21f580a..c0c1fa2 100644 --- a/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp +++ b/gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp @@ -32,7 +32,7 @@ if [target_info exists gdb,nointerrupts] { standard_testfile -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { +if {[build_executable "failed to prepare" $testfile $srcfile debug]} { return -1 } diff --git a/gdb/testsuite/gdb.base/bt-selected-frame.exp b/gdb/testsuite/gdb.base/bt-selected-frame.exp index ed1a048..c454f4c 100644 --- a/gdb/testsuite/gdb.base/bt-selected-frame.exp +++ b/gdb/testsuite/gdb.base/bt-selected-frame.exp @@ -17,7 +17,7 @@ standard_testfile -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { +if { [build_executable "failed to prepare" $testfile $srcfile debug] } { return -1 } diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp index a92730c..d7183d1 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp @@ -26,7 +26,6 @@ if { [prepare_for_testing "failed to prepare" $testfile ${testfile}.c] } { } # Check target supports catch syscall or not. -clean_restart $binfile if ![runto_main] then { fail "can't run to main" return diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp index 3fd0f07..5bcc7e7 100644 --- a/gdb/testsuite/gdb.base/condbreak.exp +++ b/gdb/testsuite/gdb.base/condbreak.exp @@ -32,9 +32,6 @@ if [get_compiler_info] { return -1 } -clean_restart ${binfile} - - set bp_location1 [gdb_get_line_number "set breakpoint 1 here"] set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile2] diff --git a/gdb/testsuite/gdb.base/cvexpr.exp b/gdb/testsuite/gdb.base/cvexpr.exp index 6048699..c434c11 100644 --- a/gdb/testsuite/gdb.base/cvexpr.exp +++ b/gdb/testsuite/gdb.base/cvexpr.exp @@ -31,8 +31,6 @@ proc do_test {dir options} { return 0 } - clean_restart ${binfile} - gdb_test_no_output "set print sevenbit-strings" gdb_test_no_output "set print address off" gdb_test_no_output "set width 0" diff --git a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp index 11fa710..58a5560 100644 --- a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp +++ b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp @@ -17,7 +17,7 @@ standard_testfile -if [prepare_for_testing "failed to prepare" \ +if [build_executable "failed to prepare" \ ${testfile} ${srcfile} {debug}] { return -1 } diff --git a/gdb/testsuite/gdb.base/dprintf-detach.exp b/gdb/testsuite/gdb.base/dprintf-detach.exp index 1a94d26..aa06a5b 100644 --- a/gdb/testsuite/gdb.base/dprintf-detach.exp +++ b/gdb/testsuite/gdb.base/dprintf-detach.exp @@ -28,7 +28,7 @@ if { [use_gdb_stub] } then { standard_testfile set escapedbinfile [string_to_regexp ${binfile}] -if [prepare_for_testing "failed to prepare for dprintf-detach" \ +if [build_executable "failed to prepare for dprintf-detach" \ ${testfile} ${srcfile} {debug}] { return -1 } diff --git a/gdb/testsuite/gdb.base/duplicate-bp.exp b/gdb/testsuite/gdb.base/duplicate-bp.exp index 77fa160..5516925 100644 --- a/gdb/testsuite/gdb.base/duplicate-bp.exp +++ b/gdb/testsuite/gdb.base/duplicate-bp.exp @@ -15,7 +15,7 @@ standard_testfile -if { [prepare_for_testing "failed to prepare" ${testfile}] } { +if { [build_executable "failed to prepare" ${testfile}] } { return -1 } diff --git a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp index eda0f50..051aeb7 100644 --- a/gdb/testsuite/gdb.base/fork-print-inferior-events.exp +++ b/gdb/testsuite/gdb.base/fork-print-inferior-events.exp @@ -34,7 +34,7 @@ if [gdb_debug_enabled] { standard_testfile -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { +if { [build_executable "failed to prepare" $testfile $srcfile debug] } { return -1 } diff --git a/gdb/testsuite/gdb.base/frameapply.exp b/gdb/testsuite/gdb.base/frameapply.exp index 1c58000..346d229 100644 --- a/gdb/testsuite/gdb.base/frameapply.exp +++ b/gdb/testsuite/gdb.base/frameapply.exp @@ -24,9 +24,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return -1 } -clean_restart ${binfile} - - if ![runto setup_done] then { fail "can't run to setup_done" return 0 diff --git a/gdb/testsuite/gdb.base/gcore-relro-pie.exp b/gdb/testsuite/gdb.base/gcore-relro-pie.exp index 39142fe..6c2bfc3 100644 --- a/gdb/testsuite/gdb.base/gcore-relro-pie.exp +++ b/gdb/testsuite/gdb.base/gcore-relro-pie.exp @@ -19,7 +19,7 @@ standard_testfile -if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ +if {[build_executable "failed to prepare" $testfile $srcfile \ {debug pie "ldflags=-Wl,-z,relro"}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/gcore-tls-pie.exp b/gdb/testsuite/gdb.base/gcore-tls-pie.exp index e514c42..bb635cb 100644 --- a/gdb/testsuite/gdb.base/gcore-tls-pie.exp +++ b/gdb/testsuite/gdb.base/gcore-tls-pie.exp @@ -23,7 +23,7 @@ if { [have_fuse_ld_gold] == 0} { return -1 } -if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ +if {[build_executable "failed to prepare" $testfile $srcfile \ {debug pie "ldflags=-fuse-ld=gold"}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.base/index-cache.exp index 496145e..8dd35ad 100644 --- a/gdb/testsuite/gdb.base/index-cache.exp +++ b/gdb/testsuite/gdb.base/index-cache.exp @@ -18,7 +18,7 @@ standard_testfile -if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ +if { [build_executable "failed to prepare" $testfile $srcfile \ {debug additional_flags=-Wl,--build-id}] } { return } diff --git a/gdb/testsuite/gdb.base/info_minsym.exp b/gdb/testsuite/gdb.base/info_minsym.exp index 7353bcf..fe3f4c5 100644 --- a/gdb/testsuite/gdb.base/info_minsym.exp +++ b/gdb/testsuite/gdb.base/info_minsym.exp @@ -27,8 +27,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {c}]} { return -1 } -clean_restart ${testfile} - gdb_test_no_output "info variables -q -t int minsym" \ "minsym variables do not match type" gdb_test_no_output "info functions -q -t int minsym" \ diff --git a/gdb/testsuite/gdb.base/info_qt.exp b/gdb/testsuite/gdb.base/info_qt.exp index 3f6e142..c6f242b 100644 --- a/gdb/testsuite/gdb.base/info_qt.exp +++ b/gdb/testsuite/gdb.base/info_qt.exp @@ -27,8 +27,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile}] } { return -1 } -clean_restart ${binfile} - if ![runto setup_done] then { fail "can't run to setup_done" return 0 diff --git a/gdb/testsuite/gdb.base/killed-outside.exp b/gdb/testsuite/gdb.base/killed-outside.exp index 3c5ce25..0e14d5a 100644 --- a/gdb/testsuite/gdb.base/killed-outside.exp +++ b/gdb/testsuite/gdb.base/killed-outside.exp @@ -80,7 +80,7 @@ proc test {cmds_after_kill} { } } -if {[prepare_for_testing "failed to prepare" $testfile $srcfile] == -1} { +if {[build_executable "failed to prepare" $testfile $srcfile] == -1} { return -1 } diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index 672c26a..6844b87 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -21,7 +21,7 @@ standard_testfile list0.c list1.c # Need to download the header to the host. gdb_remote_download host ${srcdir}/${subdir}/list0.h -if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile $srcfile2] \ +if {[build_executable "failed to prepare" $testfile [list $srcfile $srcfile2] \ {debug}]} { return -1 } diff --git a/gdb/testsuite/gdb.base/many-headers.exp b/gdb/testsuite/gdb.base/many-headers.exp index 100c3e6..cc25b2e 100644 --- a/gdb/testsuite/gdb.base/many-headers.exp +++ b/gdb/testsuite/gdb.base/many-headers.exp @@ -26,7 +26,7 @@ if { [target_info gdb_protocol] != "" } { standard_testfile -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { +if {[build_executable "failed to prepare" $testfile $srcfile debug]} { return -1 } diff --git a/gdb/testsuite/gdb.base/msym-lang.exp b/gdb/testsuite/gdb.base/msym-lang.exp index 4b67986..72f817e 100644 --- a/gdb/testsuite/gdb.base/msym-lang.exp +++ b/gdb/testsuite/gdb.base/msym-lang.exp @@ -20,6 +20,4 @@ if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile $srcfile2] return -1 } -clean_restart ${testfile} - gdb_test "info func foo" ".* foo\\(\\).* foo\\(\\).*" diff --git a/gdb/testsuite/gdb.base/noreturn-finish.exp b/gdb/testsuite/gdb.base/noreturn-finish.exp index 16e0439..34db7c0 100644 --- a/gdb/testsuite/gdb.base/noreturn-finish.exp +++ b/gdb/testsuite/gdb.base/noreturn-finish.exp @@ -46,6 +46,4 @@ proc noreturn_finish_test { } { } } -clean_restart ${binfile} - noreturn_finish_test diff --git a/gdb/testsuite/gdb.base/noreturn-return.exp b/gdb/testsuite/gdb.base/noreturn-return.exp index 228625f..2942239 100644 --- a/gdb/testsuite/gdb.base/noreturn-return.exp +++ b/gdb/testsuite/gdb.base/noreturn-return.exp @@ -46,6 +46,4 @@ proc noreturn_test { } { } } -clean_restart ${binfile} - noreturn_test diff --git a/gdb/testsuite/gdb.base/pie-fork.exp b/gdb/testsuite/gdb.base/pie-fork.exp index d093c19..5ab6521 100644 --- a/gdb/testsuite/gdb.base/pie-fork.exp +++ b/gdb/testsuite/gdb.base/pie-fork.exp @@ -20,7 +20,7 @@ standard_testfile set opts [list debug pie] -if [prepare_for_testing "failed to prepare" $testfile $srcfile $opts] { +if [build_executable "failed to prepare" $testfile $srcfile $opts] { return } diff --git a/gdb/testsuite/gdb.base/random-signal.exp b/gdb/testsuite/gdb.base/random-signal.exp index 8511e83..b3d04a9 100644 --- a/gdb/testsuite/gdb.base/random-signal.exp +++ b/gdb/testsuite/gdb.base/random-signal.exp @@ -26,7 +26,7 @@ if [target_info exists gdb,nointerrupts] { standard_testfile -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { +if {[build_executable "failed to prepare" $testfile $srcfile debug]} { return -1 } diff --git a/gdb/testsuite/gdb.base/reread-readsym.exp b/gdb/testsuite/gdb.base/reread-readsym.exp index 673e566..597e46a 100644 --- a/gdb/testsuite/gdb.base/reread-readsym.exp +++ b/gdb/testsuite/gdb.base/reread-readsym.exp @@ -46,9 +46,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -# Start with a fresh gdb. -clean_restart ${testfile} - # Using the source command to read commands from a file is important, # otherwise section data is freed and reallocated using the same # memory locations and the bug is not exposed. diff --git a/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp b/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp index 261a51e..e848f27 100644 --- a/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp +++ b/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp @@ -23,7 +23,7 @@ if { [use_gdb_stub] } { standard_testfile -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { +if { [build_executable "failed to prepare" $testfile $srcfile debug] } { return -1 } diff --git a/gdb/testsuite/gdb.base/stack-protector.exp b/gdb/testsuite/gdb.base/stack-protector.exp index f042630..5181ce8 100644 --- a/gdb/testsuite/gdb.base/stack-protector.exp +++ b/gdb/testsuite/gdb.base/stack-protector.exp @@ -44,8 +44,6 @@ proc simple_func_break_test { protection } { return -1 } - clean_restart ${binfile} - if { ![runto_main] } then { fail "can't run to main" return -1 diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp index 8662b89..a78ad53 100644 --- a/gdb/testsuite/gdb.base/startup-with-shell.exp +++ b/gdb/testsuite/gdb.base/startup-with-shell.exp @@ -30,7 +30,7 @@ if { [is_remote target] } { standard_testfile -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { +if { [build_executable "failed to prepare" $testfile $srcfile debug] } { return -1 } diff --git a/gdb/testsuite/gdb.base/step-over-exit.exp b/gdb/testsuite/gdb.base/step-over-exit.exp index ff9666b..d9a47d3 100644 --- a/gdb/testsuite/gdb.base/step-over-exit.exp +++ b/gdb/testsuite/gdb.base/step-over-exit.exp @@ -35,8 +35,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -# Start with a fresh gdb. -clean_restart ${testfile} if ![runto_main] { fail "can't run to main" return -1 diff --git a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp index 270bc6c..33adda7 100644 --- a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp +++ b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp @@ -30,8 +30,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } -clean_restart $binfile - if ![runto_main] { untested "can't run to main" return -1 diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp index ddeb031..90baf3e 100644 --- a/gdb/testsuite/gdb.base/whatis.exp +++ b/gdb/testsuite/gdb.base/whatis.exp @@ -51,8 +51,6 @@ proc do_test {dir options} { return 0 } - clean_restart ${binfile} - # # Test whatis command with basic C types # |