From e0c0f156b4b0a32293c1a48c296d8035244e3951 Mon Sep 17 00:00:00 2001 From: Andreas Arnez Date: Fri, 7 Mar 2014 11:45:49 +0000 Subject: [PATCH] Exploit 'prepare_for_testing' etc. for 'Dwarf::assemble'-generated files Now that prepare_for_testing etc. can cope with absolute path names, this can be exploited for test cases with generated source files. This is just to simplify the code and shouldn't cause any functional change. --- gdb/testsuite/ChangeLog | 12 ++++++++++++ gdb/testsuite/gdb.dwarf2/arr-stride.exp | 15 ++------------- gdb/testsuite/gdb.dwarf2/arr-subrange.exp | 15 ++------------- gdb/testsuite/gdb.dwarf2/dwz.exp | 15 ++------------- gdb/testsuite/gdb.dwarf2/implptrconst.exp | 13 ++----------- gdb/testsuite/gdb.dwarf2/implptrpiece.exp | 13 ++----------- gdb/testsuite/gdb.dwarf2/method-ptr.exp | 15 ++------------- gdb/testsuite/gdb.dwarf2/missing-sig-type.exp | 15 ++------------- gdb/testsuite/gdb.dwarf2/nostaticblock.exp | 15 ++------------- gdb/testsuite/gdb.dwarf2/subrange.exp | 15 ++------------- 10 files changed, 30 insertions(+), 113 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 47b586bf0c6..70b75124909 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2014-03-12 Andreas Arnez + + * gdb.dwarf2/arr-stride.exp: Exploit 'prepare_for_testing'. + * gdb.dwarf2/arr-subrange.exp: Likewise. + * gdb.dwarf2/dwz.exp: Likewise. + * gdb.dwarf2/method-ptr.exp: Likewise. + * gdb.dwarf2/missing-sig-type.exp: Likewise. + * gdb.dwarf2/subrange.exp: Likewise. + * gdb.dwarf2/implptrconst.exp: Exploit 'build_executable'. + * gdb.dwarf2/implptrpiece.exp: Likewise. + * gdb.dwarf2/nostaticblock.exp: Likewise. + 2014-03-12 Andreas Arnez * lib/gdb.exp (build_executable_from_specs): Don't prepend source diff --git a/gdb/testsuite/gdb.dwarf2/arr-stride.exp b/gdb/testsuite/gdb.dwarf2/arr-stride.exp index f2a1f39d82b..c9186227a44 100644 --- a/gdb/testsuite/gdb.dwarf2/arr-stride.exp +++ b/gdb/testsuite/gdb.dwarf2/arr-stride.exp @@ -83,22 +83,11 @@ Dwarf::assemble $asm_file { } } -if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != ""} { +if { [prepare_for_testing ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } -if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {}] != ""} { - return -1 -} - -clean_restart ${testfile} - gdb_test_no_output "set language ada" gdb_test "ptype pck.table" \ diff --git a/gdb/testsuite/gdb.dwarf2/arr-subrange.exp b/gdb/testsuite/gdb.dwarf2/arr-subrange.exp index 9847c13c383..d01b789cd18 100644 --- a/gdb/testsuite/gdb.dwarf2/arr-subrange.exp +++ b/gdb/testsuite/gdb.dwarf2/arr-subrange.exp @@ -77,22 +77,11 @@ Dwarf::assemble $asm_file { } } -if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != ""} { +if { [prepare_for_testing ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } -if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {}] != ""} { - return -1 -} - -clean_restart ${testfile} - gdb_test_no_output "set language ada" gdb_test "ptype pck.table" \ diff --git a/gdb/testsuite/gdb.dwarf2/dwz.exp b/gdb/testsuite/gdb.dwarf2/dwz.exp index 87b68153608..7f996b34409 100644 --- a/gdb/testsuite/gdb.dwarf2/dwz.exp +++ b/gdb/testsuite/gdb.dwarf2/dwz.exp @@ -82,22 +82,11 @@ Dwarf::assemble $asm_file { } } -if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != "" } { +if { [prepare_for_testing ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } -if { [gdb_compile $asm_file ${binfile}2.o object {nodebug}] != "" } { - return -1 -} - -if { [gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {}] != "" } { - return -1 -} - -clean_restart ${testfile} - if ![runto_main] { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implptrconst.exp b/gdb/testsuite/gdb.dwarf2/implptrconst.exp index 924d4c9ea96..46c26082f10 100644 --- a/gdb/testsuite/gdb.dwarf2/implptrconst.exp +++ b/gdb/testsuite/gdb.dwarf2/implptrconst.exp @@ -85,17 +85,8 @@ Dwarf::assemble $asm_file { } } -if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {}] != ""} { +if { [build_executable ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp index 06d231f1421..60a3d9f72c6 100644 --- a/gdb/testsuite/gdb.dwarf2/implptrpiece.exp +++ b/gdb/testsuite/gdb.dwarf2/implptrpiece.exp @@ -103,17 +103,8 @@ Dwarf::assemble $asm_file { } } -if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {}] != ""} { +if { [build_executable ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/method-ptr.exp b/gdb/testsuite/gdb.dwarf2/method-ptr.exp index 53a3f737abd..7ab8cbd17aa 100644 --- a/gdb/testsuite/gdb.dwarf2/method-ptr.exp +++ b/gdb/testsuite/gdb.dwarf2/method-ptr.exp @@ -77,21 +77,10 @@ Dwarf::assemble $asm_file { } } -if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != ""} { +if { [prepare_for_testing ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } -if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {c++}] != ""} { - return -1 -} - -clean_restart ${testfile} - gdb_test "ptype the_typedef" \ "type = int \\(S::\\*\\)\\(S \\* const, float\\)" diff --git a/gdb/testsuite/gdb.dwarf2/missing-sig-type.exp b/gdb/testsuite/gdb.dwarf2/missing-sig-type.exp index 8ccfa43ccb1..9012604a7d8 100644 --- a/gdb/testsuite/gdb.dwarf2/missing-sig-type.exp +++ b/gdb/testsuite/gdb.dwarf2/missing-sig-type.exp @@ -49,20 +49,9 @@ Dwarf::assemble $asm_file { } } -if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != ""} { +if { [prepare_for_testing ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } -if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {c++}] != ""} { - return -1 -} - -clean_restart ${testfile} - gdb_test "ptype foo" "type = " diff --git a/gdb/testsuite/gdb.dwarf2/nostaticblock.exp b/gdb/testsuite/gdb.dwarf2/nostaticblock.exp index 9685cc13690..bd4345e9416 100644 --- a/gdb/testsuite/gdb.dwarf2/nostaticblock.exp +++ b/gdb/testsuite/gdb.dwarf2/nostaticblock.exp @@ -35,22 +35,11 @@ Dwarf::assemble $asm_file { } } -if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != ""} { +if { [build_executable ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } -if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {c++}] != ""} { - return -1 -} - -clean_restart ${testfile} - set saved_gdbflags $GDBFLAGS set GDBFLAGS "$GDBFLAGS --readnow" clean_restart $testfile diff --git a/gdb/testsuite/gdb.dwarf2/subrange.exp b/gdb/testsuite/gdb.dwarf2/subrange.exp index 956a7e9e6cc..21f1c3ae1da 100644 --- a/gdb/testsuite/gdb.dwarf2/subrange.exp +++ b/gdb/testsuite/gdb.dwarf2/subrange.exp @@ -60,22 +60,11 @@ Dwarf::assemble $asm_file { } } -if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \ - object {nodebug}] != ""} { +if { [prepare_for_testing ${testfile}.exp ${testfile} \ + [list $srcfile $asm_file] {nodebug}] } { return -1 } -if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} { - return -1 -} - -if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \ - "${binfile}" executable {c++}] != ""} { - return -1 -} - -clean_restart ${testfile} - gdb_test_no_output "set language pascal" gdb_test "ptype TByteArray" \ -- 2.30.2