summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-06-27 18:58:28 +0000
committerTom Tromey <tromey@redhat.com>2013-06-27 18:58:28 +0000
commit0ab77f5fa21b665be0d099ea8eca2485c2d58f93 (patch)
tree330ff4740afa674276895da765889a1dc9bea6b8
parent822bd149bfa2e13ddfddd092bfc9f2886bf878d8 (diff)
downloadbinutils-gdb-0ab77f5fa21b665be0d099ea8eca2485c2d58f93.tar.gz
test suite update - gdb.base/s*
Convert files gdb.base/s*.exp to use standard_output_file et al. * gdb.base/save-bp.exp, gdb.base/savedregs.exp, gdb.base/scope.exp, gdb.base/sep.exp, gdb.base/sepsymtab.exp, gdb.base/set-lang-auto.exp, gdb.base/setshow.exp, gdb.base/setvar.exp, gdb.base/shlib-call.exp, gdb.base/shreloc.exp, gdb.base/sigall.exp, gdb.base/sigaltstack.exp, gdb.base/sigbpt.exp, gdb.base/sigchld.exp, gdb.base/siginfo-addr.exp, gdb.base/siginfo-infcall.exp, gdb.base/siginfo-obj.exp, gdb.base/siginfo.exp, gdb.base/signals.exp, gdb.base/signest.exp, gdb.base/signull.exp, gdb.base/sigrepeat.exp, gdb.base/sigstep.exp, gdb.base/sizeof.exp, gdb.base/skip-solib.exp, gdb.base/so-impl-ld.exp, gdb.base/solib-display.exp, gdb.base/solib-nodir.exp, gdb.base/solib-overlap.exp, gdb.base/solib-symbol.exp, gdb.base/solib-weak.exp, gdb.base/source.exp, gdb.base/stack-checking.exp, gdb.base/stale-infcall.exp, gdb.base/stap-probe.exp, gdb.base/start.exp, gdb.base/step-break.exp, gdb.base/step-bt.exp, gdb.base/step-line.exp, gdb.base/step-resume-infcall.exp, gdb.base/step-test.exp, gdb.base/structs.exp, gdb.base/structs2.exp, gdb.base/structs3.exp, gdb.base/symbol-without-target_section.exp: Use standard_testfile, standard_output_file, prepare_for_testing, clean_restart.
-rw-r--r--gdb/testsuite/ChangeLog26
-rw-r--r--gdb/testsuite/gdb.base/save-bp.exp5
-rw-r--r--gdb/testsuite/gdb.base/savedregs.exp10
-rw-r--r--gdb/testsuite/gdb.base/scope.exp27
-rw-r--r--gdb/testsuite/gdb.base/sep.exp9
-rw-r--r--gdb/testsuite/gdb.base/sepsymtab.exp9
-rw-r--r--gdb/testsuite/gdb.base/set-lang-auto.exp16
-rw-r--r--gdb/testsuite/gdb.base/setshow.exp10
-rw-r--r--gdb/testsuite/gdb.base/setvar.exp16
-rw-r--r--gdb/testsuite/gdb.base/shlib-call.exp20
-rw-r--r--gdb/testsuite/gdb.base/shreloc.exp25
-rw-r--r--gdb/testsuite/gdb.base/sigall.exp16
-rw-r--r--gdb/testsuite/gdb.base/sigaltstack.exp10
-rw-r--r--gdb/testsuite/gdb.base/sigbpt.exp14
-rw-r--r--gdb/testsuite/gdb.base/sigchld.exp9
-rw-r--r--gdb/testsuite/gdb.base/siginfo-addr.exp12
-rw-r--r--gdb/testsuite/gdb.base/siginfo-infcall.exp7
-rw-r--r--gdb/testsuite/gdb.base/siginfo-obj.exp15
-rw-r--r--gdb/testsuite/gdb.base/siginfo.exp15
-rw-r--r--gdb/testsuite/gdb.base/signals.exp10
-rw-r--r--gdb/testsuite/gdb.base/signest.exp3
-rw-r--r--gdb/testsuite/gdb.base/signull.exp10
-rw-r--r--gdb/testsuite/gdb.base/sigrepeat.exp10
-rw-r--r--gdb/testsuite/gdb.base/sigstep.exp15
-rw-r--r--gdb/testsuite/gdb.base/sizeof.exp16
-rw-r--r--gdb/testsuite/gdb.base/skip-solib.exp9
-rw-r--r--gdb/testsuite/gdb.base/so-impl-ld.exp14
-rw-r--r--gdb/testsuite/gdb.base/solib-display.exp4
-rw-r--r--gdb/testsuite/gdb.base/solib-nodir.exp6
-rw-r--r--gdb/testsuite/gdb.base/solib-overlap.exp6
-rw-r--r--gdb/testsuite/gdb.base/solib-symbol.exp4
-rw-r--r--gdb/testsuite/gdb.base/solib-weak.exp8
-rw-r--r--gdb/testsuite/gdb.base/source.exp4
-rw-r--r--gdb/testsuite/gdb.base/stack-checking.exp9
-rw-r--r--gdb/testsuite/gdb.base/stale-infcall.exp4
-rw-r--r--gdb/testsuite/gdb.base/stap-probe.exp6
-rw-r--r--gdb/testsuite/gdb.base/start.exp16
-rw-r--r--gdb/testsuite/gdb.base/step-break.exp11
-rw-r--r--gdb/testsuite/gdb.base/step-bt.exp16
-rw-r--r--gdb/testsuite/gdb.base/step-line.exp16
-rw-r--r--gdb/testsuite/gdb.base/step-resume-infcall.exp4
-rw-r--r--gdb/testsuite/gdb.base/step-test.exp9
-rw-r--r--gdb/testsuite/gdb.base/structs.exp7
-rw-r--r--gdb/testsuite/gdb.base/structs2.exp8
-rw-r--r--gdb/testsuite/gdb.base/structs3.exp4
-rw-r--r--gdb/testsuite/gdb.base/symbol-without-target_section.exp14
46 files changed, 174 insertions, 340 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f577bae0832..ca53806c68b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,31 @@
2013-06-27 Tom Tromey <tromey@redhat.com>
+ * gdb.base/save-bp.exp, gdb.base/savedregs.exp,
+ gdb.base/scope.exp, gdb.base/sep.exp, gdb.base/sepsymtab.exp,
+ gdb.base/set-lang-auto.exp, gdb.base/setshow.exp,
+ gdb.base/setvar.exp, gdb.base/shlib-call.exp,
+ gdb.base/shreloc.exp, gdb.base/sigall.exp,
+ gdb.base/sigaltstack.exp, gdb.base/sigbpt.exp,
+ gdb.base/sigchld.exp, gdb.base/siginfo-addr.exp,
+ gdb.base/siginfo-infcall.exp, gdb.base/siginfo-obj.exp,
+ gdb.base/siginfo.exp, gdb.base/signals.exp, gdb.base/signest.exp,
+ gdb.base/signull.exp, gdb.base/sigrepeat.exp,
+ gdb.base/sigstep.exp, gdb.base/sizeof.exp,
+ gdb.base/skip-solib.exp, gdb.base/so-impl-ld.exp,
+ gdb.base/solib-display.exp, gdb.base/solib-nodir.exp,
+ gdb.base/solib-overlap.exp, gdb.base/solib-symbol.exp,
+ gdb.base/solib-weak.exp, gdb.base/source.exp,
+ gdb.base/stack-checking.exp, gdb.base/stale-infcall.exp,
+ gdb.base/stap-probe.exp, gdb.base/start.exp,
+ gdb.base/step-break.exp, gdb.base/step-bt.exp,
+ gdb.base/step-line.exp, gdb.base/step-resume-infcall.exp,
+ gdb.base/step-test.exp, gdb.base/structs.exp,
+ gdb.base/structs2.exp, gdb.base/structs3.exp,
+ gdb.base/symbol-without-target_section.exp: Use standard_testfile,
+ standard_output_file, prepare_for_testing, clean_restart.
+
+2013-06-27 Tom Tromey <tromey@redhat.com>
+
* gdb.base/nextoverexit.exp, gdb.base/nextoverexit.exp,
gdb.base/nodebug.exp, gdb.base/nofield.exp, gdb.base/nostdlib.exp,
gdb.base/opaque.exp, gdb.base/overlays.exp, gdb.base/pc-fp.exp,
diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp
index 72a6847a4ef..64df0f722d0 100644
--- a/gdb/testsuite/gdb.base/save-bp.exp
+++ b/gdb/testsuite/gdb.base/save-bp.exp
@@ -13,10 +13,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile save-bp
-set srcfile ${testfile}.c
+standard_testfile .c
-if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/savedregs.exp b/gdb/testsuite/gdb.base/savedregs.exp
index 1548d0a6b20..d4d16c382e0 100644
--- a/gdb/testsuite/gdb.base/savedregs.exp
+++ b/gdb/testsuite/gdb.base/savedregs.exp
@@ -30,19 +30,15 @@ if [target_info exists gdb,nosignals] {
}
-set testfile savedregs
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${module}.c"
return -1
}
# get things started
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Advance to main
if { ![runto_main] } {
diff --git a/gdb/testsuite/gdb.base/scope.exp b/gdb/testsuite/gdb.base/scope.exp
index fbcc31b5064..e781cf03487 100644
--- a/gdb/testsuite/gdb.base/scope.exp
+++ b/gdb/testsuite/gdb.base/scope.exp
@@ -16,23 +16,11 @@
# This file was written by Fred Fish. (fnf@cygnus.com)
-set testfile "scope"
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile scope0.c scope1.c
-
-if { [gdb_compile "${srcdir}/${subdir}/scope0.c" "${binfile}0.o" object {debug}] != "" } {
- untested scope.exp
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/scope1.c" "${binfile}1.o" object {debug}] != "" } {
- untested scope.exp
- return -1
-}
-
-if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } {
- untested scope.exp
- return -1
+if {[prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile $srcfile2] {debug}]} {
+ return -1
}
# Create and source the file that provides information about the compiler
@@ -511,13 +499,6 @@ proc test_at_localscopes {} {
gdb_stop_suppressing_tests
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
if [istarget "*-*-vxworks*"] {
set timeout 120
verbose "Timeout is now $timeout seconds" 2
diff --git a/gdb/testsuite/gdb.base/sep.exp b/gdb/testsuite/gdb.base/sep.exp
index af50d17f492..7034d0348d6 100644
--- a/gdb/testsuite/gdb.base/sep.exp
+++ b/gdb/testsuite/gdb.base/sep.exp
@@ -13,9 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile "sep"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested sep.exp
@@ -24,10 +22,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
set location [gdb_get_line_number "say_hello" "sep-proc.c"]
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Try to display the source code inside a file which is included by
# another source file. The purpose of this test is to verify that
diff --git a/gdb/testsuite/gdb.base/sepsymtab.exp b/gdb/testsuite/gdb.base/sepsymtab.exp
index 407a9b0365a..d19075e921b 100644
--- a/gdb/testsuite/gdb.base/sepsymtab.exp
+++ b/gdb/testsuite/gdb.base/sepsymtab.exp
@@ -17,9 +17,7 @@
# test running programs
#
-set testfile "sepsymtab"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}${EXEEXT}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
executable {debug}] != "" } {
@@ -33,10 +31,7 @@ if [gdb_gnu_strip_debug $binfile no-main] {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
set command "info sym main"
set command_regex [string_to_regexp $command]
diff --git a/gdb/testsuite/gdb.base/set-lang-auto.exp b/gdb/testsuite/gdb.base/set-lang-auto.exp
index 617310eb2bf..e2f3694bf32 100644
--- a/gdb/testsuite/gdb.base/set-lang-auto.exp
+++ b/gdb/testsuite/gdb.base/set-lang-auto.exp
@@ -14,21 +14,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile start
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "Couldn't compile test program"
+standard_testfile start.c
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
-# Get things started.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# Do not run the inferior as the purpose of this testcase is to test
# the behavior of the "set language" command when there is no inferior.
diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp
index e172fc7615d..661431c5469 100644
--- a/gdb/testsuite/gdb.base/setshow.exp
+++ b/gdb/testsuite/gdb.base/setshow.exp
@@ -16,9 +16,8 @@
# This file was written by Michael Snyder (msnyder@cygnus.com)
-set testfile "setshow"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}] != "" } {
untested setshow.exp
return -1
@@ -26,10 +25,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable {debug}]
# Start with a fresh gdb
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# make sure $pc is sane, in case we're talking to a board.
if { ![runto_main] } {
diff --git a/gdb/testsuite/gdb.base/setvar.exp b/gdb/testsuite/gdb.base/setvar.exp
index 1c58300cf88..99704990a98 100644
--- a/gdb/testsuite/gdb.base/setvar.exp
+++ b/gdb/testsuite/gdb.base/setvar.exp
@@ -24,13 +24,7 @@
# test running programs
#
-set testfile "setvar"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested setvar.exp
- return -1
-}
+standard_testfile
# Create and source the file that provides information about the compiler
# used to compile the test case.
@@ -38,10 +32,10 @@ if [get_compiler_info] {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
+ return -1
+}
#
# set it up at a breakpoint so we canplay with the variable values
diff --git a/gdb/testsuite/gdb.base/shlib-call.exp b/gdb/testsuite/gdb.base/shlib-call.exp
index 747aaa5bb82..326112d19f1 100644
--- a/gdb/testsuite/gdb.base/shlib-call.exp
+++ b/gdb/testsuite/gdb.base/shlib-call.exp
@@ -33,15 +33,12 @@ if {[skip_shlib_tests]} {
return 0
}
-set testfile "shmain"
-set libfile1 "shr1"
-set libfile2 "shr2"
-set srcfile ${srcdir}/${subdir}/${testfile}.c
-set lib1src ${srcdir}/${subdir}/${libfile1}.c
-set lib2src ${srcdir}/${subdir}/${libfile2}.c
-set lib1 ${objdir}/${subdir}/${libfile1}.sl
-set lib2 ${objdir}/${subdir}/${libfile2}.sl
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile shmain.c shr1.c shr2.c
+set srcfile ${srcdir}/${subdir}/${srcfile}
+set lib1src ${srcdir}/${subdir}/${srcfile2}
+set lib2src ${srcdir}/${subdir}/${srcfile3}
+set lib1 [standard_output_file shr1.sl]
+set lib2 [standard_output_file shr2.sl]
set lib_opts "debug"
set exec_opts [list debug shlib=${lib1} shlib=${lib2}]
@@ -59,10 +56,7 @@ if { [gdb_compile_shlib ${lib1src} ${lib1} $lib_opts] != ""
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_load_shlibs $lib1 $lib2
gdb_test_no_output "set print sevenbit-strings"
diff --git a/gdb/testsuite/gdb.base/shreloc.exp b/gdb/testsuite/gdb.base/shreloc.exp
index f93b03ef9de..2baf67615ac 100644
--- a/gdb/testsuite/gdb.base/shreloc.exp
+++ b/gdb/testsuite/gdb.base/shreloc.exp
@@ -28,16 +28,14 @@ if {[skip_shlib_tests]} {
#
-set workdir ${objdir}/${subdir}
-set testfile "shreloc"
-set libfile1 "shreloc1"
-set libfile2 "shreloc2"
-set srcfile $srcdir/$subdir/$testfile.c
-set lib1src $srcdir/$subdir/$libfile1.c
-set lib2src $srcdir/$subdir/$libfile2.c
-set binfile $objdir/$subdir/$testfile
-set lib1_sl $objdir/$subdir/$libfile1.sl
-set lib2_sl $objdir/$subdir/$libfile2.sl
+standard_testfile .c shreloc1.c shreloc2.c
+
+set srcfile $srcdir/$subdir/$srcfile
+set lib1src $srcdir/$subdir/$srcfile2
+set lib2src $srcdir/$subdir/$srcfile3
+set binfile [standard_output_file $testfile]
+set lib1_sl [standard_output_file shreloc1.sl]
+set lib2_sl [standard_output_file shreloc2.sl]
if [get_compiler_info] {
return -1
@@ -73,10 +71,7 @@ if { [gdb_compile_shlib $lib1src $lib1_sl $lib_opts] != ""} {
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${workdir}/shreloc
+clean_restart $binfile
gdb_load_shlibs $lib1_sl $lib2_sl
# Load up the shared objects
@@ -226,7 +221,7 @@ proc check_different {var msymfile} {
return 1
}
-set msymfile "${workdir}/shreloc.txt"
+set msymfile [standard_output_file shreloc.txt]
if [send_gdb_discard "maint print msymbols ${msymfile}"] {
if {[check_different "static_var_\[12\]" "${msymfile}"]} {
diff --git a/gdb/testsuite/gdb.base/sigall.exp b/gdb/testsuite/gdb.base/sigall.exp
index 4bd04278265..b1b85974c52 100644
--- a/gdb/testsuite/gdb.base/sigall.exp
+++ b/gdb/testsuite/gdb.base/sigall.exp
@@ -18,17 +18,11 @@ if [target_info exists gdb,nosignals] {
continue
}
+standard_testfile
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-set testfile sigall
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested sigall.exp
- return -1
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
+ return -1
}
proc test_one_sig {nextsig} {
@@ -98,8 +92,6 @@ proc test_one_sig {nextsig} {
set thissig $nextsig
}
-gdb_load $binfile
-
# The list of signals that the program generates, in the order they
# are generated.
set signals {
diff --git a/gdb/testsuite/gdb.base/sigaltstack.exp b/gdb/testsuite/gdb.base/sigaltstack.exp
index 4fc5ac819b7..317131872c9 100644
--- a/gdb/testsuite/gdb.base/sigaltstack.exp
+++ b/gdb/testsuite/gdb.base/sigaltstack.exp
@@ -28,19 +28,15 @@ if [target_info exists gdb,nosignals] {
}
-set testfile sigaltstack
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${srcfile}.c"
return -1
}
# get things started
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Pass all the alarms straight through (but verbosely)
gdb_test "handle SIGALRM print pass nostop"
diff --git a/gdb/testsuite/gdb.base/sigbpt.exp b/gdb/testsuite/gdb.base/sigbpt.exp
index 51545da52f8..eb16b8e2b76 100644
--- a/gdb/testsuite/gdb.base/sigbpt.exp
+++ b/gdb/testsuite/gdb.base/sigbpt.exp
@@ -34,19 +34,13 @@ if [target_info exists gdb,nosignals] {
}
-set testfile "sigbpt"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested sigbpt.exp
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
#
# Run to `main' where we begin our tests.
#
diff --git a/gdb/testsuite/gdb.base/sigchld.exp b/gdb/testsuite/gdb.base/sigchld.exp
index ce8857632a0..ab2a37f57ca 100644
--- a/gdb/testsuite/gdb.base/sigchld.exp
+++ b/gdb/testsuite/gdb.base/sigchld.exp
@@ -21,18 +21,13 @@ if [target_info exists gdb,nosignals] {
continue
}
-set testfile "sigchld"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
runto_main
diff --git a/gdb/testsuite/gdb.base/siginfo-addr.exp b/gdb/testsuite/gdb.base/siginfo-addr.exp
index 02810e89ba5..021d5d18869 100644
--- a/gdb/testsuite/gdb.base/siginfo-addr.exp
+++ b/gdb/testsuite/gdb.base/siginfo-addr.exp
@@ -31,20 +31,12 @@ if [gdb_skip_stdio_test "siginfo-addr.exp"] {
}
-set testfile siginfo-addr
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+standard_testfile
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
untested "Couldn't compile ${srcfile}.c"
return -1
}
-# get things started
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
gdb_test "display/i \$pc"
# Advance to main
diff --git a/gdb/testsuite/gdb.base/siginfo-infcall.exp b/gdb/testsuite/gdb.base/siginfo-infcall.exp
index 7d17b70747a..ed034be4549 100644
--- a/gdb/testsuite/gdb.base/siginfo-infcall.exp
+++ b/gdb/testsuite/gdb.base/siginfo-infcall.exp
@@ -18,10 +18,9 @@ if [target_info exists gdb,nosignals] {
continue
}
-set testfile siginfo-infcall
-set srcfile ${testfile}.c
-set executable ${testfile}
-if { [prepare_for_testing ${testfile}.exp $executable] } {
+standard_testfile .c
+
+if { [prepare_for_testing ${testfile}.exp $testfile $srcfile] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/siginfo-obj.exp b/gdb/testsuite/gdb.base/siginfo-obj.exp
index cebc2eeaa05..6cee02efbd4 100644
--- a/gdb/testsuite/gdb.base/siginfo-obj.exp
+++ b/gdb/testsuite/gdb.base/siginfo-obj.exp
@@ -34,20 +34,13 @@ if { ! [istarget "i?86-*-linux*"]
}
-set testfile siginfo-obj
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "Couldn't compile ${srcfile}.c"
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
-# get things started
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# Advance to main
if { ![runto_main] } then {
gdb_suppress_tests
diff --git a/gdb/testsuite/gdb.base/siginfo.exp b/gdb/testsuite/gdb.base/siginfo.exp
index 5389e0b8456..036d1a52122 100644
--- a/gdb/testsuite/gdb.base/siginfo.exp
+++ b/gdb/testsuite/gdb.base/siginfo.exp
@@ -29,20 +29,13 @@ if [target_info exists gdb,nosignals] {
}
-set testfile siginfo
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "Couldn't compile ${srcfile}.c"
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
-# get things started
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
gdb_test "display/i \$pc"
# Advance to main
diff --git a/gdb/testsuite/gdb.base/signals.exp b/gdb/testsuite/gdb.base/signals.exp
index 7652ff0c198..667368cb60e 100644
--- a/gdb/testsuite/gdb.base/signals.exp
+++ b/gdb/testsuite/gdb.base/signals.exp
@@ -19,9 +19,8 @@ if [target_info exists gdb,nosignals] {
}
-set testfile signals
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested signals.exp
return -1
@@ -74,10 +73,7 @@ proc test_handle_all_print {} {
}
test_handle_all_print
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
+clean_restart $binfile
if [runto_main] then {
diff --git a/gdb/testsuite/gdb.base/signest.exp b/gdb/testsuite/gdb.base/signest.exp
index 67dc6ee63a7..de000f37467 100644
--- a/gdb/testsuite/gdb.base/signest.exp
+++ b/gdb/testsuite/gdb.base/signest.exp
@@ -15,8 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile "signest"
-set srcfile ${testfile}.c
+standard_testfile
if [target_info exists gdb,nosignals] {
verbose "Skipping ${testfile}.exp because of nosignals."
diff --git a/gdb/testsuite/gdb.base/signull.exp b/gdb/testsuite/gdb.base/signull.exp
index 5fadd3a1701..e440c1707ea 100644
--- a/gdb/testsuite/gdb.base/signull.exp
+++ b/gdb/testsuite/gdb.base/signull.exp
@@ -33,18 +33,14 @@ if [target_info exists gdb,nosignals] {
}
-set testfile "signull"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested signull.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# Run to `main' where we begin our tests.
diff --git a/gdb/testsuite/gdb.base/sigrepeat.exp b/gdb/testsuite/gdb.base/sigrepeat.exp
index 3b423ec6494..08beed3d59e 100644
--- a/gdb/testsuite/gdb.base/sigrepeat.exp
+++ b/gdb/testsuite/gdb.base/sigrepeat.exp
@@ -25,19 +25,15 @@ if [target_info exists gdb,nosignals] {
}
-set testfile sigrepeat
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
# get things started
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Advance to main
if { ![runto_main] } then {
diff --git a/gdb/testsuite/gdb.base/sigstep.exp b/gdb/testsuite/gdb.base/sigstep.exp
index e8ab8ea5b8a..9515c613a48 100644
--- a/gdb/testsuite/gdb.base/sigstep.exp
+++ b/gdb/testsuite/gdb.base/sigstep.exp
@@ -27,20 +27,13 @@ if [target_info exists gdb,nosignals] {
}
-set testfile sigstep
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "Couldn't compile ${srcfile}.c"
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
-# get things started
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
gdb_test "display/i \$pc"
# Advance to main
diff --git a/gdb/testsuite/gdb.base/sizeof.exp b/gdb/testsuite/gdb.base/sizeof.exp
index 03972bbdaa2..af59e3bc76b 100644
--- a/gdb/testsuite/gdb.base/sizeof.exp
+++ b/gdb/testsuite/gdb.base/sizeof.exp
@@ -24,22 +24,16 @@ if [target_info exists gdb,noinferiorio] {
# test running programs
#
-set testfile "sizeof"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested sizeof.exp
- return -1
-}
+standard_testfile
if [get_compiler_info] {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
+ return -1
+}
#
# set it up at a breakpoint so we can play with the variable values
diff --git a/gdb/testsuite/gdb.base/skip-solib.exp b/gdb/testsuite/gdb.base/skip-solib.exp
index 14bf6bfc4e0..f618fc51131 100644
--- a/gdb/testsuite/gdb.base/skip-solib.exp
+++ b/gdb/testsuite/gdb.base/skip-solib.exp
@@ -27,10 +27,10 @@ if { ![isnative] || [is_remote host] || ![istarget *-linux*] || [skip_shlib_test
set test "skip-solib"
set srcfile_main "${test}-main.c"
set executable_main ${test}-test
-set binfile_main ${objdir}/${subdir}/${executable_main}
+set binfile_main [standard_output_file ${executable_main}]
set srcfile_lib "${test}-lib.c"
set libname "lib${test}"
-set binfile_lib ${objdir}/${subdir}/${libname}.so
+set binfile_lib [standard_output_file ${libname}.so]
#
# Compile our program under test. The main program references a shared library
@@ -47,9 +47,10 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile_main}" "${binfile_main}.o" objec
return -1
}
+set testobjdir [standard_output_file {}]
if {[gdb_compile "${binfile_main}.o" "${binfile_main}" executable \
- [list debug "additional_flags=-L${objdir}/${subdir} -l${test} \
- -Wl,-rpath=${objdir}/${subdir}"]] != ""} {
+ [list debug "additional_flags=-L$testobjdir -l${test} \
+ -Wl,-rpath=$testobjdir"]] != ""} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/so-impl-ld.exp b/gdb/testsuite/gdb.base/so-impl-ld.exp
index 64fc7816c8c..a1d028196b5 100644
--- a/gdb/testsuite/gdb.base/so-impl-ld.exp
+++ b/gdb/testsuite/gdb.base/so-impl-ld.exp
@@ -18,12 +18,10 @@ if {[skip_shlib_tests]} {
return 0
}
-set testfile "so-impl-ld"
+standard_testfile .c
set libfile "solib1"
-set srcfile $srcdir/$subdir/$testfile.c
set libsrc $srcdir/$subdir/$libfile.c
-set binfile $objdir/$subdir/$testfile
-set lib_sl $objdir/$subdir/$libfile.sl
+set lib_sl [standard_output_file $libfile.sl]
set lib_opts debug
set exec_opts [list debug shlib=$lib_sl]
@@ -41,17 +39,15 @@ if [test_compiler_info "hpcc-*"] {
}
if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != ""
- || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} {
+ || [gdb_compile $srcdir/$subdir/$srcfile $binfile \
+ executable $exec_opts] != ""} {
untested "Couldn't compile $libsrc or $srcfile."
return -1
}
# Start with a fresh gdb
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_load_shlibs $lib_sl
# This program implicitly loads SOM shared libraries.
diff --git a/gdb/testsuite/gdb.base/solib-display.exp b/gdb/testsuite/gdb.base/solib-display.exp
index 817846c68bd..928719deae1 100644
--- a/gdb/testsuite/gdb.base/solib-display.exp
+++ b/gdb/testsuite/gdb.base/solib-display.exp
@@ -35,13 +35,13 @@ if { [skip_shlib_tests] || [is_remote target] } {
# Library file.
set libname "solib-display-lib"
set srcfile_lib ${srcdir}/${subdir}/${libname}.c
-set binfile_lib ${objdir}/${subdir}/${libname}.so
+set binfile_lib [standard_output_file ${libname}.so]
set lib_flags {}
# Binary file.
set testfile "solib-display-main"
set srcfile ${srcdir}/${subdir}/${testfile}.c
set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
+set binfile [standard_output_file ${executable}]
set bin_flags [list debug shlib=${binfile_lib}]
if [get_compiler_info] {
diff --git a/gdb/testsuite/gdb.base/solib-nodir.exp b/gdb/testsuite/gdb.base/solib-nodir.exp
index 2ed48a5ffa7..34d9410fbab 100644
--- a/gdb/testsuite/gdb.base/solib-nodir.exp
+++ b/gdb/testsuite/gdb.base/solib-nodir.exp
@@ -24,11 +24,11 @@ set srclibfile foo.c
# Arbitrary file containing main.
set srcfile start.c
set binlibfilebase ${testfile}.so
-set binlibfiledir ${objdir}/${subdir}
+set binlibfiledir [standard_output_file {}]
set binlibfile ${binlibfiledir}/${binlibfilebase}
set executable ${testfile}
-set objfile ${objdir}/${subdir}/${executable}.o
-set binfile ${objdir}/${subdir}/${executable}
+set objfile [standard_output_file ${executable}.o]
+set binfile [standard_output_file ${executable}]
# build the first test case
if { [get_compiler_info]
diff --git a/gdb/testsuite/gdb.base/solib-overlap.exp b/gdb/testsuite/gdb.base/solib-overlap.exp
index ba1e1adb4b1..068c1de39d3 100644
--- a/gdb/testsuite/gdb.base/solib-overlap.exp
+++ b/gdb/testsuite/gdb.base/solib-overlap.exp
@@ -56,14 +56,14 @@ foreach prelink_lib1 {0x40000000 0x50000000} { with_test_prefix "$prelink_lib1"
set prelink_lib2 [format "0x%x" [expr $prelink_lib1 + 0x01000000]]
# Library file.
- set binfile_lib1 ${objdir}/${subdir}/${libname}1-${prelink_lib1}.so
+ set binfile_lib1 [standard_output_file ${libname}1-${prelink_lib1}.so]
set binfile_lib1_test_msg OBJDIR/${subdir}/${libname}1-${prelink_lib1}.so
- set binfile_lib2 ${objdir}/${subdir}/${libname}2-${prelink_lib1}.so
+ set binfile_lib2 [standard_output_file ${libname}2-${prelink_lib1}.so]
set binfile_lib2_test_msg OBJDIR/${subdir}/${libname}2-${prelink_lib1}.so
set lib_flags {debug}
# Binary file.
set binfile_base ${testfile}-${prelink_lib1}
- set binfile ${objdir}/${subdir}/${binfile_base}
+ set binfile [standard_output_file ${binfile_base}]
set binfile_test_msg OBJDIR/${subdir}/${binfile_base}
set bin_flags [list debug shlib=${binfile_lib1} shlib=${binfile_lib2}]
set escapedbinfile [string_to_regexp ${binfile}]
diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp
index b758a680d4b..9ffe7febd4c 100644
--- a/gdb/testsuite/gdb.base/solib-symbol.exp
+++ b/gdb/testsuite/gdb.base/solib-symbol.exp
@@ -22,12 +22,12 @@ if {[skip_shlib_tests]} {
# Library file.
set libname "solib-symbol-lib"
set srcfile_lib ${srcdir}/${subdir}/${libname}.c
-set binfile_lib ${objdir}/${subdir}/${libname}.so
+set binfile_lib [standard_output_file ${libname}.so]
set lib_flags [list debug ldflags=-Wl,-Bsymbolic]
# Binary file.
set testfile "solib-symbol-main"
set srcfile ${srcdir}/${subdir}/${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+set binfile [standard_output_file ${testfile}]
set bin_flags [list debug shlib=${binfile_lib}]
if [get_compiler_info] {
diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp
index 11c3830e079..5951806b307 100644
--- a/gdb/testsuite/gdb.base/solib-weak.exp
+++ b/gdb/testsuite/gdb.base/solib-weak.exp
@@ -39,7 +39,7 @@ if {![test_compiler_info "gcc-*"]} {
}
proc do_test { lib1opts lib2opts lib1first } {
- global objdir srcdir subdir
+ global srcdir subdir
set testfile "solib-weak"
set srcfile ${testfile}.c
@@ -72,9 +72,9 @@ proc do_test { lib1opts lib2opts lib1first } {
append testfile "-lib2"
}
- set binfile ${objdir}/${subdir}/${testfile}
- set lib1 ${objdir}/${subdir}/${libfile1}.sl
- set lib2 ${objdir}/${subdir}/${libfile2}.sl
+ set binfile [standard_output_file ${testfile}]
+ set lib1 [standard_output_file ${libfile1}.sl]
+ set lib2 [standard_output_file ${libfile2}.sl]
if $lib1first {
set exec_opts [list debug shlib=${lib1} shlib=${lib2}]
diff --git a/gdb/testsuite/gdb.base/source.exp b/gdb/testsuite/gdb.base/source.exp
index a398e776aaf..61fd2211c46 100644
--- a/gdb/testsuite/gdb.base/source.exp
+++ b/gdb/testsuite/gdb.base/source.exp
@@ -19,9 +19,7 @@
-set testfile "structs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile structs.c
gdb_start
diff --git a/gdb/testsuite/gdb.base/stack-checking.exp b/gdb/testsuite/gdb.base/stack-checking.exp
index 47d02e9d963..0c1fb5149c3 100644
--- a/gdb/testsuite/gdb.base/stack-checking.exp
+++ b/gdb/testsuite/gdb.base/stack-checking.exp
@@ -14,19 +14,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile "stack-checking"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [concat debug additional_flags=-fstack-check nowarnings]] != "" } {
untested stack-checking.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
fail "Can't run to main"
diff --git a/gdb/testsuite/gdb.base/stale-infcall.exp b/gdb/testsuite/gdb.base/stale-infcall.exp
index 074fabb8f53..deddf6107f1 100644
--- a/gdb/testsuite/gdb.base/stale-infcall.exp
+++ b/gdb/testsuite/gdb.base/stale-infcall.exp
@@ -13,8 +13,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile stale-infcall
-set srcfile ${testfile}.c
+standard_testfile .c
+
if { [prepare_for_testing $testfile.exp $testfile $srcfile] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp
index 048e082f55b..0f2b028874a 100644
--- a/gdb/testsuite/gdb.base/stap-probe.exp
+++ b/gdb/testsuite/gdb.base/stap-probe.exp
@@ -13,15 +13,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile stap-probe
+standard_testfile
# Run the tests. We run the tests two different ways: once with a
# plain probe, and once with a probe that has an associated semaphore.
# This returns -1 on failure to compile or start, 0 otherwise.
proc stap_test {exec_name {arg ""}} {
- global testfile hex
+ global testfile hex srcfile
- if {[prepare_for_testing ${testfile}.exp ${exec_name} ${testfile}.c \
+ if {[prepare_for_testing ${testfile}.exp ${exec_name} $srcfile \
[concat $arg debug]]} {
return -1
}
diff --git a/gdb/testsuite/gdb.base/start.exp b/gdb/testsuite/gdb.base/start.exp
index 6f1f517d842..296d17ae591 100644
--- a/gdb/testsuite/gdb.base/start.exp
+++ b/gdb/testsuite/gdb.base/start.exp
@@ -14,21 +14,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile start
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "Couldn't compile test program"
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
-# Get things started.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# This is a testcase specifically for the `start' GDB command. For regular
# stop-in-main goal in the testcases consider using `runto_main' instead.
diff --git a/gdb/testsuite/gdb.base/step-break.exp b/gdb/testsuite/gdb.base/step-break.exp
index ca091af23ca..29c2a3ba47e 100644
--- a/gdb/testsuite/gdb.base/step-break.exp
+++ b/gdb/testsuite/gdb.base/step-break.exp
@@ -15,20 +15,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile step-break
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
untested step-break.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
if ![runto_main] then {
fail "Can't run to main"
return 0
diff --git a/gdb/testsuite/gdb.base/step-bt.exp b/gdb/testsuite/gdb.base/step-bt.exp
index f5b57ce353f..03fc4533cbb 100644
--- a/gdb/testsuite/gdb.base/step-bt.exp
+++ b/gdb/testsuite/gdb.base/step-bt.exp
@@ -17,21 +17,13 @@
# single-stepping the instructions that prepare to call a function.
-set testfile step-bt
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "Couldn't compile test program"
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
-# Get things started.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
gdb_test "break *hello" \
"Breakpoint.*at.* file .*$srcfile, line .*" \
"breakpoint at first instruction of hello()"
diff --git a/gdb/testsuite/gdb.base/step-line.exp b/gdb/testsuite/gdb.base/step-line.exp
index 1be5dae9670..bc8f2bcca6c 100644
--- a/gdb/testsuite/gdb.base/step-line.exp
+++ b/gdb/testsuite/gdb.base/step-line.exp
@@ -20,22 +20,14 @@
# step-line.exp -- Expect script to test stepping in files with
# #line directives.
-set testfile step-line
-set srcfile ${testfile}.c
+standard_testfile
set linefile ${testfile}.inp
-set binfile ${objdir}/${subdir}/${testfile}
-remote_exec build "rm -f ${binfile}"
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested step-line.exp
- return -1
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
+ return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
if ![runto_main] then {
fail "Can't run to main"
return 0
diff --git a/gdb/testsuite/gdb.base/step-resume-infcall.exp b/gdb/testsuite/gdb.base/step-resume-infcall.exp
index 44af3cbc457..176bede4f94 100644
--- a/gdb/testsuite/gdb.base/step-resume-infcall.exp
+++ b/gdb/testsuite/gdb.base/step-resume-infcall.exp
@@ -13,9 +13,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile "step-resume-infcall"
+standard_testfile
-if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/step-test.exp b/gdb/testsuite/gdb.base/step-test.exp
index a493f826f51..c05b4de0229 100644
--- a/gdb/testsuite/gdb.base/step-test.exp
+++ b/gdb/testsuite/gdb.base/step-test.exp
@@ -16,9 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
# step-test.exp -- Expect script to test stepping in gdb
-set testfile step-test
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
remote_exec build "rm -f ${binfile}"
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
@@ -26,10 +24,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debu
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
fail "Can't run to main"
diff --git a/gdb/testsuite/gdb.base/structs.exp b/gdb/testsuite/gdb.base/structs.exp
index 2aa181ea17e..1fe4c28b1e4 100644
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -25,9 +25,7 @@ if [target_info exists gdb,cannot_call_functions] {
continue
}
-set testfile "structs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
# Regex matching any value of `char' type like: a = 65 'A'
set anychar_re {-?[0-9]{1,3} '(.|\\([0-7]{3}|[a-z]|\\|'))'}
@@ -49,7 +47,6 @@ proc start_structs_test { types } {
global testfile
global srcfile
global binfile
- global objdir
global subdir
global srcdir
global gdb_prompt
@@ -67,7 +64,7 @@ proc start_structs_test { types } {
append testfile "-" "$t"
}
- set binfile ${objdir}/${subdir}/${testfile}
+ set binfile [standard_output_file ${testfile}]
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
# built the second test case since we can't use prototypes
warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
diff --git a/gdb/testsuite/gdb.base/structs2.exp b/gdb/testsuite/gdb.base/structs2.exp
index 0753086ff33..fc77cd70a35 100644
--- a/gdb/testsuite/gdb.base/structs2.exp
+++ b/gdb/testsuite/gdb.base/structs2.exp
@@ -14,9 +14,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set prototypes 1
-set testfile "structs2"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
# Create and source the file that provides information about the compiler
# used to compile the test case.
@@ -37,9 +35,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Start with a fresh gdb.
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_test_no_output "set width 0"
diff --git a/gdb/testsuite/gdb.base/structs3.exp b/gdb/testsuite/gdb.base/structs3.exp
index e11d171c241..251c9b7e0fe 100644
--- a/gdb/testsuite/gdb.base/structs3.exp
+++ b/gdb/testsuite/gdb.base/structs3.exp
@@ -15,9 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile "structs3"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [prepare_for_testing structs3.exp "structs3" "" {debug}] } {
return -1
diff --git a/gdb/testsuite/gdb.base/symbol-without-target_section.exp b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
index 76ef84001c9..45af158fb66 100644
--- a/gdb/testsuite/gdb.base/symbol-without-target_section.exp
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
@@ -18,22 +18,20 @@
# Such file is ${binmainfile} through add-symbol-file here. Set context first
# by "list main" to have some local BLOCK set in lookup_symbol_global.
-set testfile symbol-without-target_section
-set srclibfile ${testfile}.c
+standard_testfile start.c .c
set binlibfile ${testfile}.x
-set srcmainfile start.c
-set binmainfile ${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srclibfile}" \
- "${objdir}/${subdir}/${binlibfile}" object {debug}] != "" } {
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
+ [standard_output_file ${binlibfile}] object {debug}] != "" } {
untested ${testfile}.exp
return -1
}
-if {[build_executable ${testfile}.exp ${binmainfile} ${srcmainfile} {debug}] == -1} {
+if {[build_executable ${testfile}.exp ${testfile} ${srcfile} {debug}] == -1} {
return -1
}
clean_restart ${binlibfile}
-gdb_test "add-symbol-file ${objdir}/${subdir}/${binmainfile} 0" \
+gdb_test "add-symbol-file [standard_output_file ${testfile}] 0" \
"Reading symbols from .*" \
"add-symbol-file" \
"add symbol table from file \".*\" at.*\\(y or n\\) " "y"