This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 6/7] test suite update - gdb.base/s*


Files gdb.base/s*.exp.
See message #0 for details.

	* save-bp.exp, savedregs.exp, scope.exp, sep.exp, sepsymtab.exp,
	set-lang-auto.exp, setshow.exp, setvar.exp, shlib-call.exp,
	shreloc.exp, sigall.exp, sigaltstack.exp, sigbpt.exp, sigchld.exp,
	siginfo-addr.exp, siginfo-infcall.exp, siginfo-obj.exp,
	siginfo.exp, signals.exp, signest.exp, signull.exp, sigrepeat.exp,
	sigstep.exp, sizeof.exp, skip-solib.exp, so-impl-ld.exp,
	solib-display.exp, solib-nodir.exp, solib-overlap.exp,
	solib-symbol.exp, solib-weak.exp, source.exp, stack-checking.exp,
	stale-infcall.exp, stap-probe.exp, start.exp, step-break.exp,
	step-bt.exp, step-line.exp, step-resume-infcall.exp,
	step-test.exp, structs.exp, structs2.exp, structs3.exp,
	symbol-without-target_section.exp: Use standard_testfile,
	standard_output_file, prepare_for_testing, clean_restart.
---
 gdb/testsuite/gdb.base/save-bp.exp                 |  5 ++--
 gdb/testsuite/gdb.base/savedregs.exp               | 10 +++-----
 gdb/testsuite/gdb.base/scope.exp                   | 27 ++++------------------
 gdb/testsuite/gdb.base/sep.exp                     |  9 ++------
 gdb/testsuite/gdb.base/sepsymtab.exp               |  9 ++------
 gdb/testsuite/gdb.base/set-lang-auto.exp           | 16 ++++---------
 gdb/testsuite/gdb.base/setshow.exp                 | 10 +++-----
 gdb/testsuite/gdb.base/setvar.exp                  | 16 ++++---------
 gdb/testsuite/gdb.base/shlib-call.exp              | 20 ++++++----------
 gdb/testsuite/gdb.base/shreloc.exp                 | 25 ++++++++------------
 gdb/testsuite/gdb.base/sigall.exp                  | 16 ++++---------
 gdb/testsuite/gdb.base/sigaltstack.exp             | 10 +++-----
 gdb/testsuite/gdb.base/sigbpt.exp                  | 14 ++++-------
 gdb/testsuite/gdb.base/sigchld.exp                 |  9 ++------
 gdb/testsuite/gdb.base/siginfo-addr.exp            | 12 ++--------
 gdb/testsuite/gdb.base/siginfo-infcall.exp         |  7 +++---
 gdb/testsuite/gdb.base/siginfo-obj.exp             | 15 ++++--------
 gdb/testsuite/gdb.base/siginfo.exp                 | 15 ++++--------
 gdb/testsuite/gdb.base/signals.exp                 | 10 +++-----
 gdb/testsuite/gdb.base/signest.exp                 |  3 +--
 gdb/testsuite/gdb.base/signull.exp                 | 10 +++-----
 gdb/testsuite/gdb.base/sigrepeat.exp               | 10 +++-----
 gdb/testsuite/gdb.base/sigstep.exp                 | 15 ++++--------
 gdb/testsuite/gdb.base/sizeof.exp                  | 16 ++++---------
 gdb/testsuite/gdb.base/skip-solib.exp              |  9 ++++----
 gdb/testsuite/gdb.base/so-impl-ld.exp              | 14 ++++-------
 gdb/testsuite/gdb.base/solib-display.exp           |  4 ++--
 gdb/testsuite/gdb.base/solib-nodir.exp             |  6 ++---
 gdb/testsuite/gdb.base/solib-overlap.exp           |  6 ++---
 gdb/testsuite/gdb.base/solib-symbol.exp            |  4 ++--
 gdb/testsuite/gdb.base/solib-weak.exp              |  8 +++----
 gdb/testsuite/gdb.base/source.exp                  |  4 +---
 gdb/testsuite/gdb.base/stack-checking.exp          |  9 ++------
 gdb/testsuite/gdb.base/stale-infcall.exp           |  4 ++--
 gdb/testsuite/gdb.base/stap-probe.exp              |  6 ++---
 gdb/testsuite/gdb.base/start.exp                   | 16 ++++---------
 gdb/testsuite/gdb.base/step-break.exp              | 11 ++-------
 gdb/testsuite/gdb.base/step-bt.exp                 | 16 ++++---------
 gdb/testsuite/gdb.base/step-line.exp               | 16 ++++---------
 gdb/testsuite/gdb.base/step-resume-infcall.exp     |  4 ++--
 gdb/testsuite/gdb.base/step-test.exp               |  9 ++------
 gdb/testsuite/gdb.base/structs.exp                 |  7 ++----
 gdb/testsuite/gdb.base/structs2.exp                |  8 ++-----
 gdb/testsuite/gdb.base/structs3.exp                |  4 +---
 .../gdb.base/symbol-without-target_section.exp     | 14 +++++------
 45 files changed, 148 insertions(+), 340 deletions(-)

diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp
index 72a6847..64df0f7 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 1548d0a..d4d16c3 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 fbcc31b..e781cf0 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 af50d17..7034d03 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 407a9b0..d19075e 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 617310e..e2f3694 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 e172fc7..661431c 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 1c58300..9970499 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 747aaa5..326112d 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 f93b03e..2baf676 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 4bd0427..b1b8597 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 4fc5ac8..3171318 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 51545da..eb16b8e 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 ce88576..ab2a37f 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 02810e8..021d5d1 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 7d17b70..ed034be 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 cebc2ee..6cee02e 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 5389e0b..036d1a5 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 7652ff0..667368c 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 67dc6ee..de000f3 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 5fadd3a..e440c17 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 3b423ec..08beed3 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 e8ab8ea..9515c61 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 03972bb..af59e3b 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 14bf6bf..f618fc5 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 64fc781..a1d0281 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 817846c..928719d 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 2ed48a5..34d9410 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 ba1e1ad..068c1de 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 b758a68..9ffe7fe 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 11c3830..5951806 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 a398e77..61fd221 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 47d02e9..0c1fb51 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 074fabb..deddf61 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 048e082..0f2b028 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 6f1f517..296d17a 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 ca091af..29c2a3b 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 f5b57ce..03fc453 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 1be5dae..bc8f2bc 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 44af3cb..176bede 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 a493f82..c05b4de 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 2aa181e..1fe4c28 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 0753086..fc77cd7 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 e11d171..251c9b7 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 76ef840..45af158 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"
-- 
1.8.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]