diff options
author | Tom Tromey <tromey@redhat.com> | 2013-06-27 18:51:30 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-06-27 18:51:30 +0000 |
commit | 27a1409b68c04bf47488cefc802ba1c9d0e967d8 (patch) | |
tree | 62e7c7cf51a03da7b2a74554d7664ca078c327aa | |
parent | 491eba65936da9740856a11dc5facebf6842c07a (diff) | |
download | gdb-27a1409b68c04bf47488cefc802ba1c9d0e967d8.tar.gz |
test suite update - gdb.base/[h-m]
Convert files gdb.base/[h-m]*.exp to use standard_output_file et al.
* hook-stop-continue.exp, hook-stop-frame.exp, huge.exp,
included.exp, inferior-died.exp, infnan.exp, info-fun.exp,
info-macros.exp, info-os.exp, info-proc.exp, info-target.exp,
infoline.exp, interp.exp, interrupt.exp, jit-simple.exp,
jit-so.exp, jump.exp, kill-after-signal.exp, label.exp, langs.exp,
lineinc.exp, list.exp, logical.exp, long_long.exp, longjmp.exp,
macscp.exp, maint.exp, memattr.exp, mips_pro.exp, miscexprs.exp,
morestack.exp, moribund-step.exp, multi-forks.exp: Use
standard_testfile, standard_output_file, prepare_for_testing,
clean_restart.
34 files changed, 131 insertions, 282 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index d151696e0c9..7bf1fc76242 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,18 @@ 2013-06-27 Tom Tromey <tromey@redhat.com> + * hook-stop-continue.exp, hook-stop-frame.exp, huge.exp, + included.exp, inferior-died.exp, infnan.exp, info-fun.exp, + info-macros.exp, info-os.exp, info-proc.exp, info-target.exp, + infoline.exp, interp.exp, interrupt.exp, jit-simple.exp, + jit-so.exp, jump.exp, kill-after-signal.exp, label.exp, langs.exp, + lineinc.exp, list.exp, logical.exp, long_long.exp, longjmp.exp, + macscp.exp, maint.exp, memattr.exp, mips_pro.exp, miscexprs.exp, + morestack.exp, moribund-step.exp, multi-forks.exp: Use + standard_testfile, standard_output_file, prepare_for_testing, + clean_restart. + +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, diff --git a/gdb/testsuite/gdb.base/hook-stop-continue.exp b/gdb/testsuite/gdb.base/hook-stop-continue.exp index 7455da95d60..26f2cf998e8 100644 --- a/gdb/testsuite/gdb.base/hook-stop-continue.exp +++ b/gdb/testsuite/gdb.base/hook-stop-continue.exp @@ -13,19 +13,12 @@ # 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 "hook-stop-continue" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c if { [prepare_for_testing ${testfile}.exp "${testfile}" "${testfile}.c" {debug nowarnings}] } { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - if ![runto_main] then { perror "Couldn't run to main" } diff --git a/gdb/testsuite/gdb.base/hook-stop-frame.exp b/gdb/testsuite/gdb.base/hook-stop-frame.exp index 7f11b6e1c4d..ce7ece40ce8 100644 --- a/gdb/testsuite/gdb.base/hook-stop-frame.exp +++ b/gdb/testsuite/gdb.base/hook-stop-frame.exp @@ -13,19 +13,12 @@ # 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 "hook-stop-frame" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile -if { [prepare_for_testing ${testfile}.exp "${testfile}" "${testfile}.c" {debug nowarnings}] } { +if { [prepare_for_testing ${testfile}.exp "${testfile}" $srcfile {debug nowarnings}] } { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - if ![runto_main] then { perror "Couldn't run to main" } diff --git a/gdb/testsuite/gdb.base/huge.exp b/gdb/testsuite/gdb.base/huge.exp index f955c37a5c8..4504d105943 100644 --- a/gdb/testsuite/gdb.base/huge.exp +++ b/gdb/testsuite/gdb.base/huge.exp @@ -23,9 +23,7 @@ if [target_info exists gdb,skip_huge_test] { return } -set testfile "huge" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c for { set size [expr 2 * 1024 * 1024] } { $size > 10 } { set size [expr $size / 2] } { if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ @@ -39,10 +37,7 @@ if { $size < 10 } { # Start with a fresh gdb. -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart ${binfile} set prev_timeout $timeout set timeout 30 diff --git a/gdb/testsuite/gdb.base/included.exp b/gdb/testsuite/gdb.base/included.exp index 45c49d42b61..26e0cfe967a 100644 --- a/gdb/testsuite/gdb.base/included.exp +++ b/gdb/testsuite/gdb.base/included.exp @@ -13,20 +13,12 @@ # 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 "included" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested included.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} - gdb_test_no_output "set listsize 1" gdb_test "list main" ".*" diff --git a/gdb/testsuite/gdb.base/inferior-died.exp b/gdb/testsuite/gdb.base/inferior-died.exp index 8c3b33a82ac..b974f333dd8 100644 --- a/gdb/testsuite/gdb.base/inferior-died.exp +++ b/gdb/testsuite/gdb.base/inferior-died.exp @@ -31,9 +31,7 @@ if { ![support_displaced_stepping] } { return -1 } -set testfile "inferior-died" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c] } { return -1 diff --git a/gdb/testsuite/gdb.base/infnan.exp b/gdb/testsuite/gdb.base/infnan.exp index c70a7b4bc10..8c264e25860 100644 --- a/gdb/testsuite/gdb.base/infnan.exp +++ b/gdb/testsuite/gdb.base/infnan.exp @@ -15,20 +15,13 @@ # Script to test floating point infinities and NaNs. -set testfile "infnan" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested infnan.exp +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} - runto_main gdb_test "print a" "\\\$$decimal = inf" diff --git a/gdb/testsuite/gdb.base/info-fun.exp b/gdb/testsuite/gdb.base/info-fun.exp index f149efc3a52..b49611f716a 100644 --- a/gdb/testsuite/gdb.base/info-fun.exp +++ b/gdb/testsuite/gdb.base/info-fun.exp @@ -19,13 +19,11 @@ if { [skip_shlib_tests] || [is_remote target] } { # Library file. set libname "info-fun-solib" 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 "info-fun" -set srcfile ${srcdir}/${subdir}/${testfile}.c +standard_testfile .c set executable ${testfile} -set binfile ${objdir}/${subdir}/${executable} set bin_flags [list debug shlib=${binfile_lib}] if [get_compiler_info] { @@ -40,7 +38,8 @@ foreach libsepdebug {NO IN SEP} { with_test_prefix "$libsepdebug" { lappend sep_lib_flags {debug} } if { [gdb_compile_shlib ${srcfile_lib} ${binfile_lib} $sep_lib_flags] != "" - || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } { + || [gdb_compile $srcdir/$subdir/${srcfile} ${binfile} \ + executable $bin_flags] != "" } { untested "Could not compile $binfile_lib or $binfile." return -1 } diff --git a/gdb/testsuite/gdb.base/info-macros.exp b/gdb/testsuite/gdb.base/info-macros.exp index 98f177cdcbc..ed750c1eec5 100644 --- a/gdb/testsuite/gdb.base/info-macros.exp +++ b/gdb/testsuite/gdb.base/info-macros.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 "info-macros" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c get_compiler_info if ![test_compiler_info gcc*] { diff --git a/gdb/testsuite/gdb.base/info-os.exp b/gdb/testsuite/gdb.base/info-os.exp index 5ebc16f5d13..e527328f282 100644 --- a/gdb/testsuite/gdb.base/info-os.exp +++ b/gdb/testsuite/gdb.base/info-os.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 "info-os" -set srcfile ${testfile}.c +standard_testfile .c # This test is Linux-only. if ![istarget *-*-linux*] then { diff --git a/gdb/testsuite/gdb.base/info-proc.exp b/gdb/testsuite/gdb.base/info-proc.exp index 6db6975a95f..b6b26a29772 100644 --- a/gdb/testsuite/gdb.base/info-proc.exp +++ b/gdb/testsuite/gdb.base/info-proc.exp @@ -18,33 +18,14 @@ set ws "\[ \t\]+" -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 info-proc.exp - return -1 -} - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } { - untested info-proc.exp - return -1 -} - -if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } { - untested info-proc.exp - return -1 +if {[prepare_for_testing $testfile.exp $testfile \ + [list $srcfile $srcfile2] {debug nowarnings}]} { + untested $testfile.exp + return -1 } -# Start with a fresh gdb. - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - gdb_test "help info proc" "Show /proc process information about .*" gdb_test_multiple "info proc" "info proc without a process" { diff --git a/gdb/testsuite/gdb.base/info-target.exp b/gdb/testsuite/gdb.base/info-target.exp index fb6862286ff..08c4224a7e5 100644 --- a/gdb/testsuite/gdb.base/info-target.exp +++ b/gdb/testsuite/gdb.base/info-target.exp @@ -14,8 +14,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -set testfile info-target -if { [prepare_for_testing ${testfile}.exp $testfile start.c] } { +standard_testfile start.c + +if { [prepare_for_testing ${testfile}.exp $testfile $srcfile] } { return -1 } diff --git a/gdb/testsuite/gdb.base/infoline.exp b/gdb/testsuite/gdb.base/infoline.exp index 225115831ca..9fb2f53d80a 100644 --- a/gdb/testsuite/gdb.base/infoline.exp +++ b/gdb/testsuite/gdb.base/infoline.exp @@ -13,15 +13,12 @@ # 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 infoline -set srcfile ${testfile}.c +standard_testfile if { [prepare_for_testing ${testfile}.exp ${testfile}] } { return -1 } -clean_restart ${testfile} - # Verify that the "info line" command does not skip function prologues. # If it did, GDB would tell us that the line we're interested in starts # at <twice+N> where N is different from zero. diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp index 0b5df5c520a..7e5ca3c9520 100644 --- a/gdb/testsuite/gdb.base/interp.exp +++ b/gdb/testsuite/gdb.base/interp.exp @@ -15,9 +15,9 @@ # interp.exp Test interpreter-exec command -set testfile "interp" +standard_testfile -if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c {debug}] } { +if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {debug}] } { return -1 } diff --git a/gdb/testsuite/gdb.base/interrupt.exp b/gdb/testsuite/gdb.base/interrupt.exp index 73194108f23..1456f335635 100644 --- a/gdb/testsuite/gdb.base/interrupt.exp +++ b/gdb/testsuite/gdb.base/interrupt.exp @@ -24,18 +24,16 @@ if [target_info exists gdb,noinferiorio] { } -set testfile interrupt -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile set options { debug } if { ! [target_info exists gdb,nosignals] } { lappend options "additional_flags=-DSIGNALS" } -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options] != "" } { - untested interrupt.exp - return -1 +if {[build_executable $testfile.exp $testfile $srcfile $options] == -1} { + untested $testfile.exp + return -1 } gdb_start diff --git a/gdb/testsuite/gdb.base/jit-simple.exp b/gdb/testsuite/gdb.base/jit-simple.exp index 9f5910b1fc4..a4974903e8f 100644 --- a/gdb/testsuite/gdb.base/jit-simple.exp +++ b/gdb/testsuite/gdb.base/jit-simple.exp @@ -28,10 +28,9 @@ if {[get_compiler_info]} { # test running programs # -set testfile jit-simple -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { +standard_testfile + +if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { untested jit-simple.exp return -1 } diff --git a/gdb/testsuite/gdb.base/jit-so.exp b/gdb/testsuite/gdb.base/jit-so.exp index e3a37283ee7..70f2a7d3a3b 100644 --- a/gdb/testsuite/gdb.base/jit-so.exp +++ b/gdb/testsuite/gdb.base/jit-so.exp @@ -33,7 +33,7 @@ if {[get_compiler_info]} { set testfile jit-dlmain set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +set binfile [standard_output_file ${testfile}] if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug shlib_load}] != "" } { untested jit-so.exp return -1 @@ -41,7 +41,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb set testfile2 jit-main set srcfile2 ${testfile2}.c -set binfile2 ${objdir}/${subdir}/${testfile2}.so +set binfile2 [standard_output_file ${testfile2}.so] set binfile2_dlopen [shlib_target_file ${testfile2}.so] if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug additional_flags="-DMAIN=jit_dl_main"}] != "" } { untested jit.exp @@ -50,7 +50,7 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug add set solib_testfile "jit-solib" set solib_srcfile "${srcdir}/${subdir}/${solib_testfile}.c" -set solib_binfile "${objdir}/${subdir}/${solib_testfile}.so" +set solib_binfile [standard_output_file ${solib_testfile}.so] set solib_binfile_test_msg "SHLIBDIR/${solib_testfile}.so" # Note: compiling without debug info: the library goes through symbol diff --git a/gdb/testsuite/gdb.base/jump.exp b/gdb/testsuite/gdb.base/jump.exp index 73d1ddae217..a8f93f947f6 100644 --- a/gdb/testsuite/gdb.base/jump.exp +++ b/gdb/testsuite/gdb.base/jump.exp @@ -16,9 +16,7 @@ clear_xfail "*-*-*" -set testfile "jump" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c # Build the test case if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { @@ -29,10 +27,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} if ![runto_main] then { perror "Couldn't run to main" diff --git a/gdb/testsuite/gdb.base/kill-after-signal.exp b/gdb/testsuite/gdb.base/kill-after-signal.exp index 3b590775549..80e1ec029dd 100644 --- a/gdb/testsuite/gdb.base/kill-after-signal.exp +++ b/gdb/testsuite/gdb.base/kill-after-signal.exp @@ -13,7 +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 "kill-after-signal" +standard_testfile .c if { ![can_single_step_to_signal_handler] } { untested ${testfile}.exp diff --git a/gdb/testsuite/gdb.base/label.exp b/gdb/testsuite/gdb.base/label.exp index ac9193bf87f..4122609b91d 100644 --- a/gdb/testsuite/gdb.base/label.exp +++ b/gdb/testsuite/gdb.base/label.exp @@ -23,11 +23,9 @@ if [is_remote target] then { # test running programs # -set testfile "label" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c -if { [prepare_for_testing ${testfile}.exp $testfile ${testfile}.c debug] } { +if { [prepare_for_testing ${testfile}.exp $testfile ${srcfile} debug] } { untested label.exp return -1 } diff --git a/gdb/testsuite/gdb.base/langs.exp b/gdb/testsuite/gdb.base/langs.exp index cbb0e31a84f..b2cb52baa13 100644 --- a/gdb/testsuite/gdb.base/langs.exp +++ b/gdb/testsuite/gdb.base/langs.exp @@ -14,8 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -set testfile langs -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile langs0.c langs1.c langs2.c if [is_remote host] { remote_download host ${srcdir}/${subdir}/langs1.f @@ -23,24 +22,9 @@ if [is_remote host] { } -if { [gdb_compile "${srcdir}/${subdir}/langs0.c" "${binfile}0.o" object {debug}] != "" } { - untested langs.exp - return -1 -} - -if { [gdb_compile "${srcdir}/${subdir}/langs1.c" "${binfile}1.o" object {debug}] != "" } { - untested langs.exp - return -1 -} - -if { [gdb_compile "${srcdir}/${subdir}/langs2.c" "${binfile}2.o" object {debug}] != "" } { - untested langs.exp - return -1 -} - -if { [gdb_compile "${binfile}0.o ${binfile}1.o ${binfile}2.o" ${binfile} executable {debug}] != "" } { - untested langs.exp - return -1 +if {[prepare_for_testing ${testfile}.exp ${testfile} \ + [list $srcfile $srcfile2 $srcfile3] {debug}]} { + return -1 } set oldtimeout $timeout @@ -54,11 +38,6 @@ if [get_compiler_info] { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load $binfile - gdb_test_multiple "b langs0" "break on nonexistent function in langs.exp" { -re "Function \"langs0\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" { diff --git a/gdb/testsuite/gdb.base/lineinc.exp b/gdb/testsuite/gdb.base/lineinc.exp index f3b9ef0aeb8..aa9d27b1f2f 100644 --- a/gdb/testsuite/gdb.base/lineinc.exp +++ b/gdb/testsuite/gdb.base/lineinc.exp @@ -78,19 +78,14 @@ # read the above debugging info. -set testfile "lineinc" -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c - -if {[gdb_compile "${srcdir}/${subdir}/${testfile}.c" ${binfile} executable {debug}] != ""} { +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" ${binfile} executable {debug}] != ""} { untested lineinc.exp return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart ${binfile} # Any command that causes GDB to read the debugging info for the # lineinc.c compilation unit will do here. diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index 11aafd95e2e..62504d1f540 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -16,30 +16,16 @@ # This file was written by Fred Fish. (fnf@cygnus.com) -set testfile "list" -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile list0.c list1.c # Need to download the header to the host. remote_download host ${srcdir}/${subdir}/list0.h list0.h - -if { [gdb_compile "${srcdir}/${subdir}/list0.c" "${binfile}0.o" object {debug}] != "" } { - untested list.exp - return -1 -} - -if { [gdb_compile "${srcdir}/${subdir}/list1.c" "${binfile}1.o" object {debug}] != "" } { - untested list.exp - return -1 -} - -if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } { - untested list.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 # used to compile the test case. if [get_compiler_info] { diff --git a/gdb/testsuite/gdb.base/logical.exp b/gdb/testsuite/gdb.base/logical.exp index e228c08ef1f..1c9ecd4b241 100644 --- a/gdb/testsuite/gdb.base/logical.exp +++ b/gdb/testsuite/gdb.base/logical.exp @@ -25,9 +25,7 @@ # test running programs # -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 logical.exp @@ -38,10 +36,7 @@ if [get_compiler_info] { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart ${binfile} # diff --git a/gdb/testsuite/gdb.base/long_long.exp b/gdb/testsuite/gdb.base/long_long.exp index 38df8636922..dcd115e7320 100644 --- a/gdb/testsuite/gdb.base/long_long.exp +++ b/gdb/testsuite/gdb.base/long_long.exp @@ -22,9 +22,7 @@ if [target_info exists no_long_long] { return 0 } -set testfile long_long -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c # What compiler are we using? # @@ -46,10 +44,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [con # use this to debug: #log_user 1 -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart ${binfile} if { ![runto known_types] } then { fail "run to known_types" diff --git a/gdb/testsuite/gdb.base/longjmp.exp b/gdb/testsuite/gdb.base/longjmp.exp index 9609fc63c11..7af3a233f60 100644 --- a/gdb/testsuite/gdb.base/longjmp.exp +++ b/gdb/testsuite/gdb.base/longjmp.exp @@ -18,9 +18,7 @@ # -set testfile "longjmp" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } { untested longjmp.exp @@ -31,10 +29,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 { fail "Can't run to main" diff --git a/gdb/testsuite/gdb.base/macscp.exp b/gdb/testsuite/gdb.base/macscp.exp index ab48c51a2a2..7c25eed3231 100644 --- a/gdb/testsuite/gdb.base/macscp.exp +++ b/gdb/testsuite/gdb.base/macscp.exp @@ -15,10 +15,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -set srcfile macscp1.c -set testfile "macscp" -set objfile ${objdir}/${subdir}/${testfile}.o -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile macscp1.c +set objfile [standard_output_file ${testfile}.o] set options { debug additional_flags=-DFROM_COMMANDLINE=ARG} @@ -36,10 +34,7 @@ if {[gdb_compile "${srcdir}/${subdir}/macscp1.c" "${objfile}" \ return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart ${binfile} # Ask GDB to show the current definition of MACRO, and return a list diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index afc321f1888..7057ac7f567 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -47,31 +47,14 @@ -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 maint.exp - return -1 -} - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } { - untested maint.exp - return -1 -} +standard_testfile break.c break1.c -if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } { - untested maint.exp - return -1 +if {[prepare_for_testing $testfile.exp $testfile \ + [list $srcfile $srcfile2] {debug nowarnings}]} { + untested $testfile.exp + return -1 } - -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir - # The commands we test here produce many lines of output; disable "press # <return> to continue" prompts. gdb_test_no_output "set height 0" @@ -168,7 +151,7 @@ if [istarget "*-*-cygwin*"] { send_gdb "maint print statistics\n" gdb_expect { - -re "Statistics for\[^\n\r\]*break\[^\n\r\]*:\r\n Number of \"minimal\" symbols read: $decimal\r\n( Number of \"partial\" symbols read: $decimal\r\n)? Number of \"full\" symbols read: $decimal\r\n Number of \"types\" defined: $decimal\r\n( Number of psym tables \\(not yet expanded\\): $decimal\r\n)?( Number of read CUs: $decimal\r\n Number of unread CUs: $decimal\r\n)? Number of symbol tables: $decimal\r\n Number of symbol tables with line tables: $decimal\r\n Number of symbol tables with blockvectors: $decimal\r\n Total memory used for objfile obstack: $decimal\r\n Total memory used for BFD obstack: $decimal\r\n Total memory used for psymbol cache: $decimal\r\n Total memory used for macro cache: $decimal\r\n Total memory used for file name cache: $decimal\r\n" { + -re "Statistics for\[^\n\r\]*maint\[^\n\r\]*:\r\n Number of \"minimal\" symbols read: $decimal\r\n( Number of \"partial\" symbols read: $decimal\r\n)? Number of \"full\" symbols read: $decimal\r\n Number of \"types\" defined: $decimal\r\n( Number of psym tables \\(not yet expanded\\): $decimal\r\n)?( Number of read CUs: $decimal\r\n Number of unread CUs: $decimal\r\n)? Number of symbol tables: $decimal\r\n Number of symbol tables with line tables: $decimal\r\n Number of symbol tables with blockvectors: $decimal\r\n Total memory used for objfile obstack: $decimal\r\n Total memory used for BFD obstack: $decimal\r\n Total memory used for psymbol cache: $decimal\r\n Total memory used for macro cache: $decimal\r\n Total memory used for file name cache: $decimal\r\n" { gdb_expect { -re "$gdb_prompt $" { pass "maint print statistics" @@ -197,7 +180,7 @@ set keep_looking 1 while {$keep_looking} { gdb_expect { - -re ".*Object file.*break($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 } + -re ".*Object file.*maint($EXEEXT)?: Objfile at $hex, bfd at $hex, \[0-9\]* minsyms\[\r\t \]+\n" { set header 1 } -re ".*Psymtabs:\[\r\t \]+\n" { set psymtabs 1 } -re ".*Symtabs:\[\r\t \]+\n" { set symtabs 1 } @@ -226,18 +209,19 @@ gdb_test "maint print psymbols" \ "maint print psymbols w/o args" if { ! $have_gdb_index } { - send_gdb "maint print psymbols psymbols_output ${srcdir}/${subdir}/${srcfile}\n" + set psymbols_output [standard_output_file psymbols_output] + send_gdb "maint print psymbols $psymbols_output ${srcdir}/${subdir}/${srcfile}\n" gdb_expect { - -re "^maint print psymbols psymbols_output \[^\n\]*\r\n$gdb_prompt $" { - send_gdb "shell ls psymbols_output\n" + -re "^maint print psymbols $psymbols_output \[^\n\]*\r\n$gdb_prompt $" { + send_gdb "shell ls $psymbols_output\n" gdb_expect { - -re "psymbols_output\r\n$gdb_prompt $" { + -re "$psymbols_output\r\n$gdb_prompt $" { # We want this grep to be as specific as possible, # so it's less likely to match symbol file names in # psymbols_output. Yes, this actually happened; # poor expect got tons of output, and timed out # trying to match it. --- Jim Blandy <jimb@cygnus.com> - send_gdb "shell grep 'main.*function' psymbols_output\n" + send_gdb "shell grep 'main.*function' $psymbols_output\n" gdb_expect { -re ".main., function, $hex.*$gdb_prompt $" { pass "maint print psymbols 1" @@ -248,7 +232,8 @@ if { ! $have_gdb_index } { -re ".*$gdb_prompt $" { fail "maint print psymbols" } timeout { fail "(timeout) maint print psymbols" } } - gdb_test "shell rm -f psymbols_output" ".*" + gdb_test "shell rm -f $psymbols_output" ".*" \ + "shell rm -f psymbols_output" } -re ".*$gdb_prompt $" { fail "maint print psymbols" } timeout { fail "(timeout) maint print psymbols" } @@ -264,13 +249,14 @@ gdb_test "maint print msymbols" \ "maint print msymbols w/o args" -send_gdb "maint print msymbols msymbols_output ${binfile}\n" +set msymbols_output [standard_output_file msymbols_output] +send_gdb "maint print msymbols $msymbols_output ${binfile}\n" gdb_expect { - -re "^maint print msymbols msymbols_output \[^\n\]*\r\n$gdb_prompt $" { - send_gdb "shell ls msymbols_output\n" + -re "^maint print msymbols $msymbols_output \[^\n\]*\r\n$gdb_prompt $" { + send_gdb "shell ls $msymbols_output\n" gdb_expect { - -re "msymbols_output\r\n$gdb_prompt $" { - send_gdb "shell grep factorial msymbols_output\n" + -re "$msymbols_output\r\n$gdb_prompt $" { + send_gdb "shell grep factorial $msymbols_output\n" gdb_expect { -re "\\\[ *$decimal\\\] \[tT\]\[ \t\]+$hex \\.?factorial.*$gdb_prompt $" { pass "maint print msymbols" @@ -278,7 +264,8 @@ gdb_expect { -re ".*$gdb_prompt $" { fail "maint print msymbols" } timeout { fail "(timeout) maint print msymbols" } } - gdb_test "shell rm -f msymbols_output" ".*" + gdb_test "shell rm -f $msymbols_output" ".*" \ + "shell rm -f msymbols_output" } -re ".*$gdb_prompt $" { fail "maint print msymbols" } timeout { fail "(timeout) maint print msymbols" } @@ -309,7 +296,8 @@ gdb_test_multiple "maint print msymbols msymbols_output2 ${subdir}/${testfile}" fail "(timeout) maint print msymbols" } } - gdb_test "shell rm -f msymbols_output2" ".*" + gdb_test "shell rm -f msymbols_output2" ".*" \ + "shell rm -f msymbols_output2" } -re ".*$gdb_prompt $" { fail "maint print msymbols" @@ -339,14 +327,15 @@ gdb_test "maint print symbols" \ # dump the symbol information for the entire C library - over 500MB nowadays # for GNU libc. -send_gdb "maint print symbols symbols_output ${srcdir}/${subdir}/${srcfile}\n" +set symbols_output [standard_output_file symbols_output] +send_gdb "maint print symbols $symbols_output ${srcdir}/${subdir}/${srcfile}\n" gdb_expect { - -re "^maint print symbols symbols_output \[^\n\]*\r\n$gdb_prompt $" { - send_gdb "shell ls symbols_output\n" + -re "^maint print symbols $symbols_output \[^\n\]*\r\n$gdb_prompt $" { + send_gdb "shell ls $symbols_output\n" gdb_expect { - -re "symbols_output\r\n$gdb_prompt $" { + -re "$symbols_output\r\n$gdb_prompt $" { # See comments for `maint print psymbols'. - send_gdb "shell grep 'main(.*block' symbols_output\n" + send_gdb "shell grep 'main(.*block' $symbols_output\n" gdb_expect { -re "int main\\(int, char \\*\\*, char \\*\\*\\); block.*$gdb_prompt $" { pass "maint print symbols" @@ -354,7 +343,8 @@ gdb_expect { -re ".*$gdb_prompt $" { fail "maint print symbols" } timeout { fail "(timeout) maint print symbols" } } - gdb_test "shell rm -f symbols_output" ".*" + gdb_test "shell rm -f $symbols_output" ".*" \ + "shell rm -f symbols_output" } -re ".*$gdb_prompt $" { fail "maint print symbols" } timeout { fail "(timeout) maint print symbols" } @@ -401,18 +391,18 @@ set text_section ".text" set data_section ".data" gdb_test_multiple "maint info sections" "maint info sections" { - -re "Exec file:\r\n.*break($EXEEXT)?., file type.*ER_RO.*$gdb_prompt $" { + -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*ER_RO.*$gdb_prompt $" { # Looks like RealView which uses different section names. set text_section ER_RO set data_section ER_RW pass "maint info sections" } - -re "Exec file:\r\n.*break($EXEEXT)?., file type.*neardata.*$gdb_prompt $" { + -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*neardata.*$gdb_prompt $" { # c6x doesn't have .data section. It has .neardata and .fardata section. set data_section ".neardata" pass "maint info sections" } - -re "Exec file:\r\n.*break($EXEEXT)?., file type.*$gdb_prompt $" { + -re "Exec file:\r\n.*maint($EXEEXT)?., file type.*$gdb_prompt $" { pass "maint info sections" } } diff --git a/gdb/testsuite/gdb.base/memattr.exp b/gdb/testsuite/gdb.base/memattr.exp index 69f2ad42895..455bea55ff5 100644 --- a/gdb/testsuite/gdb.base/memattr.exp +++ b/gdb/testsuite/gdb.base/memattr.exp @@ -17,8 +17,7 @@ # Test the memory attribute commands. -set testfile "memattr" -set srcfile ${testfile}.c +standard_testfile .c if { [prepare_for_testing $testfile.exp $testfile $srcfile] } { return -1 diff --git a/gdb/testsuite/gdb.base/mips_pro.exp b/gdb/testsuite/gdb.base/mips_pro.exp index 2c8e9967a90..72e198142c8 100644 --- a/gdb/testsuite/gdb.base/mips_pro.exp +++ b/gdb/testsuite/gdb.base/mips_pro.exp @@ -14,9 +14,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. -set testfile mips_pro -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile # Create and source the file that provides information about the compiler # used to compile the test case. @@ -27,23 +25,15 @@ if [get_compiler_info] { # This test must be compiled with -O2 if using gcc. +set options debug if { [test_compiler_info gcc-*-*] } then { - if { [gdb_compile "${srcdir}/$subdir/${srcfile}" "${binfile}" \ - executable {debug additional_flags=-O2 additional_flags=-fno-inline}] != "" } { - untested mips_pro.exp - return -1 - } -} else { - if { [gdb_compile "${srcdir}/$subdir/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested mips_pro.exp - return -1 - } + lappend options additional_flags=-O2 additional_flags=-fno-inline } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +if {[prepare_for_testing $testfile.exp $testfile $srcfile $options]} { + untested $testfile.exp + return -1 +} if [runto middle] then { # PR 3016 diff --git a/gdb/testsuite/gdb.base/miscexprs.exp b/gdb/testsuite/gdb.base/miscexprs.exp index 22f9e9c45bc..aa84950a866 100644 --- a/gdb/testsuite/gdb.base/miscexprs.exp +++ b/gdb/testsuite/gdb.base/miscexprs.exp @@ -37,9 +37,7 @@ set additional_flags "additional_flags=${storage}" # test running programs # -set testfile "miscexprs" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug ${additional_flags} nowarnings]] != "" } { untested miscexprs.exp @@ -50,10 +48,7 @@ if [get_compiler_info] { return -1 } -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart ${binfile} # diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp index 56a52b13eec..3fd5f20e7ba 100644 --- a/gdb/testsuite/gdb.base/morestack.exp +++ b/gdb/testsuite/gdb.base/morestack.exp @@ -21,8 +21,9 @@ if {$gcc_compiled == 0} { return -1 } -set testfile morestack -if { [prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c {additional_flags=-fsplit-stack}] } { +standard_testfile + +if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {additional_flags=-fsplit-stack}] } { return -1 } diff --git a/gdb/testsuite/gdb.base/moribund-step.exp b/gdb/testsuite/gdb.base/moribund-step.exp index 12e32fbc554..c088cb478f5 100644 --- a/gdb/testsuite/gdb.base/moribund-step.exp +++ b/gdb/testsuite/gdb.base/moribund-step.exp @@ -13,14 +13,14 @@ # 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 moribund-step +standard_testfile start.c if { ![support_displaced_stepping] } { unsupported "displaced stepping" return -1 } -if { [prepare_for_testing ${testfile}.exp ${testfile} start.c] } { +if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile] } { return -1 } diff --git a/gdb/testsuite/gdb.base/multi-forks.exp b/gdb/testsuite/gdb.base/multi-forks.exp index ac231d7b3bd..0ea96cc67b6 100644 --- a/gdb/testsuite/gdb.base/multi-forks.exp +++ b/gdb/testsuite/gdb.base/multi-forks.exp @@ -25,9 +25,7 @@ if {![istarget "hppa*-hp-hpux*"] && ![istarget "*-*-linux*"]} then { } -set testfile "multi-forks" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .c if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { untested multi-forks.exp @@ -36,10 +34,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} global gdb_prompt @@ -142,10 +137,7 @@ if {![istarget "*-*-linux*"]} then { # Start with a fresh gdb -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart ${binfile} runto_main gdb_breakpoint $exit_bp_loc |