* [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable
@ 2021-09-17 22:49 Tom de Vries
2021-09-23 15:12 ` Simon Marchi
2021-09-24 14:10 ` [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable Pedro Alves
0 siblings, 2 replies; 7+ messages in thread
From: Tom de Vries @ 2021-09-17 22:49 UTC (permalink / raw)
To: gdb-patches
Hi,
I noticed a pattern:
...
if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
return -1
}
foreach var {a b} {
clean_restart ${binfile}
...
}
...
In this case, gdb is restarted three times, while it's only necessary two
times.
Fix this by replacing prepare_for_testing with build_executable.
I wrote a script that attempts this tranformation on each test-case (only the
per-test part shown here):
...
cd $build
make check RUNTESTFLAGS=$test
sum=$build/testsuite/gdb.sum
if ! grep -q "expected passes" $sum; then
echo skipping $test
return
fi
grep ^# $sum > ref.txt
sed -i 's/prepare_for_testing/build_executable/' $src/$test
make check RUNTESTFLAGS=$test
grep ^# $sum > mod.txt
if cmp ref.txt mod.txt; then
return
else
( cd $src; git ch -f $test )
fi
...
This patch is the result of running the script on all test-cases, minus the
cases where prepare_for_testing was used in a comment. Touches 76 test-cases.
Tested on x86_64-linux.
Any comments?
Thanks,
- Tom
[gdb/testsuite] Replace prepare_for_testing with build_executable
---
gdb/testsuite/gdb.arch/amd64-init-x87-values.exp | 2 +-
gdb/testsuite/gdb.base/access-mem-running.exp | 2 +-
gdb/testsuite/gdb.base/attach-pie-noexec.exp | 2 +-
gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp | 2 +-
gdb/testsuite/gdb.base/bt-selected-frame.exp | 2 +-
gdb/testsuite/gdb.base/catch-syscall.exp | 2 +-
gdb/testsuite/gdb.base/condbreak.exp | 2 +-
gdb/testsuite/gdb.base/cvexpr.exp | 2 +-
gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp | 2 +-
gdb/testsuite/gdb.base/dprintf-detach.exp | 2 +-
gdb/testsuite/gdb.base/duplicate-bp.exp | 2 +-
gdb/testsuite/gdb.base/fork-print-inferior-events.exp | 2 +-
gdb/testsuite/gdb.base/frameapply.exp | 2 +-
gdb/testsuite/gdb.base/gcore-relro-pie.exp | 2 +-
gdb/testsuite/gdb.base/gcore-tls-pie.exp | 2 +-
gdb/testsuite/gdb.base/index-cache.exp | 2 +-
gdb/testsuite/gdb.base/info_minsym.exp | 2 +-
gdb/testsuite/gdb.base/info_qt.exp | 2 +-
gdb/testsuite/gdb.base/killed-outside.exp | 2 +-
gdb/testsuite/gdb.base/list.exp | 2 +-
| 2 +-
gdb/testsuite/gdb.base/msym-lang.exp | 2 +-
gdb/testsuite/gdb.base/noreturn-finish.exp | 2 +-
gdb/testsuite/gdb.base/noreturn-return.exp | 2 +-
gdb/testsuite/gdb.base/pie-fork.exp | 2 +-
gdb/testsuite/gdb.base/random-signal.exp | 2 +-
gdb/testsuite/gdb.base/reread-readsym.exp | 2 +-
gdb/testsuite/gdb.base/share-env-with-gdbserver.exp | 2 +-
gdb/testsuite/gdb.base/stack-protector.exp | 2 +-
gdb/testsuite/gdb.base/startup-with-shell.exp | 2 +-
gdb/testsuite/gdb.base/step-over-exit.exp | 2 +-
gdb/testsuite/gdb.base/watchpoint-hw-attach.exp | 2 +-
gdb/testsuite/gdb.base/whatis.exp | 2 +-
gdb/testsuite/gdb.cp/cplusfuncs.exp | 2 +-
gdb/testsuite/gdb.cp/rvalue-ref-params.exp | 2 +-
gdb/testsuite/gdb.cp/static-typedef-print.exp | 2 +-
gdb/testsuite/gdb.cp/typedef-base.exp | 2 +-
gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-icycle.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp | 2 +-
gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp | 2 +-
gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp | 4 ++--
gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp | 2 +-
gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp | 2 +-
gdb/testsuite/gdb.dwarf2/main-subprogram.exp | 2 +-
gdb/testsuite/gdb.fortran/array-slices.exp | 2 +-
gdb/testsuite/gdb.fortran/nested-funcs-2.exp | 2 +-
gdb/testsuite/gdb.fortran/subarray.exp | 2 +-
gdb/testsuite/gdb.gdb/unittest.exp | 2 +-
gdb/testsuite/gdb.mi/mi-fortran-modules.exp | 2 +-
gdb/testsuite/gdb.mi/mi-info-sources.exp | 2 +-
gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp | 2 +-
gdb/testsuite/gdb.mi/mi-sym-info.exp | 2 +-
gdb/testsuite/gdb.multi/info-threads.exp | 2 +-
gdb/testsuite/gdb.multi/multi-arch.exp | 4 ++--
gdb/testsuite/gdb.multi/multi-re-run.exp | 4 ++--
gdb/testsuite/gdb.multi/run-only-second-inf.exp | 2 +-
gdb/testsuite/gdb.multi/tids-gid-reset.exp | 2 +-
gdb/testsuite/gdb.multi/tids.exp | 2 +-
gdb/testsuite/gdb.python/py-infthread.exp | 2 +-
gdb/testsuite/gdb.server/connect-stopped-target.exp | 2 +-
gdb/testsuite/gdb.server/exit-multiple-threads.exp | 2 +-
gdb/testsuite/gdb.server/run-without-local-binary.exp | 2 +-
gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp | 2 +-
gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp | 2 +-
gdb/testsuite/gdb.threads/break-while-running.exp | 2 +-
gdb/testsuite/gdb.threads/clone-attach-detach.exp | 2 +-
gdb/testsuite/gdb.threads/next-bp-other-thread.exp | 2 +-
gdb/testsuite/gdb.threads/signal-sigtrap.exp | 2 +-
gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp | 2 +-
gdb/testsuite/gdb.threads/tid-reuse.exp | 2 +-
gdb/testsuite/gdb.trace/qtro.exp | 2 +-
76 files changed, 79 insertions(+), 79 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
index 9ec5c1772f5..1a748694e37 100644
--- a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
+++ b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
@@ -27,7 +27,7 @@ standard_testfile .S
set options [list debug \
additional_flags=-static \
additional_flags=-nostartfiles]
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $options] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile} $options] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/access-mem-running.exp b/gdb/testsuite/gdb.base/access-mem-running.exp
index 6990d906da2..9dec5bc96c6 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 32e5c7ddc3a..bb24eed2662 100644
--- a/gdb/testsuite/gdb.base/attach-pie-noexec.exp
+++ b/gdb/testsuite/gdb.base/attach-pie-noexec.exp
@@ -20,7 +20,7 @@ if {![can_spawn_for_attach]} {
standard_testfile .c
set executable ${testfile}
-if { [prepare_for_testing "failed to prepare" $executable "" [list debug "additional_flags=-fPIE" "ldflags=-pie"]] } {
+if { [build_executable "failed to prepare" $executable "" [list debug "additional_flags=-fPIE" "ldflags=-pie"]] } {
return -1
}
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 d21f580af87..c0c1fa28453 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 ed1a0481a2d..c454f4c9a11 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 a92730c05e6..60e8dedafff 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -21,7 +21,7 @@
standard_testfile
-if { [prepare_for_testing "failed to prepare" $testfile ${testfile}.c] } {
+if { [build_executable "failed to prepare" $testfile ${testfile}.c] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/condbreak.exp b/gdb/testsuite/gdb.base/condbreak.exp
index 3fd0f0782b4..af289eb4d11 100644
--- a/gdb/testsuite/gdb.base/condbreak.exp
+++ b/gdb/testsuite/gdb.base/condbreak.exp
@@ -23,7 +23,7 @@
standard_testfile break.c break1.c
-if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile $srcfile2] \
+if {[build_executable "failed to prepare" $testfile [list $srcfile $srcfile2] \
{debug nowarnings}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/cvexpr.exp b/gdb/testsuite/gdb.base/cvexpr.exp
index 6048699c133..02432cdb334 100644
--- a/gdb/testsuite/gdb.base/cvexpr.exp
+++ b/gdb/testsuite/gdb.base/cvexpr.exp
@@ -26,7 +26,7 @@ proc do_test {dir options} {
global srcfile testfile
set binfile [standard_output_file ${dir}/${testfile}]
- if { [prepare_for_testing "failed to prepare" ${binfile} \
+ if { [build_executable "failed to prepare" ${binfile} \
[list $srcfile] $options] } {
return 0
}
diff --git a/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp b/gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp
index 11fa7107397..58a5560cc5c 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 1a94d26f84c..aa06a5bee52 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 77fa160e094..5516925b8b4 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 eda0f50ca7b..051aeb76fa6 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 1c580008b46..f4b6b434e69 100644
--- a/gdb/testsuite/gdb.base/frameapply.exp
+++ b/gdb/testsuite/gdb.base/frameapply.exp
@@ -20,7 +20,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/gcore-relro-pie.exp b/gdb/testsuite/gdb.base/gcore-relro-pie.exp
index 5b25721ad61..46759980d4f 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 {debug additional_flags=-fpie "ldflags=-pie -Wl,-z,relro"}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug additional_flags=-fpie "ldflags=-pie -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 3f42cb4fe67..43461941c3e 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 {debug additional_flags=-fpie "ldflags=-pie -fuse-ld=gold"}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug additional_flags=-fpie "ldflags=-pie -fuse-ld=gold"}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/index-cache.exp b/gdb/testsuite/gdb.base/index-cache.exp
index 496145ed8fc..8dd35ad80bd 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 7353bcffab4..5ee883ae786 100644
--- a/gdb/testsuite/gdb.base/info_minsym.exp
+++ b/gdb/testsuite/gdb.base/info_minsym.exp
@@ -23,7 +23,7 @@ set testfile info_minsym
standard_testfile info_minsym.c
# Compile the program without debugging information, to have minimal symbols.
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {c}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {c}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/info_qt.exp b/gdb/testsuite/gdb.base/info_qt.exp
index 3f6e1428679..091e9d07708 100644
--- a/gdb/testsuite/gdb.base/info_qt.exp
+++ b/gdb/testsuite/gdb.base/info_qt.exp
@@ -23,7 +23,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/killed-outside.exp b/gdb/testsuite/gdb.base/killed-outside.exp
index 3c5ce25f6e4..0e14d5a2f92 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 672c26abcb9..6844b87084e 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
}
--git a/gdb/testsuite/gdb.base/many-headers.exp b/gdb/testsuite/gdb.base/many-headers.exp
index 100c3e64809..cc25b2e63ff 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 4b679868f0a..4f9eb326b44 100644
--- a/gdb/testsuite/gdb.base/msym-lang.exp
+++ b/gdb/testsuite/gdb.base/msym-lang.exp
@@ -15,7 +15,7 @@
standard_testfile msym-lang-main.c msym-lang.c
-if {[prepare_for_testing "failed to prepare" $testfile [list $srcfile $srcfile2] \
+if {[build_executable "failed to prepare" $testfile [list $srcfile $srcfile2] \
{c++}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/noreturn-finish.exp b/gdb/testsuite/gdb.base/noreturn-finish.exp
index 16e0439b7b0..3233ea4139f 100644
--- a/gdb/testsuite/gdb.base/noreturn-finish.exp
+++ b/gdb/testsuite/gdb.base/noreturn-finish.exp
@@ -15,7 +15,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/noreturn-return.exp b/gdb/testsuite/gdb.base/noreturn-return.exp
index 228625f8b0c..e12f8128899 100644
--- a/gdb/testsuite/gdb.base/noreturn-return.exp
+++ b/gdb/testsuite/gdb.base/noreturn-return.exp
@@ -15,7 +15,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/pie-fork.exp b/gdb/testsuite/gdb.base/pie-fork.exp
index 54932fe39ab..d8c4befe850 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 additional_flags=-fPIE ldflags=-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 8511e83fce5..b3d04a97e9d 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 673e566ceeb..b50eab06c5a 100644
--- a/gdb/testsuite/gdb.base/reread-readsym.exp
+++ b/gdb/testsuite/gdb.base/reread-readsym.exp
@@ -42,7 +42,7 @@ if [use_gdb_stub] {
return 0
}
-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/share-env-with-gdbserver.exp b/gdb/testsuite/gdb.base/share-env-with-gdbserver.exp
index 261a51e3921..e848f2730e7 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 f04263019d6..c5aeac94574 100644
--- a/gdb/testsuite/gdb.base/stack-protector.exp
+++ b/gdb/testsuite/gdb.base/stack-protector.exp
@@ -40,7 +40,7 @@ proc simple_func_break_test { protection } {
set options debug
lappend options additional_flags=$protection
- if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options]} {
+ if {[build_executable "failed to prepare" $testfile $srcfile $options]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/startup-with-shell.exp b/gdb/testsuite/gdb.base/startup-with-shell.exp
index 8662b894472..a78ad534f28 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 ff9666b7354..3672453e119 100644
--- a/gdb/testsuite/gdb.base/step-over-exit.exp
+++ b/gdb/testsuite/gdb.base/step-over-exit.exp
@@ -31,7 +31,7 @@ if { [istarget "i\[34567\]86-*-linux*"] || [istarget "x86_64-*-linux*"] } {
return -1
}
-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/watchpoint-hw-attach.exp b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
index 270bc6c29af..4fd546bf2e3 100644
--- a/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-attach.exp
@@ -26,7 +26,7 @@ if {![can_spawn_for_attach]} {
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/whatis.exp b/gdb/testsuite/gdb.base/whatis.exp
index ddeb031d832..19ef6c89d82 100644
--- a/gdb/testsuite/gdb.base/whatis.exp
+++ b/gdb/testsuite/gdb.base/whatis.exp
@@ -46,7 +46,7 @@ proc do_test {dir options} {
global srcfile testfile gcc_compiled
set binfile [standard_output_file ${dir}/${testfile}]
- if { [prepare_for_testing "failed to prepare" ${binfile} \
+ if { [build_executable "failed to prepare" ${binfile} \
[list $srcfile] $options] } {
return 0
}
diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp
index 73740155305..63fb0bc3d16 100644
--- a/gdb/testsuite/gdb.cp/cplusfuncs.exp
+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp
@@ -24,7 +24,7 @@ if { [get_compiler_info "c++"] } {
return -1
}
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-params.exp b/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
index 1fd3edb0584..e806662b31d 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
@@ -20,7 +20,7 @@ if {[skip_cplus_tests]} { continue }
standard_testfile .cc
-if {[prepare_for_testing $testfile.exp $testfile $srcfile \
+if {[build_executable $testfile.exp $testfile $srcfile \
{debug c++ additional_flags="-std=gnu++11"}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/static-typedef-print.exp b/gdb/testsuite/gdb.cp/static-typedef-print.exp
index 5a6cdbde527..16f1928e78d 100644
--- a/gdb/testsuite/gdb.cp/static-typedef-print.exp
+++ b/gdb/testsuite/gdb.cp/static-typedef-print.exp
@@ -21,7 +21,7 @@ if [get_compiler_info "c++"] {
return -1
}
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/typedef-base.exp b/gdb/testsuite/gdb.cp/typedef-base.exp
index 8376e195352..301e33f9c57 100644
--- a/gdb/testsuite/gdb.cp/typedef-base.exp
+++ b/gdb/testsuite/gdb.cp/typedef-base.exp
@@ -23,7 +23,7 @@ if [get_compiler_info "c++"] {
return -1
}
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp b/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp
index ff931f1f5d8..628eeb97d31 100644
--- a/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp
+++ b/gdb/testsuite/gdb.dwarf2/cpp-linkage-name.exp
@@ -82,7 +82,7 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
index bfe6a9c5cbb..93519853193 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
@@ -24,7 +24,7 @@ if {![dwarf2_support]} {
standard_testfile .S main.c
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $srcfile2] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
index 383e2400a25..2bdca4a4bcb 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-many-frames.exp
@@ -291,7 +291,7 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
index 6f134be85b3..d6bf9364b80 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-inline-stepping.exp
@@ -128,7 +128,7 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
index 42cfd0b61ec..1c50b0315a5 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-out-of-range-end-of-seq.exp
@@ -75,7 +75,7 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
index 5da60bf3a33..cf7e81ac12e 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-ranges-overlap.exp
@@ -74,7 +74,7 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp b/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
index 1d6d7d65335..12758c1a69f 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-regno-invalid.exp
@@ -56,7 +56,7 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
index be500e1a003..23d37add368 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-vendor-extended-opcode.exp
@@ -69,7 +69,7 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
index 3cf6b079908..54beab3410b 100644
--- a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
@@ -29,7 +29,7 @@ set asm_file [standard_output_file ${srcfile2}]
# We need to know the size of integer types in order to write some of the
# debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
+if [build_executable "failed to prepare" ${testfile} ${srcfile}] {
return -1
}
@@ -78,7 +78,7 @@ Dwarf::assemble $asm_file {
}
}
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
index 2483349bf78..6cd8e5104fe 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
@@ -27,7 +27,7 @@ if {![dwarf2_support]} {
standard_testfile .c -dw.S
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
index 566d756c1a8..fd9ce9381c6 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
@@ -25,7 +25,7 @@ if {![dwarf2_support]} {
standard_testfile .c -dw.S
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/main-subprogram.exp b/gdb/testsuite/gdb.dwarf2/main-subprogram.exp
index c618a40f2fb..7321adfce30 100644
--- a/gdb/testsuite/gdb.dwarf2/main-subprogram.exp
+++ b/gdb/testsuite/gdb.dwarf2/main-subprogram.exp
@@ -50,7 +50,7 @@ Dwarf::assemble $asm_file {
}
}
-if {[prepare_for_testing "failed to prepare" ${testfile} \
+if {[build_executable "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
index f9671ec1f00..8200a0ca284 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -38,7 +38,7 @@ if {[skip_fortran_tests]} { return -1 }
standard_testfile ".f90"
load_lib fortran.exp
-if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+if {[build_executable ${testfile}.exp ${testfile} ${srcfile} \
{debug f90}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/nested-funcs-2.exp b/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
index 9ab3ee599a0..f679529478a 100644
--- a/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
+++ b/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
@@ -20,7 +20,7 @@ load_lib "fortran.exp"
standard_testfile ".f90"
-if {[prepare_for_testing ${testfile}.exp ${testfile} \
+if {[build_executable ${testfile}.exp ${testfile} \
${srcfile} {debug f90}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
index 8c7d5a97940..75012764340 100644
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -23,7 +23,7 @@ if { [skip_fortran_tests] } { return -1 }
standard_testfile .f
load_lib fortran.exp
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp
index 3622243492c..670205fff76 100644
--- a/gdb/testsuite/gdb.gdb/unittest.exp
+++ b/gdb/testsuite/gdb.gdb/unittest.exp
@@ -24,7 +24,7 @@ set do_xml_test [expr ![gdb_skip_xml_test]]
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.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
index 06069953afa..fc1fa411ee3 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
@@ -23,7 +23,7 @@ set MIFLAGS "-i=mi"
standard_testfile "mi-fortran-modules.f90" "mi-fortran-modules-2.f90"
-if {[prepare_for_testing "failed to prepare" ${testfile} \
+if {[build_executable "failed to prepare" ${testfile} \
[list $srcfile2 $srcfile] {debug f90}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.exp b/gdb/testsuite/gdb.mi/mi-info-sources.exp
index a43e939063a..7451af65952 100644
--- a/gdb/testsuite/gdb.mi/mi-info-sources.exp
+++ b/gdb/testsuite/gdb.mi/mi-info-sources.exp
@@ -20,7 +20,7 @@ set MIFLAGS "-i=mi"
standard_testfile .c -base.c
-if {[prepare_for_testing $testfile.exp $testfile \
+if {[build_executable $testfile.exp $testfile \
[list $srcfile $srcfile2] debug]} {
untested $testfile.exp
return -1
diff --git a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
index 4f7150bf1ac..dacbdd8962d 100644
--- a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
+++ b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
@@ -27,7 +27,7 @@ set MIFLAGS "-i=mi"
standard_testfile .cc
set exefile $testfile
-if {[prepare_for_testing "failed to prepare" $exefile $srcfile {debug c++}]} {
+if {[build_executable "failed to prepare" $exefile $srcfile {debug c++}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp
index dfe23ec49ca..5eb72011989 100644
--- a/gdb/testsuite/gdb.mi/mi-sym-info.exp
+++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp
@@ -28,7 +28,7 @@ set MIFLAGS "-i=mi"
standard_testfile mi-sym-info-1.c mi-sym-info-2.c
-if {[prepare_for_testing "failed to prepare" ${testfile} \
+if {[build_executable "failed to prepare" ${testfile} \
[list $srcfile $srcfile2] {debug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/info-threads.exp b/gdb/testsuite/gdb.multi/info-threads.exp
index 8ebd03b290c..2a48a1339df 100644
--- a/gdb/testsuite/gdb.multi/info-threads.exp
+++ b/gdb/testsuite/gdb.multi/info-threads.exp
@@ -20,7 +20,7 @@
standard_testfile hello.c
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {pthreads debug}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile} {pthreads debug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp
index e859282dbc4..c1c77917e45 100644
--- a/gdb/testsuite/gdb.multi/multi-arch.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch.exp
@@ -52,7 +52,7 @@ if [istarget "s390*-*-*"] {
set march2 "-m32"
}
-if { [prepare_for_testing "failed to prepare" ${exec1} "${srcfile1}" \
+if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
[list debug additional_flags=${march1}]] } {
return -1
}
@@ -70,7 +70,7 @@ if [istarget "aarch64*-*-*"] {
lappend options "additional_flags=${march2}"
}
-if { [prepare_for_testing "failed to prepare" ${exec2} "${srcfile2}" \
+if { [build_executable "failed to prepare" ${exec2} "${srcfile2}" \
$options]} {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/multi-re-run.exp b/gdb/testsuite/gdb.multi/multi-re-run.exp
index 8bf126ef95a..6eda6fafb5b 100644
--- a/gdb/testsuite/gdb.multi/multi-re-run.exp
+++ b/gdb/testsuite/gdb.multi/multi-re-run.exp
@@ -31,14 +31,14 @@ set srcfile2 multi-re-run-2.c
set binfile2 [standard_output_file ${exec2}]
with_test_prefix "exec1" {
- if { [prepare_for_testing "failed to prepare" ${exec1} "${srcfile1}" \
+ if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
[list pthreads debug]] } {
return -1
}
}
with_test_prefix "exec2" {
- if { [prepare_for_testing "failed to prepare" ${exec2} "${srcfile2}" \
+ if { [build_executable "failed to prepare" ${exec2} "${srcfile2}" \
[list pthreads debug]] } {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/run-only-second-inf.exp b/gdb/testsuite/gdb.multi/run-only-second-inf.exp
index e5d124916d4..69ff07bea28 100644
--- a/gdb/testsuite/gdb.multi/run-only-second-inf.exp
+++ b/gdb/testsuite/gdb.multi/run-only-second-inf.exp
@@ -24,7 +24,7 @@ if {[use_gdb_stub]} {
return 0
}
-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.multi/tids-gid-reset.exp b/gdb/testsuite/gdb.multi/tids-gid-reset.exp
index d8dac7cf7fe..fce24435455 100644
--- a/gdb/testsuite/gdb.multi/tids-gid-reset.exp
+++ b/gdb/testsuite/gdb.multi/tids-gid-reset.exp
@@ -22,7 +22,7 @@
standard_testfile
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {pthreads debug}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile} {pthreads debug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp
index f1d6db60f70..896cd40e642 100644
--- a/gdb/testsuite/gdb.multi/tids.exp
+++ b/gdb/testsuite/gdb.multi/tids.exp
@@ -27,7 +27,7 @@ if [use_gdb_stub] {
return
}
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {pthreads debug}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile} {pthreads debug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-infthread.exp b/gdb/testsuite/gdb.python/py-infthread.exp
index aa0b802a11e..09068d69943 100644
--- a/gdb/testsuite/gdb.python/py-infthread.exp
+++ b/gdb/testsuite/gdb.python/py-infthread.exp
@@ -20,7 +20,7 @@ load_lib gdb-python.exp
standard_testfile
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.server/connect-stopped-target.exp b/gdb/testsuite/gdb.server/connect-stopped-target.exp
index 06a4e98d85e..bab3b88a194 100644
--- a/gdb/testsuite/gdb.server/connect-stopped-target.exp
+++ b/gdb/testsuite/gdb.server/connect-stopped-target.exp
@@ -27,7 +27,7 @@ if {[skip_gdbserver_tests]} {
standard_testfile
set executable ${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.server/exit-multiple-threads.exp b/gdb/testsuite/gdb.server/exit-multiple-threads.exp
index a74f7d12449..27c09b234e2 100644
--- a/gdb/testsuite/gdb.server/exit-multiple-threads.exp
+++ b/gdb/testsuite/gdb.server/exit-multiple-threads.exp
@@ -135,7 +135,7 @@ foreach_with_prefix test { exit signal } {
set func "run_${test}_test"
set executable "$binfile-${test}"
- if [prepare_for_testing "failed to prepare" $executable $srcfile \
+ if [build_executable "failed to prepare" $executable $srcfile \
[list debug pthreads additional_flags=-D${def}]] {
return -1
}
diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp
index 395eddc9106..7c96c9bc321 100644
--- a/gdb/testsuite/gdb.server/run-without-local-binary.exp
+++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp
@@ -21,7 +21,7 @@ if {[skip_gdbserver_tests]} {
standard_testfile normal.c
-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.threads/access-mem-running-thread-exit.exp b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
index ea228e4ba13..b2fef9fca6a 100644
--- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
+++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
@@ -35,7 +35,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
index cb632572e08..251ff872610 100644
--- a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
+++ b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
@@ -170,7 +170,7 @@ proc test {} {
# failure.
set options { "additional_flags=-DTIMEOUT=$timeout" debug pthreads }
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile $options] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/break-while-running.exp b/gdb/testsuite/gdb.threads/break-while-running.exp
index 68d9bf86d37..de398241ecf 100644
--- a/gdb/testsuite/gdb.threads/break-while-running.exp
+++ b/gdb/testsuite/gdb.threads/break-while-running.exp
@@ -24,7 +24,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/clone-attach-detach.exp b/gdb/testsuite/gdb.threads/clone-attach-detach.exp
index 4c6813b0ece..9b8eac39746 100644
--- a/gdb/testsuite/gdb.threads/clone-attach-detach.exp
+++ b/gdb/testsuite/gdb.threads/clone-attach-detach.exp
@@ -29,7 +29,7 @@ if {![can_spawn_for_attach]} {
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.threads/next-bp-other-thread.exp b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
index 1abbe585f65..06f63cfaa63 100644
--- a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
@@ -20,7 +20,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/signal-sigtrap.exp b/gdb/testsuite/gdb.threads/signal-sigtrap.exp
index 92488a50ac1..9ae96820481 100644
--- a/gdb/testsuite/gdb.threads/signal-sigtrap.exp
+++ b/gdb/testsuite/gdb.threads/signal-sigtrap.exp
@@ -23,7 +23,7 @@ if [target_info exists gdb,nosignals] {
return -1
}
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
index 55ebd40c2e4..c3d8326f67d 100644
--- a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
+++ b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
@@ -30,7 +30,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/tid-reuse.exp b/gdb/testsuite/gdb.threads/tid-reuse.exp
index 1d93a55e46c..4ad13058bff 100644
--- a/gdb/testsuite/gdb.threads/tid-reuse.exp
+++ b/gdb/testsuite/gdb.threads/tid-reuse.exp
@@ -18,7 +18,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile { debug pthreads }] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile { debug pthreads }] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp
index 91a6612fb10..8b538e8c249 100644
--- a/gdb/testsuite/gdb.trace/qtro.exp
+++ b/gdb/testsuite/gdb.trace/qtro.exp
@@ -22,7 +22,7 @@ load_lib trace-support.exp
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug nopie}]} {
return -1
}
clean_restart $testfile
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable
2021-09-17 22:49 [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable Tom de Vries
@ 2021-09-23 15:12 ` Simon Marchi
2021-09-23 21:43 ` Tom de Vries
2021-09-24 14:10 ` [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable Pedro Alves
1 sibling, 1 reply; 7+ messages in thread
From: Simon Marchi @ 2021-09-23 15:12 UTC (permalink / raw)
To: Tom de Vries, gdb-patches
On 2021-09-17 6:49 p.m., Tom de Vries via Gdb-patches wrote:
> Hi,
>
> I noticed a pattern:
> ...
> if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
> return -1
> }
>
> foreach var {a b} {
> clean_restart ${binfile}
> ...
> }
> ...
>
> In this case, gdb is restarted three times, while it's only necessary two
> times.
>
> Fix this by replacing prepare_for_testing with build_executable.
>
> I wrote a script that attempts this tranformation on each test-case (only the
> per-test part shown here):
> ...
> cd $build
> make check RUNTESTFLAGS=$test
> sum=$build/testsuite/gdb.sum
> if ! grep -q "expected passes" $sum; then
> echo skipping $test
> return
> fi
>
> grep ^# $sum > ref.txt
> sed -i 's/prepare_for_testing/build_executable/' $src/$test
> make check RUNTESTFLAGS=$test
>
> grep ^# $sum > mod.txt
> if cmp ref.txt mod.txt; then
> return
> else
> ( cd $src; git ch -f $test )
> fi
> ...
>
> This patch is the result of running the script on all test-cases, minus the
> cases where prepare_for_testing was used in a comment. Touches 76 test-cases.
I didn't check all changes, but I agree with the idea of the patch.
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable
2021-09-23 15:12 ` Simon Marchi
@ 2021-09-23 21:43 ` Tom de Vries
2021-09-24 12:34 ` [PATCH][gdb/testsuite] Don't leave gdb instance running after function_range Tom de Vries
0 siblings, 1 reply; 7+ messages in thread
From: Tom de Vries @ 2021-09-23 21:43 UTC (permalink / raw)
To: Simon Marchi, gdb-patches
On 9/23/21 5:12 PM, Simon Marchi wrote:
> On 2021-09-17 6:49 p.m., Tom de Vries via Gdb-patches wrote:
>> Hi,
>>
>> I noticed a pattern:
>> ...
>> if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
>> return -1
>> }
>>
>> foreach var {a b} {
>> clean_restart ${binfile}
>> ...
>> }
>> ...
>>
>> In this case, gdb is restarted three times, while it's only necessary two
>> times.
>>
>> Fix this by replacing prepare_for_testing with build_executable.
>>
>> I wrote a script that attempts this tranformation on each test-case (only the
>> per-test part shown here):
>> ...
>> cd $build
>> make check RUNTESTFLAGS=$test
>> sum=$build/testsuite/gdb.sum
>> if ! grep -q "expected passes" $sum; then
>> echo skipping $test
>> return
>> fi
>>
>> grep ^# $sum > ref.txt
>> sed -i 's/prepare_for_testing/build_executable/' $src/$test
>> make check RUNTESTFLAGS=$test
>>
>> grep ^# $sum > mod.txt
>> if cmp ref.txt mod.txt; then
>> return
>> else
>> ( cd $src; git ch -f $test )
>> fi
>> ...
>>
>> This patch is the result of running the script on all test-cases, minus the
>> cases where prepare_for_testing was used in a comment. Touches 76 test-cases.
>
> I didn't check all changes, but I agree with the idea of the patch.
Good to hear.
I've reviewed all changes once more.
I found a problem in cpp-linkage-name.exp. The test passes, but the gdb
commands execute on a lingering gdb instance started by function_range,
so I had to fix that first (by adding gdb_exit at the end of
function_range) to trigger the FAIL introduced by the script. I've
removed the change in that test-case, and similar cases, and am
currently retesting.
Thanks,
- Tom
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH][gdb/testsuite] Don't leave gdb instance running after function_range
2021-09-23 21:43 ` Tom de Vries
@ 2021-09-24 12:34 ` Tom de Vries
2021-09-24 13:56 ` Simon Marchi
0 siblings, 1 reply; 7+ messages in thread
From: Tom de Vries @ 2021-09-24 12:34 UTC (permalink / raw)
To: Simon Marchi, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 570 bytes --]
[ Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with
build_executable ]
On 9/23/21 11:43 PM, Tom de Vries wrote:
> I found a problem in cpp-linkage-name.exp. The test passes, but the gdb
> commands execute on a lingering gdb instance started by function_range,
> so I had to fix that first (by adding gdb_exit at the end of
> function_range) to trigger the FAIL introduced by the script. I've
> removed the change in that test-case, and similar cases, and am
> currently retesting.
I've factored this out as a separate patch.
Any comments?
Thanks,
- Tom
[-- Attachment #2: 0001-gdb-testsuite-Don-t-leave-gdb-instance-running-after-function_range.patch --]
[-- Type: text/x-patch, Size: 3277 bytes --]
[gdb/testsuite] Don't leave gdb instance running after function_range
A typical dwarf assembly test-case start like this:
...
standard_testfile .c -debug.S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
...
}
if { [prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}] } {
return -1
}
...
When accidentally using build_for_executable instead of
prepare_for_testing (or intentionally using it but forgetting to add
clean_restart $binfile or some such) the mistake may not be caught, because
another gdb instance is still running, and we may silently end up testing
compiler-generated DWARF.
This can be caused by something relatively obvious, like an earlier
prepare_for_testing or clean_restart, but also by something more obscure like
function_range, which may even be triggered by dwarf assembly like this:
...
{MACRO_AT_func {main}}
...
Fix this by calling gdb_exit at the end of function_range.
Also fix the fallout of that in test-case gdb.dwarf2/dw2-bad-elf.exp, where a
get_sizeof call used the gdb instance left lingering by function_range.
[ A better and more complete fix would add a new proc get_exec_info, that would
be called at the start of the dwarf:
...
Dwarf::assemble $asm_file {
get_exec_info {main foo} {int void*}
...
that would:
- do a prepare_for_testing with $srcfile (roughtly equivalent to what
MACRO_AT_func does,
- call function_range for all functions main and foo, without starting a
new gdb instance
- set corresponding variables at the call-site: main_start, main_len,
main_end, foo_start, foo_len, foo_end.
- get size for types int and void*
- set corresponding variable at the call-site: int_size, void_ptr_size. ]
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp | 11 ++++++++---
gdb/testsuite/lib/dwarf.exp | 1 +
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
index 5ab08c18f77..d276bf8f0d4 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-bad-elf.exp
@@ -36,10 +36,17 @@ if {![dwarf2_support]} {
standard_testfile main.c -other.S -dwarf.S
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
+ untested "failed to compile"
+ return -1
+}
+
+set int_size [get_sizeof "int" 4]
+
# Make some DWARF for the test.
set asm_file [standard_output_file $srcfile3]
Dwarf::assemble $asm_file {
- global srcdir subdir srcfile srcfile2
+ global srcdir subdir srcfile srcfile2 int_size
declare_labels ranges_label_1 ranges_label_2 L1 L2
@@ -47,8 +54,6 @@ Dwarf::assemble $asm_file {
set main_start [lindex $main_result 0]
set main_length [lindex $main_result 1]
- set int_size [get_sizeof "int" 4]
-
cu {} {
DW_TAG_compile_unit {
{DW_AT_language @DW_LANG_C}
diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp
index 87bb6c152d1..c248296aa8d 100644
--- a/gdb/testsuite/lib/dwarf.exp
+++ b/gdb/testsuite/lib/dwarf.exp
@@ -271,6 +271,7 @@ proc function_range { func src {options {debug}} } {
}
}
+ gdb_exit
return [list "${func}_label - $func_label_offset" $func_length]
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][gdb/testsuite] Don't leave gdb instance running after function_range
2021-09-24 12:34 ` [PATCH][gdb/testsuite] Don't leave gdb instance running after function_range Tom de Vries
@ 2021-09-24 13:56 ` Simon Marchi
0 siblings, 0 replies; 7+ messages in thread
From: Simon Marchi @ 2021-09-24 13:56 UTC (permalink / raw)
To: Tom de Vries, gdb-patches
On 2021-09-24 8:34 a.m., Tom de Vries wrote:
> [ Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with
> build_executable ]
>
> On 9/23/21 11:43 PM, Tom de Vries wrote:
>> I found a problem in cpp-linkage-name.exp. The test passes, but the gdb
>> commands execute on a lingering gdb instance started by function_range,
>> so I had to fix that first (by adding gdb_exit at the end of
>> function_range) to trigger the FAIL introduced by the script. I've
>> removed the change in that test-case, and similar cases, and am
>> currently retesting.
>
> I've factored this out as a separate patch.
>
> Any comments?
>
> Thanks,
> - Tom
>
That LGTM, thanks.
Simon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable
2021-09-17 22:49 [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable Tom de Vries
2021-09-23 15:12 ` Simon Marchi
@ 2021-09-24 14:10 ` Pedro Alves
2021-09-24 19:40 ` Tom de Vries
1 sibling, 1 reply; 7+ messages in thread
From: Pedro Alves @ 2021-09-24 14:10 UTC (permalink / raw)
To: Tom de Vries, gdb-patches
On 2021-09-17 11:49 p.m., Tom de Vries via Gdb-patches wrote:
> diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp
> index 91a6612fb10..8b538e8c249 100644
> --- a/gdb/testsuite/gdb.trace/qtro.exp
> +++ b/gdb/testsuite/gdb.trace/qtro.exp
> @@ -22,7 +22,7 @@ load_lib trace-support.exp
>
> standard_testfile
>
> -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} {
> +if {[build_executable "failed to prepare" $testfile $srcfile {debug nopie}]} {
> return -1
> }
> clean_restart $testfile
Well, cases like the above would be better handled by removing the clean_restart call.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable
2021-09-24 14:10 ` [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable Pedro Alves
@ 2021-09-24 19:40 ` Tom de Vries
0 siblings, 0 replies; 7+ messages in thread
From: Tom de Vries @ 2021-09-24 19:40 UTC (permalink / raw)
To: Pedro Alves, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 832 bytes --]
On 9/24/21 4:10 PM, Pedro Alves wrote:
> On 2021-09-17 11:49 p.m., Tom de Vries via Gdb-patches wrote:
>> diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp
>> index 91a6612fb10..8b538e8c249 100644
>> --- a/gdb/testsuite/gdb.trace/qtro.exp
>> +++ b/gdb/testsuite/gdb.trace/qtro.exp
>> @@ -22,7 +22,7 @@ load_lib trace-support.exp
>>
>> standard_testfile
>>
>> -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} {
>> +if {[build_executable "failed to prepare" $testfile $srcfile {debug nopie}]} {
>> return -1
>> }
>> clean_restart $testfile
>
> Well, cases like the above would be better handled by removing the clean_restart call.
>
Indeed.
I did one more pass over it and retested.
I'll commit tomorrow unless there are further comments.
Thanks,
- Tom
[-- Attachment #2: 0001-gdb-testsuite-Minimize-gdb-restarts.patch --]
[-- Type: text/x-patch, Size: 39146 bytes --]
[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.
---
gdb/testsuite/gdb.arch/amd64-init-x87-values.exp | 2 +-
gdb/testsuite/gdb.base/access-mem-running.exp | 2 +-
gdb/testsuite/gdb.base/attach-pie-noexec.exp | 1 -
gdb/testsuite/gdb.base/bp-cmds-continue-ctrl-c.exp | 2 +-
gdb/testsuite/gdb.base/bt-selected-frame.exp | 2 +-
gdb/testsuite/gdb.base/catch-syscall.exp | 1 -
gdb/testsuite/gdb.base/condbreak.exp | 3 ---
gdb/testsuite/gdb.base/cvexpr.exp | 2 --
gdb/testsuite/gdb.base/dprintf-bp-same-addr.exp | 2 +-
gdb/testsuite/gdb.base/dprintf-detach.exp | 2 +-
gdb/testsuite/gdb.base/duplicate-bp.exp | 2 +-
gdb/testsuite/gdb.base/fork-print-inferior-events.exp | 2 +-
gdb/testsuite/gdb.base/frameapply.exp | 3 ---
gdb/testsuite/gdb.base/gcore-relro-pie.exp | 2 +-
gdb/testsuite/gdb.base/gcore-tls-pie.exp | 2 +-
gdb/testsuite/gdb.base/index-cache.exp | 2 +-
gdb/testsuite/gdb.base/info_minsym.exp | 2 --
gdb/testsuite/gdb.base/info_qt.exp | 2 --
gdb/testsuite/gdb.base/killed-outside.exp | 2 +-
gdb/testsuite/gdb.base/list.exp | 2 +-
| 2 +-
gdb/testsuite/gdb.base/msym-lang.exp | 2 --
gdb/testsuite/gdb.base/noreturn-finish.exp | 2 --
gdb/testsuite/gdb.base/noreturn-return.exp | 2 --
gdb/testsuite/gdb.base/pie-fork.exp | 2 +-
gdb/testsuite/gdb.base/random-signal.exp | 2 +-
gdb/testsuite/gdb.base/reread-readsym.exp | 3 ---
gdb/testsuite/gdb.base/share-env-with-gdbserver.exp | 2 +-
gdb/testsuite/gdb.base/stack-protector.exp | 2 --
gdb/testsuite/gdb.base/startup-with-shell.exp | 2 +-
gdb/testsuite/gdb.base/step-over-exit.exp | 2 --
gdb/testsuite/gdb.base/watchpoint-hw-attach.exp | 2 --
gdb/testsuite/gdb.base/whatis.exp | 2 --
gdb/testsuite/gdb.cp/cplusfuncs.exp | 2 --
gdb/testsuite/gdb.cp/rvalue-ref-params.exp | 2 +-
gdb/testsuite/gdb.cp/static-typedef-print.exp | 2 --
gdb/testsuite/gdb.cp/typedef-base.exp | 2 --
gdb/testsuite/gdb.dwarf2/dw2-icycle.exp | 2 +-
gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp | 8 --------
gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp | 4 ----
gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp | 4 ----
gdb/testsuite/gdb.fortran/array-slices.exp | 2 +-
gdb/testsuite/gdb.fortran/nested-funcs-2.exp | 2 +-
gdb/testsuite/gdb.fortran/subarray.exp | 5 -----
gdb/testsuite/gdb.gdb/unittest.exp | 2 +-
gdb/testsuite/gdb.mi/mi-fortran-modules.exp | 2 +-
gdb/testsuite/gdb.mi/mi-info-sources.exp | 2 +-
gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp | 2 +-
gdb/testsuite/gdb.mi/mi-sym-info.exp | 2 +-
gdb/testsuite/gdb.multi/info-threads.exp | 2 --
gdb/testsuite/gdb.multi/multi-arch.exp | 4 ++--
gdb/testsuite/gdb.multi/multi-re-run.exp | 4 ++--
gdb/testsuite/gdb.multi/run-only-second-inf.exp | 2 +-
gdb/testsuite/gdb.multi/tids-gid-reset.exp | 3 ++-
gdb/testsuite/gdb.multi/tids.exp | 2 --
gdb/testsuite/gdb.python/py-infthread.exp | 3 ---
gdb/testsuite/gdb.server/connect-stopped-target.exp | 2 +-
gdb/testsuite/gdb.server/exit-multiple-threads.exp | 2 +-
gdb/testsuite/gdb.server/run-without-local-binary.exp | 2 +-
gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp | 2 +-
gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp | 5 ++---
gdb/testsuite/gdb.threads/break-while-running.exp | 2 +-
gdb/testsuite/gdb.threads/clone-attach-detach.exp | 2 --
gdb/testsuite/gdb.threads/next-bp-other-thread.exp | 3 ++-
gdb/testsuite/gdb.threads/signal-sigtrap.exp | 3 ++-
gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp | 2 --
gdb/testsuite/gdb.threads/tid-reuse.exp | 2 --
gdb/testsuite/gdb.trace/qtro.exp | 1 -
68 files changed, 45 insertions(+), 115 deletions(-)
diff --git a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
index 9ec5c1772f5..1a748694e37 100644
--- a/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
+++ b/gdb/testsuite/gdb.arch/amd64-init-x87-values.exp
@@ -27,7 +27,7 @@ standard_testfile .S
set options [list debug \
additional_flags=-static \
additional_flags=-nostartfiles]
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $options] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile} $options] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/access-mem-running.exp b/gdb/testsuite/gdb.base/access-mem-running.exp
index 6990d906da2..9dec5bc96c6 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 ae3d0bc64d9..85161fa7c55 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 d21f580af87..c0c1fa28453 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 ed1a0481a2d..c454f4c9a11 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 a92730c05e6..d7183d18bcd 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 3fd0f0782b4..5bcc7e76cf0 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 6048699c133..c434c11f45f 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 11fa7107397..58a5560cc5c 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 1a94d26f84c..aa06a5bee52 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 77fa160e094..5516925b8b4 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 eda0f50ca7b..051aeb76fa6 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 1c580008b46..346d2296c5d 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 39142fe4254..6c2bfc37d85 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 e514c42d498..bb635cb1045 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 496145ed8fc..8dd35ad80bd 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 7353bcffab4..fe3f4c550d7 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 3f6e1428679..c6f242b9d03 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 3c5ce25f6e4..0e14d5a2f92 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 672c26abcb9..6844b87084e 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
}
--git a/gdb/testsuite/gdb.base/many-headers.exp b/gdb/testsuite/gdb.base/many-headers.exp
index 100c3e64809..cc25b2e63ff 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 4b679868f0a..72f817e3a3a 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 16e0439b7b0..34db7c02a6a 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 228625f8b0c..294223988aa 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 d093c195da0..5ab65213003 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 8511e83fce5..b3d04a97e9d 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 673e566ceeb..597e46ac896 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 261a51e3921..e848f2730e7 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 f04263019d6..5181ce89383 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 8662b894472..a78ad534f28 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 ff9666b7354..d9a47d36d73 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 270bc6c29af..33adda7b5f8 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 ddeb031d832..90baf3e1f23 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
#
diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp
index 73740155305..7d021a7ed8c 100644
--- a/gdb/testsuite/gdb.cp/cplusfuncs.exp
+++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp
@@ -581,8 +581,6 @@ proc do_tests {} {
global binfile
global dm_type_int_star
- clean_restart $binfile
-
gdb_test_no_output "set width 0"
runto_main
diff --git a/gdb/testsuite/gdb.cp/rvalue-ref-params.exp b/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
index 1fd3edb0584..e806662b31d 100644
--- a/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
+++ b/gdb/testsuite/gdb.cp/rvalue-ref-params.exp
@@ -20,7 +20,7 @@ if {[skip_cplus_tests]} { continue }
standard_testfile .cc
-if {[prepare_for_testing $testfile.exp $testfile $srcfile \
+if {[build_executable $testfile.exp $testfile $srcfile \
{debug c++ additional_flags="-std=gnu++11"}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.cp/static-typedef-print.exp b/gdb/testsuite/gdb.cp/static-typedef-print.exp
index 5a6cdbde527..3c8e286a1f2 100644
--- a/gdb/testsuite/gdb.cp/static-typedef-print.exp
+++ b/gdb/testsuite/gdb.cp/static-typedef-print.exp
@@ -25,8 +25,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-clean_restart $testfile
-
if ![runto_main] {
untested "could not run to main"
return -1
diff --git a/gdb/testsuite/gdb.cp/typedef-base.exp b/gdb/testsuite/gdb.cp/typedef-base.exp
index 8376e195352..7edc1640c45 100644
--- a/gdb/testsuite/gdb.cp/typedef-base.exp
+++ b/gdb/testsuite/gdb.cp/typedef-base.exp
@@ -27,8 +27,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
return -1
}
-clean_restart $testfile
-
if ![runto_main] {
untested "could not run to main"
return -1
diff --git a/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
index bfe6a9c5cbb..93519853193 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-icycle.exp
@@ -24,7 +24,7 @@ if {![dwarf2_support]} {
standard_testfile .S main.c
-if { [prepare_for_testing "failed to prepare" ${testfile} \
+if { [build_executable "failed to prepare" ${testfile} \
[list $srcfile $srcfile2] {nodebug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
index 3cf6b079908..dab19d0c431 100644
--- a/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/enqueued-cu-base-addr.exp
@@ -27,12 +27,6 @@ standard_testfile main.c .S
set executable ${testfile}
set asm_file [standard_output_file ${srcfile2}]
-# We need to know the size of integer types in order to write some of the
-# debugging info we'd like to generate.
-if [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] {
- return -1
-}
-
# Create the DWARF.
Dwarf::assemble $asm_file {
global srcdir subdir srcfile
@@ -83,8 +77,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile} \
return -1
}
-clean_restart ${binfile}
-
# Expand cu1. This will enqueue cu2.
gdb_test "ptype foo" "type = int"
diff --git a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
index 2483349bf78..082a09dbcfe 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-absolute-dwo.exp
@@ -27,10 +27,6 @@ if {![dwarf2_support]} {
standard_testfile .c -dw.S
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
- return -1
-}
-
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
global srcfile binfile objdir
diff --git a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
index 566d756c1a8..8faa6eaee31 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-relative-dwo.exp
@@ -25,10 +25,6 @@ if {![dwarf2_support]} {
standard_testfile .c -dw.S
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
- return -1
-}
-
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
global srcfile gdb_test_file_name
diff --git a/gdb/testsuite/gdb.fortran/array-slices.exp b/gdb/testsuite/gdb.fortran/array-slices.exp
index f9671ec1f00..8200a0ca284 100644
--- a/gdb/testsuite/gdb.fortran/array-slices.exp
+++ b/gdb/testsuite/gdb.fortran/array-slices.exp
@@ -38,7 +38,7 @@ if {[skip_fortran_tests]} { return -1 }
standard_testfile ".f90"
load_lib fortran.exp
-if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} \
+if {[build_executable ${testfile}.exp ${testfile} ${srcfile} \
{debug f90}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/nested-funcs-2.exp b/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
index 9ab3ee599a0..f679529478a 100644
--- a/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
+++ b/gdb/testsuite/gdb.fortran/nested-funcs-2.exp
@@ -20,7 +20,7 @@ load_lib "fortran.exp"
standard_testfile ".f90"
-if {[prepare_for_testing ${testfile}.exp ${testfile} \
+if {[build_executable ${testfile}.exp ${testfile} \
${srcfile} {debug f90}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.fortran/subarray.exp b/gdb/testsuite/gdb.fortran/subarray.exp
index 8c7d5a97940..d41443a88b0 100644
--- a/gdb/testsuite/gdb.fortran/subarray.exp
+++ b/gdb/testsuite/gdb.fortran/subarray.exp
@@ -27,11 +27,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
if ![fortran_runto_main] then {
perror "couldn't run to main"
continue
diff --git a/gdb/testsuite/gdb.gdb/unittest.exp b/gdb/testsuite/gdb.gdb/unittest.exp
index 3622243492c..670205fff76 100644
--- a/gdb/testsuite/gdb.gdb/unittest.exp
+++ b/gdb/testsuite/gdb.gdb/unittest.exp
@@ -24,7 +24,7 @@ set do_xml_test [expr ![gdb_skip_xml_test]]
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.mi/mi-fortran-modules.exp b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
index 06069953afa..fc1fa411ee3 100644
--- a/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
+++ b/gdb/testsuite/gdb.mi/mi-fortran-modules.exp
@@ -23,7 +23,7 @@ set MIFLAGS "-i=mi"
standard_testfile "mi-fortran-modules.f90" "mi-fortran-modules-2.f90"
-if {[prepare_for_testing "failed to prepare" ${testfile} \
+if {[build_executable "failed to prepare" ${testfile} \
[list $srcfile2 $srcfile] {debug f90}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.mi/mi-info-sources.exp b/gdb/testsuite/gdb.mi/mi-info-sources.exp
index a43e939063a..7451af65952 100644
--- a/gdb/testsuite/gdb.mi/mi-info-sources.exp
+++ b/gdb/testsuite/gdb.mi/mi-info-sources.exp
@@ -20,7 +20,7 @@ set MIFLAGS "-i=mi"
standard_testfile .c -base.c
-if {[prepare_for_testing $testfile.exp $testfile \
+if {[build_executable $testfile.exp $testfile \
[list $srcfile $srcfile2] debug]} {
untested $testfile.exp
return -1
diff --git a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
index 4f7150bf1ac..dacbdd8962d 100644
--- a/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
+++ b/gdb/testsuite/gdb.mi/mi-linespec-err-cp.exp
@@ -27,7 +27,7 @@ set MIFLAGS "-i=mi"
standard_testfile .cc
set exefile $testfile
-if {[prepare_for_testing "failed to prepare" $exefile $srcfile {debug c++}]} {
+if {[build_executable "failed to prepare" $exefile $srcfile {debug c++}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp
index dfe23ec49ca..5eb72011989 100644
--- a/gdb/testsuite/gdb.mi/mi-sym-info.exp
+++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp
@@ -28,7 +28,7 @@ set MIFLAGS "-i=mi"
standard_testfile mi-sym-info-1.c mi-sym-info-2.c
-if {[prepare_for_testing "failed to prepare" ${testfile} \
+if {[build_executable "failed to prepare" ${testfile} \
[list $srcfile $srcfile2] {debug}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/info-threads.exp b/gdb/testsuite/gdb.multi/info-threads.exp
index 8ebd03b290c..cc8b22a6f3c 100644
--- a/gdb/testsuite/gdb.multi/info-threads.exp
+++ b/gdb/testsuite/gdb.multi/info-threads.exp
@@ -24,8 +24,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {pthreads d
return -1
}
-clean_restart ${testfile}
-
if { ![runto_main] } then {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/multi-arch.exp b/gdb/testsuite/gdb.multi/multi-arch.exp
index e859282dbc4..c1c77917e45 100644
--- a/gdb/testsuite/gdb.multi/multi-arch.exp
+++ b/gdb/testsuite/gdb.multi/multi-arch.exp
@@ -52,7 +52,7 @@ if [istarget "s390*-*-*"] {
set march2 "-m32"
}
-if { [prepare_for_testing "failed to prepare" ${exec1} "${srcfile1}" \
+if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
[list debug additional_flags=${march1}]] } {
return -1
}
@@ -70,7 +70,7 @@ if [istarget "aarch64*-*-*"] {
lappend options "additional_flags=${march2}"
}
-if { [prepare_for_testing "failed to prepare" ${exec2} "${srcfile2}" \
+if { [build_executable "failed to prepare" ${exec2} "${srcfile2}" \
$options]} {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/multi-re-run.exp b/gdb/testsuite/gdb.multi/multi-re-run.exp
index 8bf126ef95a..6eda6fafb5b 100644
--- a/gdb/testsuite/gdb.multi/multi-re-run.exp
+++ b/gdb/testsuite/gdb.multi/multi-re-run.exp
@@ -31,14 +31,14 @@ set srcfile2 multi-re-run-2.c
set binfile2 [standard_output_file ${exec2}]
with_test_prefix "exec1" {
- if { [prepare_for_testing "failed to prepare" ${exec1} "${srcfile1}" \
+ if { [build_executable "failed to prepare" ${exec1} "${srcfile1}" \
[list pthreads debug]] } {
return -1
}
}
with_test_prefix "exec2" {
- if { [prepare_for_testing "failed to prepare" ${exec2} "${srcfile2}" \
+ if { [build_executable "failed to prepare" ${exec2} "${srcfile2}" \
[list pthreads debug]] } {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/run-only-second-inf.exp b/gdb/testsuite/gdb.multi/run-only-second-inf.exp
index e5d124916d4..69ff07bea28 100644
--- a/gdb/testsuite/gdb.multi/run-only-second-inf.exp
+++ b/gdb/testsuite/gdb.multi/run-only-second-inf.exp
@@ -24,7 +24,7 @@ if {[use_gdb_stub]} {
return 0
}
-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.multi/tids-gid-reset.exp b/gdb/testsuite/gdb.multi/tids-gid-reset.exp
index d8dac7cf7fe..e1755f9a689 100644
--- a/gdb/testsuite/gdb.multi/tids-gid-reset.exp
+++ b/gdb/testsuite/gdb.multi/tids-gid-reset.exp
@@ -22,7 +22,8 @@
standard_testfile
-if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {pthreads debug}] } {
+if { [build_executable "failed to prepare" ${testfile} ${srcfile} \
+ {pthreads debug}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp
index f1d6db60f70..1bf04c509c0 100644
--- a/gdb/testsuite/gdb.multi/tids.exp
+++ b/gdb/testsuite/gdb.multi/tids.exp
@@ -31,8 +31,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {pthreads d
return -1
}
-clean_restart ${testfile}
-
if { ![runto_main] } then {
return -1
}
diff --git a/gdb/testsuite/gdb.python/py-infthread.exp b/gdb/testsuite/gdb.python/py-infthread.exp
index aa0b802a11e..e68986bdfa7 100644
--- a/gdb/testsuite/gdb.python/py-infthread.exp
+++ b/gdb/testsuite/gdb.python/py-infthread.exp
@@ -24,9 +24,6 @@ if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
return -1
}
-# Start with a fresh gdb.
-clean_restart ${testfile}
-
# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }
diff --git a/gdb/testsuite/gdb.server/connect-stopped-target.exp b/gdb/testsuite/gdb.server/connect-stopped-target.exp
index 06a4e98d85e..bab3b88a194 100644
--- a/gdb/testsuite/gdb.server/connect-stopped-target.exp
+++ b/gdb/testsuite/gdb.server/connect-stopped-target.exp
@@ -27,7 +27,7 @@ if {[skip_gdbserver_tests]} {
standard_testfile
set executable ${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.server/exit-multiple-threads.exp b/gdb/testsuite/gdb.server/exit-multiple-threads.exp
index a74f7d12449..27c09b234e2 100644
--- a/gdb/testsuite/gdb.server/exit-multiple-threads.exp
+++ b/gdb/testsuite/gdb.server/exit-multiple-threads.exp
@@ -135,7 +135,7 @@ foreach_with_prefix test { exit signal } {
set func "run_${test}_test"
set executable "$binfile-${test}"
- if [prepare_for_testing "failed to prepare" $executable $srcfile \
+ if [build_executable "failed to prepare" $executable $srcfile \
[list debug pthreads additional_flags=-D${def}]] {
return -1
}
diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp
index 395eddc9106..7c96c9bc321 100644
--- a/gdb/testsuite/gdb.server/run-without-local-binary.exp
+++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp
@@ -21,7 +21,7 @@ if {[skip_gdbserver_tests]} {
standard_testfile normal.c
-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.threads/access-mem-running-thread-exit.exp b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
index ea228e4ba13..b2fef9fca6a 100644
--- a/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
+++ b/gdb/testsuite/gdb.threads/access-mem-running-thread-exit.exp
@@ -35,7 +35,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
index cb632572e08..255e48350aa 100644
--- a/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
+++ b/gdb/testsuite/gdb.threads/attach-many-short-lived-threads.exp
@@ -62,8 +62,6 @@ proc test {} {
global gdb_prompt
global decimal
- clean_restart ${binfile}
-
set test_spawn_id [spawn_wait_for_attach $binfile]
set testpid [spawn_id_get_pid $test_spawn_id]
@@ -170,7 +168,8 @@ proc test {} {
# failure.
set options { "additional_flags=-DTIMEOUT=$timeout" debug pthreads }
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options] == -1} {
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ $options] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/break-while-running.exp b/gdb/testsuite/gdb.threads/break-while-running.exp
index 68d9bf86d37..de398241ecf 100644
--- a/gdb/testsuite/gdb.threads/break-while-running.exp
+++ b/gdb/testsuite/gdb.threads/break-while-running.exp
@@ -24,7 +24,7 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/clone-attach-detach.exp b/gdb/testsuite/gdb.threads/clone-attach-detach.exp
index 4c6813b0ece..2232857ef30 100644
--- a/gdb/testsuite/gdb.threads/clone-attach-detach.exp
+++ b/gdb/testsuite/gdb.threads/clone-attach-detach.exp
@@ -33,8 +33,6 @@ if [prepare_for_testing "failed to prepare" $testfile $srcfile {debug}] {
return -1
}
-clean_restart ${binfile}
-
set test_spawn_id [spawn_wait_for_attach $binfile]
set testpid [spawn_id_get_pid $test_spawn_id]
diff --git a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
index 1abbe585f65..d168f6b3e29 100644
--- a/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
+++ b/gdb/testsuite/gdb.threads/next-bp-other-thread.exp
@@ -20,7 +20,8 @@
standard_testfile
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} {
+if {[build_executable "failed to prepare" $testfile $srcfile \
+ {debug pthreads}] == -1} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/signal-sigtrap.exp b/gdb/testsuite/gdb.threads/signal-sigtrap.exp
index 92488a50ac1..f5dc7fe6e74 100644
--- a/gdb/testsuite/gdb.threads/signal-sigtrap.exp
+++ b/gdb/testsuite/gdb.threads/signal-sigtrap.exp
@@ -23,7 +23,8 @@ if [target_info exists gdb,nosignals] {
return -1
}
-if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}]} {
+if {[build_executable "failed to prepare" $testfile $srcfile \
+ {debug pthreads}]} {
return -1
}
diff --git a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
index 55ebd40c2e4..c6c6ccef028 100644
--- a/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
+++ b/gdb/testsuite/gdb.threads/step-bg-decr-pc-switch-thread.exp
@@ -34,8 +34,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}
return -1
}
-clean_restart $binfile
-
if ![runto_main] {
continue
}
diff --git a/gdb/testsuite/gdb.threads/tid-reuse.exp b/gdb/testsuite/gdb.threads/tid-reuse.exp
index 1d93a55e46c..8ac1f5b2ceb 100644
--- a/gdb/testsuite/gdb.threads/tid-reuse.exp
+++ b/gdb/testsuite/gdb.threads/tid-reuse.exp
@@ -22,8 +22,6 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile { debug pthreads
return -1
}
-clean_restart ${binfile}
-
if ![runto_main] {
fail "can't run to main"
return -1
diff --git a/gdb/testsuite/gdb.trace/qtro.exp b/gdb/testsuite/gdb.trace/qtro.exp
index 91a6612fb10..0fadfa66b13 100644
--- a/gdb/testsuite/gdb.trace/qtro.exp
+++ b/gdb/testsuite/gdb.trace/qtro.exp
@@ -25,7 +25,6 @@ standard_testfile
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug nopie}]} {
return -1
}
-clean_restart $testfile
if ![runto_main] {
fail "can't run to main to check for trace support"
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-09-24 19:40 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 22:49 [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable Tom de Vries
2021-09-23 15:12 ` Simon Marchi
2021-09-23 21:43 ` Tom de Vries
2021-09-24 12:34 ` [PATCH][gdb/testsuite] Don't leave gdb instance running after function_range Tom de Vries
2021-09-24 13:56 ` Simon Marchi
2021-09-24 14:10 ` [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable Pedro Alves
2021-09-24 19:40 ` Tom de Vries
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).