From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [pushed 4/4] [gdb/testsuite] Make gdb.dwarf2/dwzbuildid.exp more robust
Date: Fri, 8 Sep 2023 12:28:06 +0200 [thread overview]
Message-ID: <20230908102806.13015-4-tdevries@suse.de> (raw)
In-Reply-To: <20230908102806.13015-1-tdevries@suse.de>
I ran test-case gdb.dwarf2/dwzbuildid.exp with target board cc-with-gdb-index,
and noticed that compilation failure for one exec prohibited testing of all
execs.
Fix this by restructuring the test-case, such that we have:
...
PASS: gdb.dwarf2/dwzbuildid.exp: testname=ok: set debug-file-directory
PASS: gdb.dwarf2/dwzbuildid.exp: testname=ok: print the_int
UNSUPPORTED: gdb.dwarf2/dwzbuildid.exp: testname=mismatch: compilation failed
UNSUPPORTED: gdb.dwarf2/dwzbuildid.exp: testname=fallback: compilation failed
...
Tested on x86_64-linux.
---
gdb/testsuite/gdb.dwarf2/dwzbuildid.exp | 70 ++++++++++++-------------
1 file changed, 35 insertions(+), 35 deletions(-)
diff --git a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
index 81cefc60dfc..76e3a7d6e42 100644
--- a/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwzbuildid.exp
@@ -134,46 +134,46 @@ for {set i 2} {$i <= 8} {incr i} {
# Copy a file into the .build-id place for the "fallback" test.
file copy -force -- ${binfile}8.o $basedir/$ok_prefix/$ok_suffix2.debug
-# Link the executables.
-if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] ${binfile}-ok \
- executable {}] != ""} {
- return -1
-}
-
-if {[gdb_compile [list ${binfile}1.o ${binfile}4.o] ${binfile}-mismatch \
- executable {quiet}] != ""} {
- return -1
-}
+proc do_test {} {
+ clean_restart
-if {[gdb_compile [list ${binfile}1.o ${binfile}6.o] ${binfile}-fallback \
- executable {}] != ""} {
- return -1
-}
+ gdb_test_no_output "set debug-file-directory $::debugdir" \
+ "set debug-file-directory"
+ gdb_load ${::binfile}-${::testname}
-foreach testname {ok mismatch fallback} {
- with_test_prefix $testname {
- clean_restart
+ if { $::testname == "mismatch" && [readnow] } {
+ # Main is found in the minimal symbols. When using readnow, a
+ # failure to read the dwarf also causes the minimal symbols to be
+ # unavailable.
+ # Setup a kfail for "FAIL: gdb_breakpoint: set breakpoint at main".
+ setup_kfail "symtab/26797" *-*-*
+ }
+ if {![runto_main]} {
+ return
+ }
- gdb_test_no_output "set debug-file-directory $debugdir" \
- "set debug-file-directory"
+ if {$::testname == "mismatch"} {
+ gdb_test "print the_int" \
+ "(No symbol table is loaded|No symbol \"the_int\" in current context).*"
+ } else {
+ gdb_test "print the_int" " = 99"
+ }
+}
- gdb_load ${binfile}-${testname}
+foreach_with_prefix testname { ok mismatch fallback } {
+ if { $testname == "ok" } {
+ set objs [list ${binfile}1.o ${binfile}2.o]
+ } elseif { $testname == "mismatch" } {
+ set objs [list ${binfile}1.o ${binfile}4.o]
+ } elseif { $testname == "fallback" } {
+ set objs [list ${binfile}1.o ${binfile}6.o]
+ }
- if { $testname == "mismatch" && [readnow] } {
- # Main is found in the minimal symbols. When using readnow, a
- # failure to read the dwarf also causes the minimal symbols to be
- # unavailable.
- # Setup a kfail for "FAIL: gdb_breakpoint: set breakpoint at main".
- setup_kfail "symtab/26797" *-*-*
- }
- if {[runto_main]} {
- if {$testname == "mismatch"} {
- gdb_test "print the_int" \
- "(No symbol table is loaded|No symbol \"the_int\" in current context).*"
- } else {
- gdb_test "print the_int" " = 99"
- }
- }
+ if {[gdb_compile $objs ${binfile}-$testname executable {quiet}] != ""} {
+ unsupported "compilation failed"
+ continue
}
+
+ do_test
}
--
2.35.3
prev parent reply other threads:[~2023-09-08 10:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-08 10:28 [pushed 1/4] [gdb/testsuite] Fix build-ids in gdb.dwarf2/dwzbuildid.exp Tom de Vries
2023-09-08 10:28 ` [pushed 2/4] [gdb/testsuite] Add aranges " Tom de Vries
2023-09-08 10:28 ` [pushed 3/4] [gdb/testsuite] Add kfail " Tom de Vries
2023-09-08 10:28 ` Tom de Vries [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230908102806.13015-4-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).