public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix list.exp test cases
@ 2022-02-24 15:40 Tom Tromey
  2022-02-24 18:13 ` Andrew Burgess
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2022-02-24 15:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

PR testsuite/7142 -- old enough to have been converted from Gnats --
points out that test_list_filename_and_function in gdb.base/list.exp
has "fails" that are unmatched with passes.  This patch cleans this up
a little.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=7142
---
 gdb/testsuite/gdb.base/list.exp | 28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index d035d9b1613..35206b993e1 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -251,18 +251,16 @@ proc test_list_filename_and_function {} {
     global gdb_prompt
     global last_line_re
 
-    set testcnt 0
-
     # gcc appears to generate incorrect debugging information for code
     # in include files, which breaks this test.
     # SunPRO cc is the second case below, it's also correct.
     send_gdb "list list0.c:main\n"
     gdb_expect {
 	-re "1\[ \t\]+#include .*10\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list0.c:main"
 	}
 	-re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
-	    pass "list function in source file 1"
+	    pass "list list0.c:main"
 	}
 	-re ".*$gdb_prompt $" { fail "list list0.c:main" }
 	timeout { fail "list list0.c:main (timeout)" }
@@ -274,10 +272,10 @@ proc test_list_filename_and_function {} {
     send_gdb "list list0.c:unused\n"
     gdb_expect {
 	-re "40\[ \t\]+unused.*${last_line_re}\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list0.c:unused"
 	}
 	-re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list0.c:unused"
 	}
 	-re ".*$gdb_prompt $" { fail "list list0.c:unused" }
 	timeout { fail "list list0.c:unused (timeout)" }
@@ -293,13 +291,13 @@ proc test_list_filename_and_function {} {
     send_gdb "list list0.h:foo\n"
     gdb_expect {
 	-re "2\[ \t\]+including file.  This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list0.h:foo"
 	}
 	-re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list0.h:foo"
 	}
 	-re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list0.h:foo"
 	}
 	-re "No source file named list0.h.\r\n$gdb_prompt $" {
 	    fail "list list0.h:foo"
@@ -312,13 +310,13 @@ proc test_list_filename_and_function {} {
     send_gdb "list list1.c:bar\n"
     gdb_expect {
 	-re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list1.c:bar"
 	}
 	-re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list1.c:bar"
 	}
 	-re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list1.c:bar"
 	}
 	-re ".*$gdb_prompt $" { fail "list list1.c:bar" }
 	timeout { fail "list list1.c:bar (timeout)" }
@@ -330,18 +328,16 @@ proc test_list_filename_and_function {} {
     send_gdb "list list1.c:unused\n"
     gdb_expect {
 	-re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list1.c:unused"
 	}
 	-re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" {
-	    incr testcnt
+	    pass "list list1.c:unused"
 	}
 	-re ".*$gdb_prompt $" { fail "list list1.c:unused" }
 	timeout { fail "list list1.c:unused (timeout)" }
     }
     clear_xfail "rs6000-*-aix*"
 
-    pass "list filename:function ($testcnt tests)"
-
     # Test with quoting.
     gdb_test "list 'list0.c:main'" "int main.*"
 
-- 
2.31.1


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

end of thread, other threads:[~2022-02-25 11:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24 15:40 [PATCH] Fix list.exp test cases Tom Tromey
2022-02-24 18:13 ` Andrew Burgess
2022-02-24 21:36   ` Tom Tromey
2022-02-25 11:51     ` Andrew Burgess

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