test suite update - gdb.base/[ab]

Convert files gdb.base/[ab]*.exp to use standard_output_file et al.

	* a2-run.exp, all-bin.exp, annota1.exp, annota3.exp, anon.exp,
	args.exp, arithmet.exp, arrayidx.exp, assign.exp, async-shell.exp,
	async.exp, attach-pie-misread.exp, attach-pie-noexec.exp,
	attach-twice.exp, attach.exp, auxv.exp, bang.exp, bfp-test.exp,
	bigcore.exp, bitfields.exp, bitfields2.exp, break-entry.exp,
	break-interp.exp, break-on-linker-gcd-function.exp,
	breakpoint-shadow.exp: Use standard_testfile,
	standard_output_file, prepare_for_testing, clean_restart.
This commit is contained in:
Tom Tromey 2013-06-27 18:47:53 +00:00
parent 97f8dd0980
commit a64d25307d
26 changed files with 97 additions and 174 deletions

View File

@ -1,3 +1,14 @@
2013-06-27 Tom Tromey <tromey@redhat.com>
* a2-run.exp, all-bin.exp, annota1.exp, annota3.exp, anon.exp,
args.exp, arithmet.exp, arrayidx.exp, assign.exp, async-shell.exp,
async.exp, attach-pie-misread.exp, attach-pie-noexec.exp,
attach-twice.exp, attach.exp, auxv.exp, bang.exp, bfp-test.exp,
bigcore.exp, bitfields.exp, bitfields2.exp, break-entry.exp,
break-interp.exp, break-on-linker-gcd-function.exp,
breakpoint-shadow.exp: Use standard_testfile,
standard_output_file, prepare_for_testing, clean_restart.
2013-06-26 Yao Qi <yao@codesourcery.com>
* gdb.trace/mi-trace-frame-collected.exp: New.

View File

@ -24,8 +24,9 @@ if [gdb_skip_stdio_test "a2run.exp"] {
# test running programs
#
set testfile a2-run
if { [prepare_for_testing ${testfile}.exp $testfile run.c] } {
standard_testfile run.c
if { [prepare_for_testing ${testfile}.exp $testfile $srcfile] } {
return -1
}

View File

@ -27,24 +27,16 @@
# test running programs
#
set testfile "all-types"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested all-bin.exp
return -1
}
standard_testfile all-types.c
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

View File

@ -31,9 +31,7 @@ set breakpoints_invalid "\r\n\032\032breakpoints-invalid\r\n"
# test running programs
#
set testfile "annota1"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested annota1.exp
@ -41,10 +39,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
clean_restart ${binfile}
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
@ -445,10 +440,10 @@ if { [remote_file host exists core] } {
}
proc thread_test {} {
global objdir subdir srcdir testfile
global subdir srcdir testfile
global gdb_prompt old_gdb_prompt
set srcfile watch_thread_num.c
set binfile ${objdir}/${subdir}/${testfile}-watch_thread_num
set binfile [standard_output_file ${testfile}-watch_thread_num]
set gdb_prompt $old_gdb_prompt
if { ![get_compiler_info] && [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {

View File

@ -30,9 +30,7 @@ if [is_remote target] then {
# test running programs
#
set testfile "annota3"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested annota3.exp
@ -40,10 +38,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
clean_restart ${binfile}
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.

View File

@ -14,8 +14,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
set testfile "anon"
set srcfile $testfile.c
standard_testfile .c
if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug}] } {
return -1
}

View File

@ -23,30 +23,22 @@ if [target_info exists noargs] {
return
}
set testfile "args"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested args.exp
if {[build_executable $testfile.exp $testfile \
$srcfile {debug nowarnings}] == -1} {
untested $testfile.exp
return -1
}
proc args_test { name arglist } {
global srcdir
global subdir
global binfile
global testfile
global hex
global decimal
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
# No loading needs to be done when the target is `exec'. Some targets
# require that the program be loaded, however, and it doesn't hurt
# for `exec'.
gdb_load $binfile
clean_restart $testfile
runto_main
gdb_breakpoint [gdb_get_line_number "set breakpoint here"]

View File

@ -26,19 +26,12 @@
# 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 arithmet.exp
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug nowarnings}]} {
untested $testfile.exp
return -1
}
#

View File

@ -17,18 +17,14 @@
# gdb can correctly print arrays with indexes for each element of the
# array.
set testfile "arrayidx"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
clean_restart ${binfile}
if ![runto_main] then {
perror "couldn't run to breakpoint"

View File

@ -25,9 +25,7 @@
# test running programs
#
set testfile "all-types"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
standard_testfile all-types.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested assign.exp
@ -35,11 +33,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
clean_restart ${binfile}
#

View File

@ -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 async-shell
standard_testfile
if { ![support_displaced_stepping] } {
unsupported "displaced stepping"
@ -25,7 +25,7 @@ if [target_info exists use_gdb_stub] {
return 0
}
if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile] } {
return -1
}

View File

@ -18,16 +18,14 @@
# test running programs
#
set testfile "async"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
standard_testfile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested async.exp
if [get_compiler_info] {
return -1
}
if [get_compiler_info] {
if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
untested $testfile.exp
return -1
}

View File

@ -21,13 +21,11 @@ if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
load_lib prelink-support.exp
set test "attach-pie-misread"
set srcfile ${test}.c
set genfile ${objdir}/${subdir}/${test}-gen.h
set executable ${test}
set binfile ${objdir}/${subdir}/${executable}
standard_testfile .c
set genfile [standard_output_file ${testfile}-gen.h]
set executable $testfile
if {[build_executable_own_libs ${test}.exp $executable $srcfile [list additional_flags=-fPIE ldflags=-pie]] == ""} {
if {[build_executable_own_libs ${testfile}.exp $executable $srcfile [list additional_flags=-fPIE ldflags=-pie]] == ""} {
return -1
}

View File

@ -18,9 +18,8 @@ if [is_remote target] then {
return 0
}
set testfile attach-pie-noexec
standard_testfile .c
set executable ${testfile}
set binfile ${objdir}/${subdir}/${executable}
if { [prepare_for_testing ${testfile}.exp $executable "" [list debug "additional_flags=-fPIE -pie"]] } {
return -1

View File

@ -18,9 +18,8 @@ if [is_remote target] then {
return 0
}
set testfile attach-twice
standard_testfile
set executable ${testfile}
set binfile ${objdir}/${subdir}/${executable}
if { [prepare_for_testing ${testfile}.exp $executable] } {
return -1

View File

@ -30,12 +30,9 @@ if [is_remote target] then {
return 0
}
set testfile "attach"
set srcfile ${testfile}.c
set srcfile2 ${testfile}2.c
set binfile ${objdir}/${subdir}/${testfile}
set binfile2 ${objdir}/${subdir}/${testfile}2
set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
standard_testfile attach.c attach2.c
set binfile2 ${binfile}2
set escapedbinfile [string_to_regexp $binfile]
#execute_anywhere "rm -f ${binfile} ${binfile2}"
remote_exec build "rm -f ${binfile} ${binfile2}"
@ -67,7 +64,6 @@ proc do_attach_tests {} {
global escapedbinfile
global srcfile
global testfile
global objdir
global subdir
global timeout
@ -298,7 +294,7 @@ proc do_attach_tests {} {
# when we're cd'd to some directory that doesn't contain the
# a.out. (We use the source path set by the "dir" command.)
gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \
gdb_test "dir [standard_output_file {}]" "Source directories searched: .*" \
"set source path"
gdb_test "cd /tmp" "Working directory /tmp." \

View File

@ -24,11 +24,10 @@ if { ! [istarget "*-*-linux*"] && ! [istarget "*-*-solaris*"] } {
}
set testfile "auxv"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set corefile ${objdir}/${subdir}/${testfile}.corefile
set gcorefile ${objdir}/${subdir}/${testfile}.gcore
standard_testfile .c
set corefile ${binfile}.corefile
set gcorefile ${binfile}.gcore
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
{debug additional_flags=-DUSE_RLIMIT}] != ""
@ -40,16 +39,13 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
# Use a fresh directory to confine the native core dumps.
# Make it the working directory for gdb and its child.
set coredir "${objdir}/${subdir}/coredir.[getpid]"
set coredir [standard_output_file coredir.[getpid]]
file mkdir $coredir
set core_works [expr [isnative] && ! [is_remote target]]
# Run GDB on the test program up to where it will dump core.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
clean_restart ${binfile}
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set width 0"

View File

@ -16,20 +16,14 @@
# This is a test that verifies that GDB is able to "run" when the name
# of the executable file contains a '!'.
set testfile "args"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/bang!
standard_testfile args.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
if {[prepare_for_testing $testfile.exp ${testfile}! $srcfile \
{debug nowarnings}]} {
untested bang.exp
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# Verify that we can run the program and that it terminates normally.
gdb_run_cmd

View File

@ -16,18 +16,14 @@
# This file is part of the gdb testsuite. It is intended to test that
# gdb could correctly handle floating point constant with a suffix.
set testfile "bfp-test"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
clean_restart ${binfile}
if ![runto_main] then {
perror "couldn't run to breakpoint"

View File

@ -46,10 +46,8 @@ if { [istarget "*-*-*irix*"] } {
return
}
set testfile "bigcore"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
set corefile ${objdir}/${subdir}/${testfile}.corefile
standard_testfile .c
set corefile ${binfile}.corefile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested bigcore.exp
@ -58,10 +56,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
# Run GDB on the bigcore program up-to where it will dump core.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
clean_restart ${binfile}
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set width 0"

View File

@ -16,11 +16,10 @@
# This file was written by Fred Fish. (fnf@cygnus.com)
set testfile "bitfields"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested bitfields.exp
standard_testfile
if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
untested $testfile.exp
return -1
}
@ -270,10 +269,6 @@ proc bitfield_internalvar {} {
gdb_test "print \$myvar.f" "\\$\[0-9\]\+ = -1"
}
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
gdb_test_no_output "set print sevenbit-strings"
bitfield_uniqueness

View File

@ -23,9 +23,8 @@
#
set testfile "bitfields2"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested bitfields2.exp
return -1
@ -279,9 +278,7 @@ proc bitfield_set {} {
gdb_stop_suppressing_tests
}
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
clean_restart ${binfile}
gdb_test_no_output "set print sevenbit-strings"
runto_main

View File

@ -25,14 +25,14 @@
# continues the process with the equivalent of "jump *$PC", which
# triggers any breakpoint at $PC. The latter is what we want to test.
set testfile break-entry
standard_testfile start.c
if [target_info exists use_gdb_stub] {
untested ${testfile}.exp
return
}
if { [prepare_for_testing ${testfile}.exp ${testfile} start.c {additional_flags=-static}] } {
if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {additional_flags=-static}] } {
return -1
}

View File

@ -22,11 +22,11 @@ if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
load_lib prelink-support.exp
set test "break-interp"
set binprefix ${objdir}/${subdir}/${test}
set binprefix [standard_output_file ${test}]
# Only to get the $interp_system name.
set srcfile_test "start.c"
set binfile_test ${test}-test
set binfile_lib ${objdir}/${subdir}/${test}.so
set binfile_lib ${binprefix}.so
set srcfile "${test}-main.c"
set srcfile_lib "${test}-lib.c"
@ -83,7 +83,7 @@ gdb_test_multiple $test $test {
}
}
set interp_system [section_get ${objdir}/${subdir}/$binfile_test .interp]
set interp_system [section_get [standard_output_file $binfile_test] .interp]
set interp_system_debug [system_debug_get $interp_system]
verbose -log "$interp_system has debug $interp_system_debug"
@ -390,10 +390,11 @@ proc test_ld {file ifmain trynosym displacement} {
if $ifmain {
gdb_test_no_output "set args segv"
} else {
global objdir binfile_test
global binfile_test
# ld.so needs some executable to run to reach _dl_debug_state.
gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test"
gdb_test_no_output "set args [standard_output_file $binfile_test]" \
"set args OBJDIR/${subdir}/$binfile_test"
}
reach $solib_bp "run" $displacement

View File

@ -25,23 +25,19 @@
#
if { [skip_cplus_tests] } { continue }
set testfile "break-on-linker-gcd-function"
set srcfile ${testfile}.cc
set binfile ${objdir}/${subdir}/${testfile}
standard_testfile .cc
if [get_compiler_info "c++"] {
return -1
}
set additional_flags {-ffunction-sections -Wl,--gc-sections}
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
[list debug c++ additional_flags=$additional_flags]] != "" } {
untested $srcfile
if {[prepare_for_testing $testfile.exp $testfile $srcfile \
[list debug c++ additional_flags=$additional_flags]]} {
untested $testfile.exp
return -1
}
clean_restart $testfile
# Single hex digit
set xd {[0-9a-f]}

View File

@ -13,19 +13,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set testfile breakpoint-shadow
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
}
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
gdb_load ${binfile}
# We need to start the inferior to place the breakpoints in the memory at all.
if ![runto_main] {
untested start