* gdb.dwarf2/dw2-var-zero-addr.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-param-error.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-op-call.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-inline-param.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.dwarf2/dw2-inline-break.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-ifort-parameter.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-cp-infcall-ref-static.exp: Use
	standard_testfile.
	* gdb.dwarf2/dw2-case-insensitive.exp: Use standard_testfile.
	* gdb.dwarf2/dw4-sig-types.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-objfile-overlap.exp: Use standard_testfile.
	* gdb.dwarf2/callframecfa.exp: Use standard_testfile,
	prepare_for_testing.
	* gdb.dwarf2/dup-psym.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-ada-
ffffffff.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-anonymous-func.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-bad-parameter-type.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-basic.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-compressed.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-const.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-cu-size.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-double-set-die-type.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-empty-namespace.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-empty-pc-range.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-filename.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-icc-opaque.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-inheritance.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-intercu.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-intermix.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-linkage-name-trust.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-modula2-self-type.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-namespaceless-anonymous.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-op-stack-value.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-producer.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-ranges.exp: Use standard_testfile,
	standard_output_file.
	* gdb.dwarf2/dw2-ref-missing-frame.exp: Use standard_testfile,
	standard_output_file.
	* gdb.dwarf2/dw2-restore.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-simple-locdesc.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-skip-prologue.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-stack-boundary.exp: Use standard_testfile.
	* gdb.dwarf2/dw2-strp.exp: Use standard_testfile.
	* gdb.dwarf2/dw4-sig-type-unused.exp: Use standard_testfile.
	* gdb.dwarf2/implptr-64bit.exp: Use standard_testfile.
	* gdb.dwarf2/implptr-optimized-out.exp: Use standard_testfile.
	* gdb.dwarf2/implptr.exp: Use standard_testfile.
	* gdb.dwarf2/mac-fileno.exp: Use standard_testfile.
	* gdb.dwarf2/member-ptr-forwardref.exp: Use standard_testfile.
	* gdb.dwarf2/pieces.exp: Use standard_testfile.
	* gdb.dwarf2/pr11465.exp: Use standard_testfile.
	* gdb.dwarf2/pr13961.exp: Use standard_testfile.
	* gdb.dwarf2/valop.exp: Use standard_testfile,
	prepare_for_testing.
 
+2012-06-27  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.dwarf2/pr10770.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-var-zero-addr.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-param-error.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-op-call.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-inline-param.exp: Use standard_testfile,
+       prepare_for_testing.
+       * gdb.dwarf2/dw2-inline-break.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-ifort-parameter.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-cp-infcall-ref-static.exp: Use
+       standard_testfile.
+       * gdb.dwarf2/dw2-case-insensitive.exp: Use standard_testfile.
+       * gdb.dwarf2/dw4-sig-types.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-objfile-overlap.exp: Use standard_testfile.
+       * gdb.dwarf2/callframecfa.exp: Use standard_testfile,
+       prepare_for_testing.
+       * gdb.dwarf2/dup-psym.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-ada-ffffffff.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-anonymous-func.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-bad-parameter-type.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-basic.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-compressed.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-const.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-cu-size.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-double-set-die-type.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-empty-namespace.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-empty-pc-range.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-filename.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-icc-opaque.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-inheritance.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-intercu.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-intermix.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-linkage-name-trust.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-modula2-self-type.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-namespaceless-anonymous.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-op-stack-value.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-producer.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-ranges.exp: Use standard_testfile,
+       standard_output_file.
+       * gdb.dwarf2/dw2-ref-missing-frame.exp: Use standard_testfile,
+       standard_output_file.
+       * gdb.dwarf2/dw2-restore.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-simple-locdesc.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-skip-prologue.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-stack-boundary.exp: Use standard_testfile.
+       * gdb.dwarf2/dw2-strp.exp: Use standard_testfile.
+       * gdb.dwarf2/dw4-sig-type-unused.exp: Use standard_testfile.
+       * gdb.dwarf2/implptr-64bit.exp: Use standard_testfile.
+       * gdb.dwarf2/implptr-optimized-out.exp: Use standard_testfile.
+       * gdb.dwarf2/implptr.exp: Use standard_testfile.
+       * gdb.dwarf2/mac-fileno.exp: Use standard_testfile.
+       * gdb.dwarf2/member-ptr-forwardref.exp: Use standard_testfile.
+       * gdb.dwarf2/pieces.exp: Use standard_testfile.
+       * gdb.dwarf2/pr11465.exp: Use standard_testfile.
+       * gdb.dwarf2/pr13961.exp: Use standard_testfile.
+       * gdb.dwarf2/valop.exp: Use standard_testfile,
+       prepare_for_testing.
+
 2012-06-27  Tom Tromey  <tromey@redhat.com>
 
        * gdb.python/python.exp: Fix regexps in pagination tests.
 
     return 0  
 }
 
-set testfile "callframecfa"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
+standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
-       [list {additional_flags=-nostdlib}]] != "" } {
+if {[prepare_for_testing $testname.exp $testname $srcfile \
+        [list {additional_flags=-nostdlib}]]} {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 if ![runto_main] {
     return -1
 }
 
     return 0  
 }
 
-set testfile "dup-psym"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
+standard_testfile .S
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
     return 0  
 }
 
-set testfile "dw2-ada-ffffffff"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .S
+set executable ${testfile}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
     return -1
 
     return 0
 }
 
-set testfile "dw2-anonymous-func"
+standard_testfile .S
 set dwarf_srcfile "file1.txt"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
     return 0  
 }
 
-set testfile "dw2-bad-parameter-type"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .S
+set executable ${testfile}
 
 # First try referencing DW_AT_frame_base which is not defined.
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
 
     return 0  
 }
 
-set testfile "dw2-basic"
+standard_testfile .S
 set dwarf_srcfile "file1.txt"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
     return 0  
 }
 
-set testfile "dw2-case-insensitive"
+standard_testfile .c dw2-case-insensitive-debug.S
 
-if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+         [list $srcfile $srcfile2] {nodebug}] } {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile "dw2-compressed"
+standard_testfile .S
 set dwarf_srcfile "file1.txt"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main-ndebug.o" object -g0] != "" } {
     return -1
 
     return 0
 }
 
-set testfile "dw2-const"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
+standard_testfile .S
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
     return -1
 }
 
-clean_restart ${testfile}.x
+clean_restart ${testfile}
 
 gdb_test "print twelve" "= 12"
 
 
     return 0  
 }
 
-set testfile "dw2-cp-infcall-ref-static"
-if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}-main.c ${testfile}.S] {}] } {
+standard_testfile .S dw2-cp-infcall-ref-static-main.c
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+         [list $srcfile2 $srcfile] {}] } {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile "dw2-cu-size"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
+standard_testfile .S
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
     return 0  
 }
 
-set testfile "dw2-double-set-die-type"
-set srcfile "$testfile.S"
-set executable "$testfile.x"
+standard_testfile .S
 
-if  { [gdb_compile [file join $srcdir $subdir $srcfile] \
-          [file join $objdir $subdir $executable] \
+if  { [gdb_compile [file join $srcdir $subdir $srcfile] $binfile \
           object {nodebug}] != "" } {
     return -1
 }
 
-clean_restart $executable
+clean_restart $testfile
 gdb_test "ptype a" "type = class .*"
 
     return 0  
 }
 
-set testfile "dw2-empty-namespace"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
+standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
+          object {nodebug}] != "" } {
     return -1
 }
 
-clean_restart $executable
+clean_restart $testfile
 
 # `p var' below can work without identified DWARF DIE just based on its ELF symbol.
 # Catch it here as `type = <data variable, no debug info>'.
 
     return 0  
 }
 
-set testfile "dw2-empty-pc-range"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .S
+set executable ${testfile}
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
     return -1
 
     return 0
 }
 
-set testfile "dw2-filename"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
+standard_testfile .S
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {nodebug}] != "" } {
     return -1
 }
 
-clean_restart ${testfile}.x
+clean_restart ${testfile}
 
 # Verify that -file-list-exec-source-files returns a list where
 # the "file" is "file1.txt" (file base name), and "fullname" is
 
     return 0
 }
 
-set testfile "dw2-icc-opaque"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .S
+set executable ${testfile}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
     return -1
 
     return 0
 }
 
-set testfile "dw2-ifort-parameter"
+standard_testfile .c dw2-ifort-parameter-debug.S
 
-if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.c ${testfile}-debug.S] {nodebug}] } {
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+         [list $srcfile $srcfile2] {nodebug}] } {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile "dw2-inheritance"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
+standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
+          object {nodebug}] != "" } {
     return -1
 }
 
-clean_restart $executable
+clean_restart $testfile
 
 gdb_test "ptype inherited" "type = class inherited .*"
 
 }
 
 set basename "inline-break"
-set testfile "dw2-$basename"
 
-if { [prepare_for_testing $testfile.exp $testfile $testfile.S {nodebug}] } {
+standard_testfile .S
+
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {nodebug}] } {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile dw2-inline-param
-set binfile ${objdir}/${subdir}/${testfile}
-if { [build_executable ${testfile}.exp "${testfile}" [list ${testfile}-main.c ${testfile}.S] {nodebug}] } {
+standard_testfile .S dw2-inline-param-main.c
+
+if { [prepare_for_testing ${testfile}.exp "${testfile}" \
+         [list $srcfile2 $srcfile] {nodebug}] } {
     return -1
 }
 
-clean_restart ${testfile}
-
 set break_at ""
 set test "info addr break_at"
 gdb_test_multiple $test $test {
 
     return 0  
 }
 
-set testfile "dw2-intercu"
+standard_testfile .S
 set dwarf_srcfile "file1.txt"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
     return 0  
 }
 
-set testfile "dw2-intermix"
+standard_testfile .S
 set dwarf_srcfile "file1.txt"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
     return 0  
 }
 
-set testfile "dw2-linkage-name-trust"
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 if { [gdb_compile ${srcdir}/${subdir}/${testfile}-main.cc "${objdir}/${subdir}/${testfile}-main.o" object {c++ debug}] != ""
      || [gdb_compile "${srcdir}/${subdir}/${testfile}.S" "${objdir}/${subdir}/${testfile}.o" object {}] != ""
      || [gdb_compile "${objdir}/${subdir}/${testfile}-main.o ${objdir}/${subdir}/${testfile}.o" "${binfile}" executable {c++}] != "" } {
 
     return 0  
 }
 
-set testfile "dw2-modula2-self-type"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .S
 
 # First try referencing DW_AT_frame_base which is not defined.
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
     return -1
 }
 
-clean_restart $executable
+clean_restart $testfile
 
 # C language would just naively print:
 # type = void (*)(void (*)(void (*)(void (*)(void (*)(...
 
     return 0  
 }
 
-set testfile "dw2-namespaceless-anonymous"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
+standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
+          object {nodebug}] != "" } {
     return -1
 }
 
-clean_restart $executable
+clean_restart $testfile
 
 gdb_test "ptype '(anonymous namespace)::v'" "type = myint"
 gdb_test "p '(anonymous namespace)::v'" " = 1"
 
     return 0  
 }
 
-set testfile "dw2-objfile-overlap"
+standard_testfile
+
 set srcfile_outer ${testfile}-outer.S
 set srcfile_inner ${testfile}-inner.S
 set executable_outer ${testfile}-outer.x
-set binfile_outer ${objdir}/${subdir}/${executable_outer}
-set binfile_inner ${objdir}/${subdir}/${testfile}-inner.x
+set binfile_outer ${binfile}-outer.x
+set binfile_inner ${binfile}-inner.x
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile_outer}" "${binfile_outer}" \
       object {}] != ""
 
     return 0   
 }
 
-set testfile "dw2-op-call"
-if { [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {nodebug}] } {
+standard_testfile .S main.c
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} \
+         [list $srcfile $srcfile2] {nodebug}] } {
     return -1
 }
 
 
     return 0   
 }
 
-set testfile "dw2-op-stack-value"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
+standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } {
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $binfile \
+          object {nodebug}] != "" } {
     return -1
 }
 
-clean_restart $executable
+clean_restart $testfile
 
 gdb_test "p/x stack2" " = 0x1"
 gdb_test "p/x stack8" " = 0x1"
 
     return 0  
 }
 
-set testfile dw2-param-error
-if { [prepare_for_testing ${testfile}.exp "${testfile}" "${testfile}-main.c ${testfile}.S" {nodebug}] } {
+standard_testfile .S dw2-param-error-main.c
+
+if { [prepare_for_testing ${testfile}.exp "${testfile}" \
+         [list $srcfile2 $srcfile] {nodebug}] } {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile "dw2-producer"
+standard_testfile .S
 set dwarf_srcfile "file1.txt"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
     return 0  
 }
 
-set testfile "dw2-ranges"
-set srcfile ${testfile}.c
-set srcfile2 ${testfile}2.c
-set srcfile3 ${testfile}3.c
-set asmfile ${objdir}/${subdir}/${testfile}.s
-set asmfile2 ${objdir}/${subdir}/${testfile}2.s
-set asmfile3 ${objdir}/${subdir}/${testfile}3.s
-set objfile ${objdir}/${subdir}/${testfile}.o
-set objfile2 ${objdir}/${subdir}/${testfile}2.o
-set objfile3 ${objdir}/${subdir}/${testfile}3.o
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile dw2-ranges.c dw2-ranges2.c dw2-ranges3.c
+set asmfile [standard_output_file ${testfile}.s]
+set asmfile2 [standard_output_file ${testfile}2.s]
+set asmfile3 [standard_output_file ${testfile}3.s]
+set objfile [standard_output_file ${testfile}.o]
+set objfile2 [standard_output_file ${testfile}2.o]
+set objfile3 [standard_output_file ${testfile}3.o]
 
 # Generate .s without debug info but provide debug info by the assembler.
 # This way we get DW_TAG_compile_unit DIE and only that DIE.
 
     return 0  
 }
 
-set testfile "dw2-ref-missing-frame"
-set srcsfile ${testfile}.S
-set objsfile ${objdir}/${subdir}/${testfile}.o
+standard_testfile .S
+set objsfile [standard_output_file ${testfile}.o]
 set srcfuncfile ${testfile}-func.c
-set objfuncfile ${objdir}/${subdir}/${testfile}-func.o
+set objfuncfile [standard_output_file ${testfile}-func.o]
 set srcmainfile ${testfile}-main.c
-set objmainfile ${objdir}/${subdir}/${testfile}-main.o
+set objmainfile [standard_output_file ${testfile}-main.o]
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
-if { [gdb_compile "${srcdir}/${subdir}/${srcsfile}" $objsfile object {}] != ""
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $objsfile object {}] != ""
      || [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" $objfuncfile object {}] != ""
      || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" $objmainfile object {debug}] != ""
      || [gdb_compile "$objsfile $objfuncfile $objmainfile" $binfile executable {}] != "" } {
 
 if {![istarget x86_64-*] || ![is_lp64_target]} {
     return 0  
 }
-set testfile "dw2-restore"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
+standard_testfile .S
 
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
        [list {additional_flags=-nostdlib}]] != "" } {
 
     return 0  
 }
 
-set testfile "dw2-simple-locdesc"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .S
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
     return -1
 }
 
-clean_restart $executable
+clean_restart $testfile
 
 # Re: [patch 2/2] Fix decode_locdesc for gcc-4.7.x optimized DWARF
 # http://sourceware.org/ml/gdb-patches/2011-07/msg00766.html
 
     return 0  
 }
 
-set testfile "dw2-skip-prologue"
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if {[build_executable ${testfile}.exp ${executable} "${testfile}.c ${testfile}.S" {additional_flags=-DINLINED}] == -1} {
     return -1
 
     return 0  
 }
 
-set testfile "dw2-stack-boundary"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .S
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
     return -1
 
     return 0
 }
 
-set testfile "dw2-strp"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
+standard_testfile .S
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
     return 0  
 }
 
-set testfile dw2-var-zero-addr
-if [prepare_for_testing ${testfile}.exp ${testfile} [list ${testfile}.S main.c] {nodebug}] {
+standard_testfile .S main.c
+
+if [prepare_for_testing ${testfile}.exp ${testfile} \
+       [list $srcfile $srcfile2] {nodebug}] {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile "dw4-sig-type-unused"
-set srcfile ${testfile}.S
-set executable ${testfile}.x
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .S
+set executable ${testfile}
 
 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {}] != "" } {
     return -1
 
 
 # Test dwarf4 signatured types.
 
-set test "dw4-sig-types"
-set executable ${test}.x
+standard_testfile .cc dw4-sig-types-b.cc
 
 # This test is intended for targets which support DWARF-4.
 # Since we pass an explicit -gdwarf-4 to the compiler, we let
 # that be the test of whether the target supports it.
 
-if { [prepare_for_testing "${test}.exp" "${executable}" \
-       {dw4-sig-types.cc dw4-sig-types-b.cc} \
-       {debug c++ additional_flags=-gdwarf-4}] } {
+if { [prepare_for_testing "${test}.exp" "${testfile}" \
+         [list $srcfile $srcfile2] \
+         {debug c++ additional_flags=-gdwarf-4}] } {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile "implptr-64bit"
-set srcfile ${testfile}.S
+standard_testfile .S
 set mainfile main.c
 
 proc test { dwarf_version offset_size addr_size ref_addr_size } {
 
     return 0  
 }
 
-set testfile "implptr-optimized-out"
-set srcfile ${testfile}.S
+standard_testfile .S
 set mainfile main.c
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if [prepare_for_testing ${testfile}.exp $executable "${srcfile} ${mainfile}" {}] {
     return -1
 
     return 0  
 }
 
-set testfile "implptr"
-set srcfile ${testfile}.S
+standard_testfile .S
 set csrcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}.x
 set opts {}
 
 if [info exists COMPILE] {
     return 0  
 }
 
-if {[prepare_for_testing ${testfile}.exp ${testfile}.x $srcfile $opts]} {
+if {[prepare_for_testing ${testfile}.exp ${testfile} $srcfile $opts]} {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile "mac-fileno"
+standard_testfile .S
 set dwarf_srcfile "file1.txt"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
 
 if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
     return -1
 
 
 if { [skip_cplus_tests] } { continue }
 
-set testfile member-ptr-forwardref
-set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}.x
+standard_testfile .S
 
-if { [gdb_compile "${srcdir}/${subdir}/${testfile}.S" ${binfile} object {debug}] != "" } {
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} object {debug}] != "" } {
     untested ${testfile}.exp
     return -1
 }
 
     return 0  
 }
 
-set testfile "pieces"
-set srcfile ${testfile}.S
+standard_testfile .S
 set csrcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}.x
 
-if {[prepare_for_testing ${testfile}.exp ${testfile}.x $srcfile]} {
+if {[prepare_for_testing ${testfile}.exp ${testfile} $srcfile]} {
     return -1
 }
 
 
 
 # Test DW_OP_call_frame_cfa.
 
-set testfile "pr10770"
-set srcfile ${testfile}.c
+standard_testfile
 
 if {[prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}]} {
     return 0
 
     return 0  
 }
 
-set testfile "pr11465"
-set srcfile "$testfile.S"
-set executable "$testfile.x"
-set binfile [file join $objdir $subdir $executable]
+standard_testfile .S
 
 if [is_ilp32_target] {
     set ptrbits 32
     return -1
 }
 
-clean_restart $executable
+clean_restart $testfile
 
 # Test delayed physname computations
 gdb_test "p N::c.C" { = {void \(N::C \* const, void \(\*\)\(N::C\)\)}.*}
 
     return 0
 }
 
-set testfile "pr13961"
-set srcfile ${testfile}.S
-set binfile ${testfile}.x
+standard_testfile .S
 
-if { [prepare_for_testing ${testfile}.exp ${binfile} ${srcfile}] == -1 } {
+if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
     return -1
 }
 
 
     return 0  
 }
 
-set testfile "valop"
-set srcfile ${testfile}.S
-set binfile ${objdir}/${subdir}/${testfile}.x
+standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
-       [list {additional_flags=-nostdlib}]] != "" } {
+if {[prepare_for_testing $testfile.exp $testfile \
+        [list $srcfile] [list {additional_flags=-nostdlib}]]} {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 if ![runto_main] {
     return -1
 }