From: Andrew Burgess <aburgess@redhat.com>
To: Tom Tromey <tromey@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix list.exp test cases
Date: Thu, 24 Feb 2022 18:13:40 +0000 [thread overview]
Message-ID: <20220224181340.GU2571@redhat.com> (raw)
In-Reply-To: <20220224154029.940785-1-tromey@adacore.com>
* Tom Tromey via Gdb-patches <gdb-patches@sourceware.org> [2022-02-24 08:40:29 -0700]:
> 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.
If we're going to clean this up, maybe we could switch to use
gdb_test_multiple, which would allow the use of $gdb_test_name, and
remove the need for send_gdb calls.
Something like the patch below?
Thanks,
Andrew
---
commit 2db58395c641adedc8d198786aa0dbb6424cc766
Author: Tom Tromey <tromey@adacore.com>
Date: Thu Feb 24 08:40:29 2022 -0700
gdb/testsuite: fix list.exp test cases
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
diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp
index d035d9b1613..d11d35e6697 100644
--- a/gdb/testsuite/gdb.base/list.exp
+++ b/gdb/testsuite/gdb.base/list.exp
@@ -251,36 +251,28 @@ 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
+ gdb_test_multiple "list list0.c:main" "" {
+ -re -wrap "1\[ \t\]+#include .*10\[ \t\]+foo \[(\]+.*\[)\]+;" {
+ pass $gdb_test_name
}
- -re "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
- pass "list function in source file 1"
+ -re -wrap "5\[ \t\]+int x;.*14\[ \t\]+foo \[(\]+.*\[)\]+;" {
+ pass $gdb_test_name
}
- -re ".*$gdb_prompt $" { fail "list list0.c:main" }
- timeout { fail "list list0.c:main (timeout)" }
}
# Not sure what the point of having this function be unused is.
# AIX is legitimately removing it.
setup_xfail "rs6000-*-aix*"
- send_gdb "list list0.c:unused\n"
- gdb_expect {
- -re "40\[ \t\]+unused.*${last_line_re}\r\n$gdb_prompt $" {
- incr testcnt
+ gdb_test_multiple "list list0.c:unused" "" {
+ -re -wrap "40\[ \t\]+unused.*${last_line_re}" {
+ pass $gdb_test_name
}
- -re "37.*42\[ \t\]+\}\r\n$gdb_prompt $" {
- incr testcnt
+ -re -wrap "37.*42\[ \t\]+\}" {
+ pass $gdb_test_name
}
- -re ".*$gdb_prompt $" { fail "list list0.c:unused" }
- timeout { fail "list list0.c:unused (timeout)" }
}
clear_xfail "rs6000-*-aix*"
@@ -290,58 +282,47 @@ proc test_list_filename_and_function {} {
# SunPRO cc is the third case.
setup_xfail "rs6000-*-*" 1804
setup_xfail_format "COFF"
- send_gdb "list list0.h:foo\n"
- gdb_expect {
- -re "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
- incr testcnt
+ gdb_test_multiple "list list0.h:foo" "" {
+ -re -wrap "2\[ \t\]+including file. This.*11\[ \t\]+bar \[(\]+.*\[)\]+;" {
+ pass $gdb_test_name
}
- -re "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
- incr testcnt
+ -re -wrap "1\[ \t\]+/. An include file.*10\[ \t\]+bar \[(\]+.*\[)\]+;" {
+ pass $gdb_test_name
}
- -re "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;\r\n$gdb_prompt $" {
- incr testcnt
+ -re -wrap "3\[ \t\]+.*12\[ \t\]+bar \[(\]+.*\[)\]+;" {
+ pass $gdb_test_name
}
- -re "No source file named list0.h.\r\n$gdb_prompt $" {
- fail "list list0.h:foo"
+ -re -wrap "No source file named list0.h." {
+ fail $gdb_test_name
}
- -re ".*$gdb_prompt $" { fail "list list0.h:foo" }
- timeout { fail "list list0.h:foo (timeout)" }
}
# Ultrix gdb is the second case.
- send_gdb "list list1.c:bar\n"
- gdb_expect {
- -re "4\[ \t\]+void.*13\[ \t\]+\}\r\n$gdb_prompt $" {
- incr testcnt
+ gdb_test_multiple "list list1.c:bar" "" {
+ -re -wrap "4\[ \t\]+void.*13\[ \t\]+\}" {
+ pass $gdb_test_name
}
- -re "4\[ \t\]+void.*12\[ \t\]*long_line ..;\r\n$gdb_prompt $" {
- incr testcnt
+ -re -wrap "4\[ \t\]+void.*12\[ \t\]*long_line ..;" {
+ pass $gdb_test_name
}
- -re "4\[ \t\]+void.*11\[ \t\]*\r\n$gdb_prompt $" {
- incr testcnt
+ -re -wrap "4\[ \t\]+void.*11\[ \t\]*" {
+ pass $gdb_test_name
}
- -re ".*$gdb_prompt $" { fail "list list1.c:bar" }
- timeout { fail "list list1.c:bar (timeout)" }
}
# Not sure what the point of having this function be unused is.
# AIX is legitimately removing it.
setup_xfail "rs6000-*-aix*"
- send_gdb "list list1.c:unused\n"
- gdb_expect {
- -re "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}\r\n.*$gdb_prompt $" {
- incr testcnt
+ gdb_test_multiple "list list1.c:unused" "" {
+ -re -wrap "12\[ \t\]+long_line \[(\]\[)\];.*13\[ \t\]+\}.*" {
+ pass $gdb_test_name
}
- -re "14.*19\[ \t\]+\}\r\n.*$gdb_prompt $" {
- incr testcnt
+ -re -wrap "14.*19\[ \t\]+\}.*" {
+ pass $gdb_test_name
}
- -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.*"
next prev parent reply other threads:[~2022-02-24 18:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-24 15:40 Tom Tromey
2022-02-24 18:13 ` Andrew Burgess [this message]
2022-02-24 21:36 ` Tom Tromey
2022-02-25 11:51 ` Andrew Burgess
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=20220224181340.GU2571@redhat.com \
--to=aburgess@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@adacore.com \
/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).