aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-06-27 18:50:30 +0000
committerTom Tromey <tromey@redhat.com>2013-06-27 18:50:30 +0000
commit289f9037cb9f11c5588dd3baf648e253ffc57574 (patch)
tree0b8c69b4be94e0d0fc764f105d1f1b0f70408f8f /gdb
parenttest suite update - gdb.base/[cd] (diff)
downloadbinutils-gdb-289f9037cb9f11c5588dd3baf648e253ffc57574.tar.gz
binutils-gdb-289f9037cb9f11c5588dd3baf648e253ffc57574.tar.bz2
binutils-gdb-289f9037cb9f11c5588dd3baf648e253ffc57574.zip
test suite update - gdb.base/[efg]
Convert files gdb.base/[efg]*.exp to use standard_output_file et al. * ena-dis-br.exp, enum_cond.exp, enumval.exp, environ.exp, eu-strip-infcall.exp, eval-skip.exp, exe-lock.exp, expand-psymtabs.exp, exprs.exp, fileio.exp, find.exp, fixsection.exp, foll-exec.exp, foll-fork.exp, fortran-sym-case.exp, frame-args.exp, freebpcmd.exp, fullname.exp, funcargs.exp, gcore-buffer-overflow.exp, gcore.exp, gdb1090.exp, gdb11530.exp, gdb11531.exp, gdb1250.exp, gdb1555.exp, gdb1821.exp, gdbindex-stabs.exp, gdbvars.exp, gnu-ifunc.exp, gnu_vector.exp: Use standard_testfile, standard_output_file, prepare_for_testing, clean_restart.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/testsuite/ChangeLog13
-rw-r--r--gdb/testsuite/gdb.base/ena-dis-br.exp42
-rw-r--r--gdb/testsuite/gdb.base/enum_cond.exp4
-rw-r--r--gdb/testsuite/gdb.base/enumval.exp7
-rw-r--r--gdb/testsuite/gdb.base/environ.exp25
-rw-r--r--gdb/testsuite/gdb.base/eu-strip-infcall.exp3
-rw-r--r--gdb/testsuite/gdb.base/eval-skip.exp9
-rw-r--r--gdb/testsuite/gdb.base/exe-lock.exp10
-rw-r--r--gdb/testsuite/gdb.base/expand-psymtabs.exp29
-rw-r--r--gdb/testsuite/gdb.base/exprs.exp10
-rw-r--r--gdb/testsuite/gdb.base/fileio.exp4
-rw-r--r--gdb/testsuite/gdb.base/find.exp9
-rw-r--r--gdb/testsuite/gdb.base/fixsection.exp9
-rw-r--r--gdb/testsuite/gdb.base/foll-exec.exp7
-rw-r--r--gdb/testsuite/gdb.base/foll-fork.exp20
-rw-r--r--gdb/testsuite/gdb.base/fortran-sym-case.exp3
-rw-r--r--gdb/testsuite/gdb.base/frame-args.exp9
-rw-r--r--gdb/testsuite/gdb.base/freebpcmd.exp16
-rw-r--r--gdb/testsuite/gdb.base/fullname.exp23
-rw-r--r--gdb/testsuite/gdb.base/funcargs.exp21
-rw-r--r--gdb/testsuite/gdb.base/gcore-buffer-overflow.exp12
-rw-r--r--gdb/testsuite/gdb.base/gcore.exp19
-rw-r--r--gdb/testsuite/gdb.base/gdb1090.exp15
-rw-r--r--gdb/testsuite/gdb.base/gdb11530.exp3
-rw-r--r--gdb/testsuite/gdb.base/gdb11531.exp2
-rw-r--r--gdb/testsuite/gdb.base/gdb1250.exp9
-rw-r--r--gdb/testsuite/gdb.base/gdb1555.exp13
-rw-r--r--gdb/testsuite/gdb.base/gdb1821.exp13
-rw-r--r--gdb/testsuite/gdb.base/gdbindex-stabs.exp10
-rw-r--r--gdb/testsuite/gdb.base/gdbvars.exp15
-rw-r--r--gdb/testsuite/gdb.base/gnu-ifunc.exp10
-rw-r--r--gdb/testsuite/gdb.base/gnu_vector.exp4
32 files changed, 125 insertions, 273 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index f4d180e4622..d151696e0c9 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,18 @@
2013-06-27 Tom Tromey <tromey@redhat.com>
+ * ena-dis-br.exp, enum_cond.exp, enumval.exp, environ.exp,
+ eu-strip-infcall.exp, eval-skip.exp, exe-lock.exp,
+ expand-psymtabs.exp, exprs.exp, fileio.exp, find.exp,
+ fixsection.exp, foll-exec.exp, foll-fork.exp,
+ fortran-sym-case.exp, frame-args.exp, freebpcmd.exp, fullname.exp,
+ funcargs.exp, gcore-buffer-overflow.exp, gcore.exp, gdb1090.exp,
+ gdb11530.exp, gdb11531.exp, gdb1250.exp, gdb1555.exp, gdb1821.exp,
+ gdbindex-stabs.exp, gdbvars.exp, gnu-ifunc.exp, gnu_vector.exp:
+ Use standard_testfile, standard_output_file, prepare_for_testing,
+ clean_restart.
+
+2013-06-27 Tom Tromey <tromey@redhat.com>
+
* call-ar-st.exp, call-rt-st.exp, call-sc.exp,
call-signal-resume.exp, call-strs.exp, callexit.exp,
callfuncs.exp, catch-load.exp, catch-syscall.exp, charset.exp,
diff --git a/gdb/testsuite/gdb.base/ena-dis-br.exp b/gdb/testsuite/gdb.base/ena-dis-br.exp
index b08b7090d3e..0c4f9d4a1b7 100644
--- a/gdb/testsuite/gdb.base/ena-dis-br.exp
+++ b/gdb/testsuite/gdb.base/ena-dis-br.exp
@@ -19,42 +19,24 @@
# test running programs
#
-set testfile "break"
-set srcfile ${testfile}.c
-set srcfile1 ${testfile}1.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
- untested ena-dis-br.exp
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
- untested ena-dis-br.exp
- return -1
-}
+standard_testfile break.c break1.c
-if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
- untested ena-dis-br.exp
- return -1
+if {[prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile $srcfile2] {debug nowarnings}]} {
+ return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
set bp_location7 [gdb_get_line_number "set breakpoint 7 here"]
-set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
-set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
+set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile2]
+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile2]
set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
-set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
-set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
-set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
-set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
-set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1]
-set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1]
+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile2]
+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile2]
+set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile2]
+set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile2]
+set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile2]
+set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile2]
if ![runto_main] then { fail "enable/disable break tests suppressed" }
diff --git a/gdb/testsuite/gdb.base/enum_cond.exp b/gdb/testsuite/gdb.base/enum_cond.exp
index 6ed8a652d54..6c5d5881b51 100644
--- a/gdb/testsuite/gdb.base/enum_cond.exp
+++ b/gdb/testsuite/gdb.base/enum_cond.exp
@@ -17,9 +17,7 @@
# gdb can correctly print arrays with indexes for each element of the
# array.
-set testfile "enum_cond"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
set opts [list debug additional_flags=-fshort-enums]
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $opts] != "" } {
diff --git a/gdb/testsuite/gdb.base/enumval.exp b/gdb/testsuite/gdb.base/enumval.exp
index 7f80ab3a3a0..e0964fc8895 100644
--- a/gdb/testsuite/gdb.base/enumval.exp
+++ b/gdb/testsuite/gdb.base/enumval.exp
@@ -15,11 +15,10 @@
# 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 "enumval"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [prepare_for_testing enumval.exp "enumval" "" {debug}] } {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
diff --git a/gdb/testsuite/gdb.base/environ.exp b/gdb/testsuite/gdb.base/environ.exp
index 2e171fb6feb..b5a9b2dc6bf 100644
--- a/gdb/testsuite/gdb.base/environ.exp
+++ b/gdb/testsuite/gdb.base/environ.exp
@@ -24,31 +24,14 @@ if ![istarget "hppa*-*-hpux*"] then {
return
}
-set testfile "break"
-set srcfile ${testfile}.c
-set srcfile1 ${testfile}1.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile break.c break1.c
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
- untested environ.exp
+if {[prepare_for_testing $testfile.exp $testfile \
+ [list $srcfile $srcfile2] {debug nowarnings}]} {
+ untested $testfile.exp
return -1
}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
- untested environ.exp
- return -1
-}
-
-if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
- untested environ.exp
- return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
if ![runto_main] then { fail "environment command tests suppressed" }
# (No, this is not really related to the environment commands. But it's
diff --git a/gdb/testsuite/gdb.base/eu-strip-infcall.exp b/gdb/testsuite/gdb.base/eu-strip-infcall.exp
index 0db1daa47f3..a325668ecfa 100644
--- a/gdb/testsuite/gdb.base/eu-strip-infcall.exp
+++ b/gdb/testsuite/gdb.base/eu-strip-infcall.exp
@@ -13,8 +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 eu-strip-infcall
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
if {[build_executable ${testfile}.exp $testfile] == -1} {
return -1
diff --git a/gdb/testsuite/gdb.base/eval-skip.exp b/gdb/testsuite/gdb.base/eval-skip.exp
index ee995779709..28cfa1085cc 100644
--- a/gdb/testsuite/gdb.base/eval-skip.exp
+++ b/gdb/testsuite/gdb.base/eval-skip.exp
@@ -32,9 +32,7 @@
# haven't tried to compile one, or the compilation failed for some reason.
# In either case, just notify the user and skip the tests in this file.
-set testfile "int-type"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile int-type.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested eval-skip.exp
@@ -45,10 +43,7 @@ if [get_compiler_info] {
return -1
}
-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/exe-lock.exp b/gdb/testsuite/gdb.base/exe-lock.exp
index 5c6a5d0c8a7..6bbef36de81 100644
--- a/gdb/testsuite/gdb.base/exe-lock.exp
+++ b/gdb/testsuite/gdb.base/exe-lock.exp
@@ -17,21 +17,17 @@
# a filesystem lock on the executable file once the executable
# is no longer running.
-set testfile "arrayidx"
-set srcfile ${testfile}.c
+standard_testfile arrayidx.c
# $EXEEXT suffix is needed here, because otherwise, Windows targets
# don't find the $binfile for 'file delete $binfile'.
-set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
+append binfile $EXEEXT
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Sanity-check: Verify that the executable exists. This is just to
# make sure that, when we verify later that the file does not exist,
diff --git a/gdb/testsuite/gdb.base/expand-psymtabs.exp b/gdb/testsuite/gdb.base/expand-psymtabs.exp
index 4c6dc148cc1..030f99285b1 100644
--- a/gdb/testsuite/gdb.base/expand-psymtabs.exp
+++ b/gdb/testsuite/gdb.base/expand-psymtabs.exp
@@ -29,37 +29,20 @@
# reading in effect, GDB can set breakpoints by line number
# successfully in either compilation unit.
-set testfile expand-psymtabs
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set binfile_1 ${objdir}/${subdir}/${testfile}_1.o
-set binfile_2 ${objdir}/${subdir}/${testfile}_2.o
+standard_testfile
# What compiler are we using?
if [get_compiler_info] {
return -1
}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_1}" object {debug additional_flags=-DFIRST} ] != "" } {
- untested expand-psymtabs.exp
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_2}" object {debug}] != "" } {
- untested expand-psymtabs.exp
- return -1
-}
-
-if { [gdb_compile "${binfile_1} ${binfile_2}" "${binfile}" executable {debug}] != "" } {
- untested expand-psymtabs.exp
- return -1
+# We intentionally compile the source file in twice.
+if {[prepare_for_testing_full $testfile.exp \
+ [list $testfile debug $srcfile {debug additional_flags=-DFIRST} \
+ $srcfile debug]]} {
+ return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
set foo_bp [gdb_get_line_number "Break here"]
gdb_test "break $foo_bp" "Breakpoint.*" "Expand psymtabs"
diff --git a/gdb/testsuite/gdb.base/exprs.exp b/gdb/testsuite/gdb.base/exprs.exp
index 8ef42a45f62..2a5ee5ced57 100644
--- a/gdb/testsuite/gdb.base/exprs.exp
+++ b/gdb/testsuite/gdb.base/exprs.exp
@@ -19,9 +19,8 @@
# test running programs
#
-set testfile "exprs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested exprs.exp
return -1
@@ -31,10 +30,7 @@ if [get_compiler_info] {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# set it up at a breakpoint so we can play with the variable values
diff --git a/gdb/testsuite/gdb.base/fileio.exp b/gdb/testsuite/gdb.base/fileio.exp
index c93913e9681..ded043f5915 100644
--- a/gdb/testsuite/gdb.base/fileio.exp
+++ b/gdb/testsuite/gdb.base/fileio.exp
@@ -21,9 +21,7 @@ if [target_info exists gdb,nofileio] {
}
-set testfile "fileio"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested fileio.exp
diff --git a/gdb/testsuite/gdb.base/find.exp b/gdb/testsuite/gdb.base/find.exp
index 9e6bd69ef0c..0de9fadc872 100644
--- a/gdb/testsuite/gdb.base/find.exp
+++ b/gdb/testsuite/gdb.base/find.exp
@@ -15,19 +15,14 @@
# This tests the find command.
-set testfile "find"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested find.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_test "break $srcfile:stop_here" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
diff --git a/gdb/testsuite/gdb.base/fixsection.exp b/gdb/testsuite/gdb.base/fixsection.exp
index 99871f9893e..74cd196c3dd 100644
--- a/gdb/testsuite/gdb.base/fixsection.exp
+++ b/gdb/testsuite/gdb.base/fixsection.exp
@@ -18,13 +18,11 @@ if {[skip_shlib_tests]} {
return 0
}
-set testfile "fixsection"
-set srcfile ${srcdir}/${subdir}/${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
set libfile "fixsectshr"
set libsrc ${srcdir}/${subdir}/${libfile}.c
-set lib_sl ${objdir}/${subdir}/${libfile}.sl
+set lib_sl [standard_output_file ${libfile}.sl]
set lib_opts [list debug nowarnings]
set exec_opts [list debug nowarnings shlib=$lib_sl]
@@ -34,7 +32,8 @@ if [get_compiler_info] {
}
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 "Could not compile either $libsrc or $srcfile."
return -1
}
diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp
index 9b04ddd62e7..9456f429127 100644
--- a/gdb/testsuite/gdb.base/foll-exec.exp
+++ b/gdb/testsuite/gdb.base/foll-exec.exp
@@ -23,12 +23,11 @@ if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
-set testfile "foll-exec"
+standard_testfile foll-exec.c
+
set testfile2 "execd-prog"
-set srcfile ${testfile}.c
set srcfile2 ${testfile2}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set binfile2 ${objdir}/${subdir}/${testfile2}
+set binfile2 [standard_output_file ${testfile2}]
# build the first test case
if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug}] != "" } {
diff --git a/gdb/testsuite/gdb.base/foll-fork.exp b/gdb/testsuite/gdb.base/foll-fork.exp
index 9fe5e9bff78..e9a0d301e76 100644
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -24,14 +24,11 @@ if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"]} then {
continue
}
-global srcfile
-set testfile "foll-fork"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested foll-fork.exp
- return -1
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
+ return -1
}
proc check_fork_catchpoints {} {
@@ -331,13 +328,6 @@ By default, the debugger will follow the parent process..*" \
if [runto_main] then { tcatch_fork_parent_follow }
}
-# Start with a fresh gdb
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# The "Detaching..." and "Attaching..." messages may be hidden by
# default.
gdb_test_no_output "set verbose"
diff --git a/gdb/testsuite/gdb.base/fortran-sym-case.exp b/gdb/testsuite/gdb.base/fortran-sym-case.exp
index 71a38ccff38..1de6d22b3b1 100644
--- a/gdb/testsuite/gdb.base/fortran-sym-case.exp
+++ b/gdb/testsuite/gdb.base/fortran-sym-case.exp
@@ -13,7 +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 fortran-sym-case
+standard_testfile .c
+
if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
return -1
}
diff --git a/gdb/testsuite/gdb.base/frame-args.exp b/gdb/testsuite/gdb.base/frame-args.exp
index 9786897e8db..ac67fa63a0a 100644
--- a/gdb/testsuite/gdb.base/frame-args.exp
+++ b/gdb/testsuite/gdb.base/frame-args.exp
@@ -13,18 +13,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 "frame-args"
-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
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto break_me] then {
perror "Couldn't run ${testfile}"
diff --git a/gdb/testsuite/gdb.base/freebpcmd.exp b/gdb/testsuite/gdb.base/freebpcmd.exp
index fc2fe2dbfc2..2596786b55b 100644
--- a/gdb/testsuite/gdb.base/freebpcmd.exp
+++ b/gdb/testsuite/gdb.base/freebpcmd.exp
@@ -44,20 +44,12 @@
# suggestions for improving this.
-set testfile "freebpcmd"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested freebpcmd.exp
- return -1
+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}
-
gdb_test "break ${srcfile}:[gdb_get_line_number "euphonium"]" ".*" \
"set breakpoint"
diff --git a/gdb/testsuite/gdb.base/fullname.exp b/gdb/testsuite/gdb.base/fullname.exp
index d208b7a6a31..32f6ea45583 100644
--- a/gdb/testsuite/gdb.base/fullname.exp
+++ b/gdb/testsuite/gdb.base/fullname.exp
@@ -16,9 +16,7 @@
# This file tests setting breakpoints according to the full path of a
# source file.
-set testfile "fullname"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
# We rely on being able to copy things around.
@@ -30,13 +28,13 @@ if { [is_remote host] } {
# Create a temporary file in the build directory. Use a different
# filename in case ${srcdir} == ${objdir}.
if { [catch {file copy -force ${srcdir}/${subdir}/${srcfile} \
- ${objdir}/${subdir}/tmp-${srcfile}}] != 0 } {
+ [standard_output_file tmp-${srcfile}]}] != 0 } {
error "Could not create temporary file"
return -1
}
# Build the test executable using an absolute path.
-if { [gdb_compile "${objdir}/${subdir}/tmp-${srcfile}" "${binfile}" executable {debug}] != "" } {
+if { [gdb_compile [standard_output_file tmp-${srcfile}] "${binfile}" executable {debug}] != "" } {
return -1
}
@@ -55,7 +53,7 @@ gdb_start
gdb_load ${binfile}
set msg "set breakpoint by full path before loading symbols - built absolute"
-if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
+if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
pass $msg
} else {
fail $msg
@@ -65,7 +63,7 @@ gdb_test "break main" \
"Breakpoint.*at.*line.*" "set breakpoint at main - built absolute"
set msg "set breakpoint by full path after loading symbols - built absolute"
-if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
+if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
pass $msg
} else {
fail $msg
@@ -81,7 +79,7 @@ gdb_start
gdb_load ${binfile}
set msg "set breakpoint by full path before loading symbols - built relative"
-if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
+if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
pass $msg
} else {
fail $msg
@@ -91,7 +89,7 @@ gdb_test "break main" \
"Breakpoint.*at.*line.*" "set breakpoint at main - built relative"
set msg "set breakpoint by full path after loading symbols - built relative"
-if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
+if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
pass $msg
} else {
fail $msg
@@ -102,7 +100,8 @@ if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] !=
set save_pwd [pwd]
cd ${subdir}
-if { [gdb_compile "tmp-${srcfile}" "${testfile}" executable {debug}] != "" } {
+if { [gdb_compile [standard_output_file tmp-${srcfile}] "${testfile}" \
+ executable {debug}] != "" } {
cd $save_pwd
return -1
}
@@ -113,7 +112,7 @@ gdb_start
gdb_load ${binfile}
set msg "set breakpoint by full path before loading symbols - built other"
-if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
+if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
pass $msg
} else {
fail $msg
@@ -123,7 +122,7 @@ gdb_test "break main" \
"Breakpoint.*at.*line.*" "set breakpoint at main - built other"
set msg "set breakpoint by full path after loading symbols - built other"
-if { [gdb_breakpoint ${objdir}/${subdir}/tmp-${srcfile}:${line} {no-message}] != 0 } {
+if { [gdb_breakpoint [standard_output_file tmp-${srcfile}]:${line} {no-message}] != 0 } {
pass $msg
} else {
fail $msg
diff --git a/gdb/testsuite/gdb.base/funcargs.exp b/gdb/testsuite/gdb.base/funcargs.exp
index 2b89d14b417..d1b3f5aaf08 100644
--- a/gdb/testsuite/gdb.base/funcargs.exp
+++ b/gdb/testsuite/gdb.base/funcargs.exp
@@ -16,26 +16,24 @@
# This file was written by Fred Fish. (fnf@cygnus.com)
-set testfile "funcargs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
set compile_flags {debug nowarnings quiet}
if [support_complex_tests] {
lappend compile_flags "additional_flags=-DTEST_COMPLEX"
}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_flags] != "" } {
- untested funcargs.exp
- return -1
-}
-
# Create and source the file that provides information about the compiler
# used to compile the test case.
if [get_compiler_info] {
return -1
}
+if {[prepare_for_testing $testfile.exp $testfile $srcfile $compile_flags]} {
+ untested $testfile.exp
+ return -1
+}
+
#
# Locate actual args; integral types.
#
@@ -1159,13 +1157,6 @@ proc test_stepping_over_trampolines { } {
gdb_stop_suppressing_tests
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
set prev_timeout $timeout
if [istarget "mips*tx39-*"] {
set timeout 300
diff --git a/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp b/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
index 7bb3ba82efd..8d0867e373a 100644
--- a/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
+++ b/gdb/testsuite/gdb.base/gcore-buffer-overflow.exp
@@ -16,12 +16,11 @@
# Test GDB's internal buffers safety for the GCORE command.
-set testfile "gcore-buffer-overflow"
-set srcfile ${testfile}.c
+standard_testfile .c
# The ${binfile} basename needs to exceed 80 characters (`sizeof (psargs)')
# plus some additional data to overwrite the stack frame.
set pattern 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
-set binfile ${objdir}/${subdir}/${testfile}-${pattern}
+append binfile -${pattern}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested ${testfile}.exp
@@ -30,10 +29,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# Does this gdb support gcore?
gdb_test_multiple "help gcore" "help gcore" {
@@ -55,4 +51,4 @@ if { ! [ runto_main ] } then {
return -1
}
-gdb_gcore_cmd "${objdir}/${subdir}/gcore-buffer-overflow.test" "save a corefile"
+gdb_gcore_cmd [standard_testfile gcore-buffer-overflow.test] "save a corefile"
diff --git a/gdb/testsuite/gdb.base/gcore.exp b/gdb/testsuite/gdb.base/gcore.exp
index 68fd8749a5d..0807a60fb39 100644
--- a/gdb/testsuite/gdb.base/gcore.exp
+++ b/gdb/testsuite/gdb.base/gcore.exp
@@ -17,22 +17,13 @@
# This is a test for the gdb command "generate-core-file".
-set testfile "gcore"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested gcore.exp
- return -1
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
+ return -1
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# Does this gdb support gcore?
gdb_test_multiple "help gcore" "help gcore" {
-re "Undefined command: .gcore.*$gdb_prompt $" {
@@ -86,7 +77,7 @@ set pre_corefile_local_array \
set pre_corefile_extern_array \
[capture_command_output "print extern_array" "$print_prefix"]
-set corefile "${objdir}/${subdir}/gcore.test"
+set corefile [standard_output_file gcore.test]
set core_supported [gdb_gcore_cmd "$corefile" "save a corefile"]
if {!$core_supported} {
return -1
diff --git a/gdb/testsuite/gdb.base/gdb1090.exp b/gdb/testsuite/gdb.base/gdb1090.exp
index 9f693b0e406..c4e5f59fdc5 100644
--- a/gdb/testsuite/gdb.base/gdb1090.exp
+++ b/gdb/testsuite/gdb.base/gdb1090.exp
@@ -22,20 +22,13 @@
# test running programs
#
-set testfile "gdb1090"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested gdb1090.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 1
diff --git a/gdb/testsuite/gdb.base/gdb11530.exp b/gdb/testsuite/gdb.base/gdb11530.exp
index 09e69a176fe..5f80fce8f4b 100644
--- a/gdb/testsuite/gdb.base/gdb11530.exp
+++ b/gdb/testsuite/gdb.base/gdb11530.exp
@@ -18,8 +18,7 @@
# Test GDB bug report 11530.
# This is a problem related unnamed unions.
-set testfile "gdb11530"
-set binfile ${testfile}${EXEEXT}
+standard_testfile
# Unnamed union is a GNU extension, thus we restrict the test
# to gcc compiler.
diff --git a/gdb/testsuite/gdb.base/gdb11531.exp b/gdb/testsuite/gdb.base/gdb11531.exp
index cf0678ba687..a0087d76b99 100644
--- a/gdb/testsuite/gdb.base/gdb11531.exp
+++ b/gdb/testsuite/gdb.base/gdb11531.exp
@@ -20,7 +20,7 @@
# It affects Solaris native targets.
-set testfile "gdb11531"
+standard_testfile
if { [prepare_for_testing $testfile.exp $testfile $testfile.c {debug}] } {
return -1
diff --git a/gdb/testsuite/gdb.base/gdb1250.exp b/gdb/testsuite/gdb.base/gdb1250.exp
index 35adc2c1cad..c12e90823ea 100644
--- a/gdb/testsuite/gdb.base/gdb1250.exp
+++ b/gdb/testsuite/gdb.base/gdb1250.exp
@@ -22,19 +22,14 @@
# test running programs
#
-set testfile "gdb1250"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested gdb1250.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto abort {allow-pending}] then {
continue
diff --git a/gdb/testsuite/gdb.base/gdb1555.exp b/gdb/testsuite/gdb.base/gdb1555.exp
index a74a642aa2c..32a7ab8888e 100644
--- a/gdb/testsuite/gdb.base/gdb1555.exp
+++ b/gdb/testsuite/gdb.base/gdb1555.exp
@@ -21,13 +21,11 @@ if {[skip_shlib_tests]} {
return 0
}
-set testfile gdb1555-main
-set libfile gdb1555
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile gdb1555-main.c gdb1555.c
+set libfile gdb1555
set libsrc "${srcdir}/${subdir}/${libfile}.c"
-set libobj "${objdir}/${subdir}/${libfile}.so"
+set libobj [standard_output_file ${libfile}.so]
set execsrc "${srcdir}/${subdir}/${srcfile}"
remote_exec build "rm -f ${binfile}"
@@ -43,10 +41,7 @@ if { [gdb_compile_shlib $libsrc $libobj {debug}] != ""
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_load_shlibs $libobj
if ![runto_main] then {
diff --git a/gdb/testsuite/gdb.base/gdb1821.exp b/gdb/testsuite/gdb.base/gdb1821.exp
index 00d910f45a3..6e0fc1adb6b 100644
--- a/gdb/testsuite/gdb.base/gdb1821.exp
+++ b/gdb/testsuite/gdb.base/gdb1821.exp
@@ -22,18 +22,13 @@
# test running programs
#
-set testfile "gdb1821"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- return -1
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
+ return -1
}
-gdb_exit
-gdb_start
-gdb_load ${binfile}
-
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
diff --git a/gdb/testsuite/gdb.base/gdbindex-stabs.exp b/gdb/testsuite/gdb.base/gdbindex-stabs.exp
index 38ea4a9361a..f0c59bd26f5 100644
--- a/gdb/testsuite/gdb.base/gdbindex-stabs.exp
+++ b/gdb/testsuite/gdb.base/gdbindex-stabs.exp
@@ -15,13 +15,11 @@
# This problem is reproducible only when using `gdb/cc-with-index.sh'.
-set testfile gdbindex-stabs
-set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile gdbindex-stabs.c
set srcfile_stabs ${testfile}.c
set srcfile_dwarf ${testfile}-dwarf.c
-set objfile_stabs ${testfile}.o
-set objfile_dwarf ${testfile}-dwarf.o
+set objfile_stabs [standard_output_file ${testfile}.o]
+set objfile_dwarf [standard_output_file ${testfile}-dwarf.o]
if {[gdb_compile "${srcdir}/${subdir}/${srcfile_stabs}" ${objfile_stabs} object {additional_flags=-gstabs}] != ""
|| [gdb_compile "${srcdir}/${subdir}/${srcfile_dwarf}" ${objfile_dwarf} object {additional_flags=-gdwarf-2}] != ""
@@ -30,7 +28,7 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile_stabs}" ${objfile_stabs} object
return -1
}
-clean_restart ${executable}
+clean_restart ${binfile}
# FAIL was: No line number known for stabs_function.
gdb_test "list stabs_function" " marker-here .*"
diff --git a/gdb/testsuite/gdb.base/gdbvars.exp b/gdb/testsuite/gdb.base/gdbvars.exp
index da41f7e7484..23a6758bcae 100644
--- a/gdb/testsuite/gdb.base/gdbvars.exp
+++ b/gdb/testsuite/gdb.base/gdbvars.exp
@@ -16,12 +16,10 @@
# This file was written by Fred Fish. (fnf@cygnus.com)
-set testfile "gdbvars"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested gdbvars.exp
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
@@ -112,13 +110,6 @@ proc test_with_program {} {
"Print contents of new convenience variable of program variable"
}
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
gdb_test_no_output "set print sevenbit-strings"
test_value_history
diff --git a/gdb/testsuite/gdb.base/gnu-ifunc.exp b/gdb/testsuite/gdb.base/gnu-ifunc.exp
index 417ec0a9531..6a61f572c3d 100644
--- a/gdb/testsuite/gdb.base/gnu-ifunc.exp
+++ b/gdb/testsuite/gdb.base/gnu-ifunc.exp
@@ -17,18 +17,16 @@ if {[skip_shlib_tests]} {
return 0
}
-set testfile "gnu-ifunc"
+standard_testfile .c
set executable ${testfile}
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${executable}
set staticexecutable ${executable}-static
-set staticbinfile ${objdir}/${subdir}/${staticexecutable}
+set staticbinfile [standard_output_file ${staticexecutable}]
set libfile "${testfile}-lib"
set libsrc ${libfile}.c
-set lib_so ${objdir}/${subdir}/${libfile}.so
+set lib_so [standard_output_file ${libfile}.so]
# $lib_o must not have {debug}, it would override the STT_GNU_IFUNC ELF markers.
-set lib_o ${objdir}/${subdir}/${libfile}.o
+set lib_o [standard_output_file ${libfile}.o]
# We need DWARF for the "final" function as we "step" into the function and GDB
# would step-over the "final" function if there would be no line number debug
diff --git a/gdb/testsuite/gdb.base/gnu_vector.exp b/gdb/testsuite/gdb.base/gnu_vector.exp
index f65627ba761..67a44c1878d 100644
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
@@ -18,9 +18,7 @@
# Tests GDBs support for GNU vectors.
# http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html
-set testfile "gnu_vector"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if [get_compiler_info] {
return -1