public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Avoid duplicate test in dw2-zero-range.exp
@ 2024-01-19 19:07 Tom Tromey
  2024-01-19 21:18 ` Simon Marchi
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2024-01-19 19:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I noticed that dw2-zero-range.exp reports a duplicate test name.  This
happens because have_index calls get_index_type with the default test
name.  This patch fixes the problem using with_test_prefix.
---
 gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
index 79ccd620b8b..265c1fd3651 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-zero-range.exp
@@ -122,7 +122,7 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
 
     # Test for presence of complaint, with lib1 relocated.
     with_complaints 1 {
-	set test "Zero address complaint - relocated - psymtab"
+	set test "Zero address - relocated - psymtab"
 	set have_complaint 0
 	gdb_test_multiple "maint with dwarf synchronous on -- sharedlibrary [file tail $lib1]" $test {
 	    -re -wrap $re {
@@ -133,8 +133,10 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
 	}
 
 	# The complaint won't be seen if an index is in use.
-	if {[have_index $lib1] == ""} {
-	    gdb_assert { $have_complaint } $test
+	with_test_prefix $test {
+	    if {[have_index $lib1] == ""} {
+		gdb_assert { $have_complaint } "complaint"
+	    }
 	}
     }
 
@@ -150,11 +152,13 @@ foreach_with_prefix ranges_sect {ranges rnglists} {
     gdb_test_no_output "maint set dwarf synchronous on"
     with_complaints 1 {
 	gdb_load $lib1
-	set test "Zero address complaint - unrelocated - psymtab"
+	set test "Zero address - unrelocated - psymtab"
 	set have_complaint [regexp $re.* $gdb_file_cmd_msg]
 	# The complaint won't be seen if an index is in use.
-	if {[have_index $lib1] == ""} {
-	    gdb_assert { $have_complaint } $test
+	with_test_prefix $test {
+	    if {[have_index $lib1] == ""} {
+		gdb_assert { $have_complaint } "complaint"
+	    }
 	}
     }
     gdb_test_no_output "maint set dwarf synchronous off"
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-22 19:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 19:07 [PATCH] Avoid duplicate test in dw2-zero-range.exp Tom Tromey
2024-01-19 21:18 ` Simon Marchi
2024-01-22 15:01   ` Tom Tromey
2024-01-22 19:54     ` Simon Marchi

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).