From b4a58790dbc901ffa61059886667b31ed34d0148 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 22 Jun 2012 17:59:33 +0000 Subject: [PATCH] * gdb.python/lib-types.exp: Use standard_testfile, prepare_for_testing. * gdb.python/py-block.exp: Use standard_testfile. * gdb.python/py-breakpoint.exp: Use standard_testfile. * gdb.python/py-events.exp: Use standard_testfile, standard_output_file. * gdb.python/py-evsignal.exp: Use standard_testfile. * gdb.python/py-evethreads.exp: Use standard_testfile. * gdb.python/py-explore-cc.exp: Use standard_testfile. * gdb.python/py-explore.exp: Use standard_testfile. * gdb.python/py-finish-breakpoint.exp: Use standard_testfile, standard_output_file. * gdb.python/py-finish-breakpoint2.exp: Use standard_testfile, prepare_for_testing. * gdb.python/py-frame-inline.exp: Use standard_testfile. * gdb.python/py-frame.exp: Use standard_testfile. * gdb.python/py-inferior.exp: Use standard_testfile. * gdb.python/py-infthread.exp: Use standard_testfile. * gdb.python/py-mi.exp: Use standard_testfile. * gdb.python/py-objfile-script.exp: Use standard_testfile, build_executable. * gdb.python/py-objfile.exp: Use standard_testfile. * gdb.python/py-pp-maint.exp: Use standard_testfile, prepare_for_testing. * gdb.python/py-prettyprint.exp: Use standard_testfile. * gdb.python/py-progspace.exp: Use standard_testfile, build_executable. * gdb.python/py-prompt.exp: Use standard_testfile, build_executable. * gdb.python/py-section-script.exp: Use standard_testfile, build_executable. * gdb.python/py-shared.exp: Use standard_testfile, standard_output_file, clean_restart. * gdb.python/py-symbol.exp: Use standard_output_file, prepare_for_testing. * gdb.python/py-symtab.exp: Use standard_output_file, prepare_for_testing * gdb.python/py-template.exp: Use standard_testfile. * gdb.python/py-type.exp: Use standard_testfile. * gdb.python/py-value-cc.exp: Use standard_testfile. * gdb.python/py-value.exp: Use standard_testfile. * gdb.python/python.exp: Use standard_testfile, build_executable. --- gdb/testsuite/ChangeLog | 45 +++++++++++++++++++ gdb/testsuite/gdb.python/lib-types.exp | 14 ++---- gdb/testsuite/gdb.python/py-block.exp | 4 +- gdb/testsuite/gdb.python/py-breakpoint.exp | 4 +- gdb/testsuite/gdb.python/py-events.exp | 6 +-- gdb/testsuite/gdb.python/py-evsignal.exp | 4 +- gdb/testsuite/gdb.python/py-evthreads.exp | 4 +- gdb/testsuite/gdb.python/py-explore-cc.exp | 4 +- gdb/testsuite/gdb.python/py-explore.exp | 5 +-- .../gdb.python/py-finish-breakpoint.exp | 6 +-- .../gdb.python/py-finish-breakpoint2.exp | 13 +----- gdb/testsuite/gdb.python/py-frame-inline.exp | 4 +- gdb/testsuite/gdb.python/py-frame.exp | 4 +- gdb/testsuite/gdb.python/py-inferior.exp | 6 +-- gdb/testsuite/gdb.python/py-infthread.exp | 4 +- gdb/testsuite/gdb.python/py-mi.exp | 4 +- .../gdb.python/py-objfile-script.exp | 8 ++-- gdb/testsuite/gdb.python/py-objfile.exp | 3 +- gdb/testsuite/gdb.python/py-pp-maint.exp | 18 ++------ gdb/testsuite/gdb.python/py-prettyprint.exp | 4 +- gdb/testsuite/gdb.python/py-progspace.exp | 8 ++-- gdb/testsuite/gdb.python/py-prompt.exp | 7 +-- .../gdb.python/py-section-script.exp | 8 ++-- gdb/testsuite/gdb.python/py-shared.exp | 12 ++--- gdb/testsuite/gdb.python/py-symbol.exp | 14 ++---- gdb/testsuite/gdb.python/py-symtab.exp | 14 ++---- gdb/testsuite/gdb.python/py-template.exp | 4 +- gdb/testsuite/gdb.python/py-type.exp | 4 +- gdb/testsuite/gdb.python/py-value-cc.exp | 4 +- gdb/testsuite/gdb.python/py-value.exp | 4 +- gdb/testsuite/gdb.python/python.exp | 12 ++--- 31 files changed, 108 insertions(+), 147 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e205c26a779..7f53b84ce63 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,48 @@ +2012-06-22 Tom Tromey + + * gdb.python/lib-types.exp: Use standard_testfile, + prepare_for_testing. + * gdb.python/py-block.exp: Use standard_testfile. + * gdb.python/py-breakpoint.exp: Use standard_testfile. + * gdb.python/py-events.exp: Use standard_testfile, + standard_output_file. + * gdb.python/py-evsignal.exp: Use standard_testfile. + * gdb.python/py-evethreads.exp: Use standard_testfile. + * gdb.python/py-explore-cc.exp: Use standard_testfile. + * gdb.python/py-explore.exp: Use standard_testfile. + * gdb.python/py-finish-breakpoint.exp: Use standard_testfile, + standard_output_file. + * gdb.python/py-finish-breakpoint2.exp: Use standard_testfile, + prepare_for_testing. + * gdb.python/py-frame-inline.exp: Use standard_testfile. + * gdb.python/py-frame.exp: Use standard_testfile. + * gdb.python/py-inferior.exp: Use standard_testfile. + * gdb.python/py-infthread.exp: Use standard_testfile. + * gdb.python/py-mi.exp: Use standard_testfile. + * gdb.python/py-objfile-script.exp: Use standard_testfile, + build_executable. + * gdb.python/py-objfile.exp: Use standard_testfile. + * gdb.python/py-pp-maint.exp: Use standard_testfile, + prepare_for_testing. + * gdb.python/py-prettyprint.exp: Use standard_testfile. + * gdb.python/py-progspace.exp: Use standard_testfile, + build_executable. + * gdb.python/py-prompt.exp: Use standard_testfile, + build_executable. + * gdb.python/py-section-script.exp: Use standard_testfile, + build_executable. + * gdb.python/py-shared.exp: Use standard_testfile, + standard_output_file, clean_restart. + * gdb.python/py-symbol.exp: Use standard_output_file, + prepare_for_testing. + * gdb.python/py-symtab.exp: Use standard_output_file, + prepare_for_testing + * gdb.python/py-template.exp: Use standard_testfile. + * gdb.python/py-type.exp: Use standard_testfile. + * gdb.python/py-value-cc.exp: Use standard_testfile. + * gdb.python/py-value.exp: Use standard_testfile. + * gdb.python/python.exp: Use standard_testfile, build_executable. + 2012-06-22 Tom Tromey * gdb.objc/basicclass.exp: Use standard_testfile. diff --git a/gdb/testsuite/gdb.python/lib-types.exp b/gdb/testsuite/gdb.python/lib-types.exp index 6be49e1a9f8..fde0740f2e4 100644 --- a/gdb/testsuite/gdb.python/lib-types.exp +++ b/gdb/testsuite/gdb.python/lib-types.exp @@ -18,20 +18,12 @@ load_lib gdb-python.exp -set testfile "lib-types" -set srcfile ${testfile}.cc -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { - untested "Couldn't compile ${srcfile}" +standard_testfile .cc + +if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { return -1 } -# Start with a fresh gdb. -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } diff --git a/gdb/testsuite/gdb.python/py-block.exp b/gdb/testsuite/gdb.python/py-block.exp index 413e2e25b5c..745f84468d2 100644 --- a/gdb/testsuite/gdb.python/py-block.exp +++ b/gdb/testsuite/gdb.python/py-block.exp @@ -18,8 +18,8 @@ load_lib gdb-python.exp -set testfile "py-block" -set srcfile ${testfile}.c +standard_testfile + if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 } diff --git a/gdb/testsuite/gdb.python/py-breakpoint.exp b/gdb/testsuite/gdb.python/py-breakpoint.exp index f3d409ecf66..9bedeb2fca4 100644 --- a/gdb/testsuite/gdb.python/py-breakpoint.exp +++ b/gdb/testsuite/gdb.python/py-breakpoint.exp @@ -18,8 +18,8 @@ load_lib gdb-python.exp -set testfile "py-breakpoint" -set srcfile ${testfile}.c +standard_testfile + if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 } diff --git a/gdb/testsuite/gdb.python/py-events.exp b/gdb/testsuite/gdb.python/py-events.exp index 28a1394d265..6b655bbb57d 100644 --- a/gdb/testsuite/gdb.python/py-events.exp +++ b/gdb/testsuite/gdb.python/py-events.exp @@ -21,12 +21,10 @@ load_lib gdb-python.exp set libfile "py-events-shlib" set libsrc $srcdir/$subdir/$libfile.c -set lib_sl $objdir/$subdir/$libfile.so +set lib_sl [standard_output_file $libfile.so] set lib_opts debug -set testfile "py-events" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile set exec_opts [list debug shlib=$lib_sl] set pyfile ${srcdir}/${subdir}/${testfile}.py diff --git a/gdb/testsuite/gdb.python/py-evsignal.exp b/gdb/testsuite/gdb.python/py-evsignal.exp index d3f819a1054..b3c1d66defd 100644 --- a/gdb/testsuite/gdb.python/py-evsignal.exp +++ b/gdb/testsuite/gdb.python/py-evsignal.exp @@ -21,9 +21,7 @@ if {[is_remote target]} { load_lib gdb-python.exp -set testfile "py-evsignal" -set srcfile py-evthreads.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile py-evthreads.c set pyfile ${srcdir}/${subdir}/py-events.py if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { diff --git a/gdb/testsuite/gdb.python/py-evthreads.exp b/gdb/testsuite/gdb.python/py-evthreads.exp index 8b540bd0d9b..98f25015abc 100644 --- a/gdb/testsuite/gdb.python/py-evthreads.exp +++ b/gdb/testsuite/gdb.python/py-evthreads.exp @@ -26,9 +26,7 @@ if { ![support_displaced_stepping] } { load_lib gdb-python.exp -set testfile "py-evthreads" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile set pyfile ${srcdir}/${subdir}/py-events.py if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { diff --git a/gdb/testsuite/gdb.python/py-explore-cc.exp b/gdb/testsuite/gdb.python/py-explore-cc.exp index afcf4531850..3686ae302ad 100644 --- a/gdb/testsuite/gdb.python/py-explore-cc.exp +++ b/gdb/testsuite/gdb.python/py-explore-cc.exp @@ -18,9 +18,7 @@ if { [skip_cplus_tests] } { continue } -set testfile "py-explore" -set srcfile ${testfile}.cc -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile py-explore.cc if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { return -1 diff --git a/gdb/testsuite/gdb.python/py-explore.exp b/gdb/testsuite/gdb.python/py-explore.exp index 5ba98e9631d..308d90223ae 100644 --- a/gdb/testsuite/gdb.python/py-explore.exp +++ b/gdb/testsuite/gdb.python/py-explore.exp @@ -13,9 +13,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set testfile "py-explore" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile + if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 } diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp index e56ad67e1bb..d521021918e 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint.exp +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint.exp @@ -25,12 +25,10 @@ load_lib gdb-python.exp set libfile "py-events-shlib" set libsrc $srcdir/$subdir/$libfile.c -set lib_sl $objdir/$subdir/$libfile-nodebug.so +set lib_sl [standard_output_file $libfile-nodebug.so] set lib_opts "" -set testfile "py-finish-breakpoint" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile set exec_opts [list debug shlib=$lib_sl] if [get_compiler_info] { diff --git a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp index 3174be1916f..3b08ef8c21c 100644 --- a/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp +++ b/gdb/testsuite/gdb.python/py-finish-breakpoint2.exp @@ -18,22 +18,13 @@ load_lib gdb-python.exp -set testfile "py-finish-breakpoint2" -set srcfile ${testfile}.cc -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .cc set pyfile ${srcdir}/${subdir}/${testfile}.py -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { - untested "Couldn't compile ${srcfile}" +if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { return -1 } -# Start with a fresh gdb. -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } diff --git a/gdb/testsuite/gdb.python/py-frame-inline.exp b/gdb/testsuite/gdb.python/py-frame-inline.exp index 6d45ba232bf..49fa87e0928 100644 --- a/gdb/testsuite/gdb.python/py-frame-inline.exp +++ b/gdb/testsuite/gdb.python/py-frame-inline.exp @@ -15,8 +15,8 @@ load_lib gdb-python.exp -set testfile "py-frame-inline" -set srcfile ${testfile}.c +standard_testfile + if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 } diff --git a/gdb/testsuite/gdb.python/py-frame.exp b/gdb/testsuite/gdb.python/py-frame.exp index 83ff8fe78bc..993e77479fb 100644 --- a/gdb/testsuite/gdb.python/py-frame.exp +++ b/gdb/testsuite/gdb.python/py-frame.exp @@ -18,8 +18,8 @@ load_lib gdb-python.exp -set testfile "py-frame" -set srcfile ${testfile}.c +standard_testfile + if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 } diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp index ef737a4bddb..b40a5143965 100644 --- a/gdb/testsuite/gdb.python/py-inferior.exp +++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -18,8 +18,8 @@ load_lib gdb-python.exp -set testfile "py-inferior" -set srcfile ${testfile}.c +standard_testfile + if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 } @@ -216,4 +216,4 @@ gdb_test "add-inferior" "Added inferior 3" "Create new inferior" gdb_test "inferior 3" ".*" "Switch to third inferior" gdb_test "py print gdb.selected_inferior().num" "3" "Third inferior selected" gdb_test "inferior 1" ".*" "Switch to first inferior" -gdb_test_no_output "remove-inferiors 3" "Remove second inferior" \ No newline at end of file +gdb_test_no_output "remove-inferiors 3" "Remove second inferior" diff --git a/gdb/testsuite/gdb.python/py-infthread.exp b/gdb/testsuite/gdb.python/py-infthread.exp index 491cc41b20d..0ddc912492b 100644 --- a/gdb/testsuite/gdb.python/py-infthread.exp +++ b/gdb/testsuite/gdb.python/py-infthread.exp @@ -18,8 +18,8 @@ load_lib gdb-python.exp -set testfile "py-infthread" -set srcfile ${testfile}.c +standard_testfile + if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 } diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp index 8d54a8d5842..a792e44cd66 100644 --- a/gdb/testsuite/gdb.python/py-mi.exp +++ b/gdb/testsuite/gdb.python/py-mi.exp @@ -24,9 +24,7 @@ if [mi_gdb_start] { continue } -set testfile "py-mi" -set srcfile py-prettyprint.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile py-prettyprint.c set pyfile py-prettyprint.py if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DMI}] != "" } { untested ${testfile}.exp diff --git a/gdb/testsuite/gdb.python/py-objfile-script.exp b/gdb/testsuite/gdb.python/py-objfile-script.exp index 12d67956224..abdb12754f7 100644 --- a/gdb/testsuite/gdb.python/py-objfile-script.exp +++ b/gdb/testsuite/gdb.python/py-objfile-script.exp @@ -16,11 +16,9 @@ # This file is part of the GDB testsuite. It tests automagic loading of # -gdb.py scripts. -set testfile "py-objfile-script" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested "Couldn't compile ${srcfile}" +standard_testfile + +if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { return -1 } diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp index c277c5947f0..cbd0f87c336 100644 --- a/gdb/testsuite/gdb.python/py-objfile.exp +++ b/gdb/testsuite/gdb.python/py-objfile.exp @@ -18,8 +18,7 @@ load_lib gdb-python.exp -set testfile "py-objfile" -set srcfile ${testfile}.c +standard_testfile if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } { return -1 diff --git a/gdb/testsuite/gdb.python/py-pp-maint.exp b/gdb/testsuite/gdb.python/py-pp-maint.exp index 5971a40387e..3f08ba12a79 100644 --- a/gdb/testsuite/gdb.python/py-pp-maint.exp +++ b/gdb/testsuite/gdb.python/py-pp-maint.exp @@ -23,24 +23,14 @@ if [is_remote host] { load_lib gdb-python.exp -set testfile "py-pp-maint" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile -# Start with a fresh gdb. -gdb_exit -gdb_start - -# Skip all tests if Python scripting is not enabled. -if { [skip_python_tests] } { continue } - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug"] != "" } { - untested "Couldn't compile ${srcfile}" +if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { return -1 } -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +# Skip all tests if Python scripting is not enabled. +if { [skip_python_tests] } { continue } if ![runto_main ] then { fail "Can't run to main" diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index e61422a3a64..a6c241a1411 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -18,9 +18,7 @@ load_lib gdb-python.exp -set testfile "py-prettyprint" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile # Start with a fresh gdb. gdb_exit diff --git a/gdb/testsuite/gdb.python/py-progspace.exp b/gdb/testsuite/gdb.python/py-progspace.exp index c53cf37c0fe..ee7ce9e51fd 100644 --- a/gdb/testsuite/gdb.python/py-progspace.exp +++ b/gdb/testsuite/gdb.python/py-progspace.exp @@ -16,11 +16,9 @@ # This file is part of the GDB testsuite. It tests the program space # support in Python. -set testfile "py-progspace" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested "Couldn't compile ${srcfile}" +standard_testfile + +if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { return -1 } diff --git a/gdb/testsuite/gdb.python/py-prompt.exp b/gdb/testsuite/gdb.python/py-prompt.exp index ab17ab93bd7..b5d9368d0d5 100644 --- a/gdb/testsuite/gdb.python/py-prompt.exp +++ b/gdb/testsuite/gdb.python/py-prompt.exp @@ -16,9 +16,7 @@ # This file is part of the GDB testsuite. It tests the mechanism # for defining the prompt in Python. -set testfile "py-prompt" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile # We need to use TCL's exec to get the pid. if [is_remote target] then { @@ -38,8 +36,7 @@ gdb_reinitialize_dir $srcdir/$subdir if { [skip_python_tests] } { continue } gdb_exit -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested py-prompt.exp +if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { return -1 } diff --git a/gdb/testsuite/gdb.python/py-section-script.exp b/gdb/testsuite/gdb.python/py-section-script.exp index d070f13f8e1..8135b96fe76 100644 --- a/gdb/testsuite/gdb.python/py-section-script.exp +++ b/gdb/testsuite/gdb.python/py-section-script.exp @@ -29,11 +29,9 @@ if {![istarget *-*-linux*] return } -set testfile "py-section-script" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested "Couldn't compile ${srcfile}" +standard_testfile + +if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { return -1 } diff --git a/gdb/testsuite/gdb.python/py-shared.exp b/gdb/testsuite/gdb.python/py-shared.exp index fa57de7dd0e..454a325260e 100644 --- a/gdb/testsuite/gdb.python/py-shared.exp +++ b/gdb/testsuite/gdb.python/py-shared.exp @@ -21,12 +21,11 @@ if {[skip_shlib_tests]} { return 0 } -set testfile "py-shared" -set srcfile ${testfile}.c +standard_testfile + set libfile "py-shared-sl" set libsrc ${libfile}.c -set library ${objdir}/${subdir}/${libfile}.sl -set binfile ${objdir}/${subdir}/${testfile} +set library [standard_output_file ${libfile}.sl] if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != "" } { untested "Could not compile shared library." @@ -41,10 +40,7 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opt } # Start with a fresh gdb. -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} +clean_restart $testfile gdb_load_shlibs ${library} # Skip all tests if Python scripting is not enabled. diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp index 2f274af2127..bc20ee471db 100644 --- a/gdb/testsuite/gdb.python/py-symbol.exp +++ b/gdb/testsuite/gdb.python/py-symbol.exp @@ -18,20 +18,12 @@ load_lib gdb-python.exp -set testfile "py-symbol" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested "Couldn't compile ${srcfile}" +standard_testfile + +if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { return -1 } -# Start with a fresh gdb. -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } diff --git a/gdb/testsuite/gdb.python/py-symtab.exp b/gdb/testsuite/gdb.python/py-symtab.exp index 6eec611677c..9aef863a54b 100644 --- a/gdb/testsuite/gdb.python/py-symtab.exp +++ b/gdb/testsuite/gdb.python/py-symtab.exp @@ -18,20 +18,12 @@ load_lib gdb-python.exp -set testfile "py-symbol" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested "Couldn't compile ${srcfile}" +standard_testfile py-symbol.c + +if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { return -1 } -# Start with a fresh gdb. -gdb_exit -gdb_start -gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile} - # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp index 8805611da53..5aff73df624 100644 --- a/gdb/testsuite/gdb.python/py-template.exp +++ b/gdb/testsuite/gdb.python/py-template.exp @@ -18,9 +18,7 @@ if { [skip_cplus_tests] } { continue } -set testfile "py-template" -set srcfile ${testfile}.cc -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile .cc if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ {debug c++}] != "" } { untested "Couldn't compile ${srcfile}" diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index eb9012a08aa..98a055e06eb 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -18,9 +18,7 @@ load_lib gdb-python.exp -set testfile "py-type" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile if [get_compiler_info c++] { return -1; diff --git a/gdb/testsuite/gdb.python/py-value-cc.exp b/gdb/testsuite/gdb.python/py-value-cc.exp index 03886137fbf..9de63b1bd51 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.exp +++ b/gdb/testsuite/gdb.python/py-value-cc.exp @@ -18,9 +18,7 @@ if { [skip_cplus_tests] } { continue } -set testfile "py-value" -set srcfile ${testfile}.cc -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile py-value.cc if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { return -1 diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index c9d8c97f5c3..acfd89b7472 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -18,9 +18,7 @@ load_lib gdb-python.exp -set testfile "py-value" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +standard_testfile # Build inferior to language specification. proc build_inferior {exefile lang} { diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index ef0cdcf87a3..2c7ead26935 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -18,14 +18,10 @@ load_lib gdb-python.exp -set testfile "python" -set srcfile ${testfile}.c -set srcfile1 ${testfile}-1.c -set binfile ${objdir}/${subdir}/${testfile} - -if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile1}" \ - ${binfile} executable {debug}] != "" } { - untested "Could not compile $binfile." +standard_testfile python.c python-1.c + +if {[build_executable $testfile.exp $testfile \ + [list $srcfile $srcfile2] debug] == -1} { return -1 } -- 2.30.2