From: Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
To: Pedro Alves <pedro@palves.net>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 03/29] gdb/testsuite: Remove duplicates from gdb.base/interp.exp
Date: Mon, 22 Nov 2021 17:33:57 +0000 [thread overview]
Message-ID: <20211122173357.iyzk2puf7uxcczie@Plymouth> (raw)
In-Reply-To: <def322b9-0434-09a9-5162-a0306d1cacc9@palves.net>
[-- Attachment #1: Type: text/plain, Size: 5315 bytes --]
On Mon, Nov 22, 2021 at 02:13:59PM +0000, Pedro Alves wrote:
> On 2021-11-21 17:56, Lancelot SIX via Gdb-patches wrote:
> > # Regression test for crash when an exception occurs in mi_parse.
> > -gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \
> > - "regression test for mi_parse crash" {
> > +set cmd "interpreter-exec mi \"-break-insert --thread a\""
> > +gdb_test_multiple $cmd "regression test for mi_parse crash" {
>
> This "regression test for mi_parse crash" message is used if this
> gdb_test_multiple detects an internal error, a timeout, etc.
>
> > -re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " {
> > pass "$cmd"
>
> ... while here we use $cmd.
>
> This means that this test can have its result oscillate like this:
>
> -FAIL: regression test for mi_parse crash"
> +PASS: interpreter-exec mi "-break-insert --thread a"
> ...
> +PASS: interpreter-exec mi "-break-insert --thread a"
> -FAIL: regression test for mi_parse crash"
>
>
> The "modern" pattern would be to not have a $cmd variable at all, pass an empty
> string as second argument to gdb_test_multiple, and then passing $gdb_test_name
> to "pass". Like:
>
> gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" "" {
> -re .... {
> pass $gdb_test_multiple
> }
> }
>
>
> Though simplest is to pass $cmd as second argument too like other
> gdb_test_multiple invocations in the file:
>
> gdb_test_multiple $cmd $cmd {
> ...
>
>
>
> Could you take care of this while at it?
>
> Pedro Alves
Hi,
Thanks for the inputs.
I have updated the patch as follows.
This could maybe be split into two independent patches (one to fix the
DUPLICATE, which is a one-liner, and to refactor the various uses of
gdb_test_multiple), but I stayed with one which does the fix and
enforces consistency across the file.
Lancelot.
---
gdb/testsuite: Remove duplicates from gdb.base/interp.exp
When running the testsuite I have:
Running .../gdb/testsuite/gdb.base/interp.exp ...
DUPLICATE: gdb.base/interp.exp: interpreter-exec mi "-var-update *"
This is due to the fact that multiple successive instances of
gdb_test_multiple use 'pass $cmd', but one of them forgets to reset $cmd
to a new test name.
Fix by using 'pass $gdb_test_name', given that the gdb_test_name is set
by gdb_test_multiple.
While fixing this, this patch refactors all occurrences of the following
pattern:
set cmd foo
gdb_test_multiple $cmd $cmd {
-re ... {
pass $cmd
}
}
into
gdb_test_multiple foo "" {
-re ... {
pass $gdb_test_name
}
}
This makes this test file coherent in its use of $gdb_test_name.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.base/interp.exp | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp
index fc95ee113c2..1f2bde250fc 100644
--- a/gdb/testsuite/gdb.base/interp.exp
+++ b/gdb/testsuite/gdb.base/interp.exp
@@ -22,10 +22,9 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {debug}] } {
}
# Do not use gdb_test for this test, since it has two prompts.
-set cmd "interpreter-exec mi \"-var-update *\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi \"-var-update *\"" "" {
-re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
@@ -37,47 +36,43 @@ gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*"
gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \
"regression test for mi_parse crash" {
-re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
-set cmd "interpreter-exec mi \"-stack-info-frame\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi \"-stack-info-frame\"" "" {
-re ".error,msg=.No registers\..\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
-set cmd "interpreter-exec mi1 \"-break-insert main\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi1 \"-break-insert main\"" "" {
-re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
-set cmd "interpreter-exec mi2 \"-break-insert main\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi2 \"-break-insert main\"" "" {
-re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
-set cmd "interpreter-exec mi3 \"-break-insert main\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi3 \"-break-insert main\"" "" {
-re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
--
2.33.1
[-- Attachment #2: v2-0001-gdb-testsuite-Remove-duplicates-from-gdb.base-int.patch --]
[-- Type: text/plain, Size: 3496 bytes --]
From 318524ca1ac8fe3eeb2555f59f0b15fe88edcd74 Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lsix@lancelotsix.com>
Date: Fri, 19 Nov 2021 19:55:05 +0000
Subject: [PATCH v2] gdb/testsuite: Remove duplicates from gdb.base/interp.exp
When running the testsuite I have:
Running .../gdb/testsuite/gdb.base/interp.exp ...
DUPLICATE: gdb.base/interp.exp: interpreter-exec mi "-var-update *"
This is due to the fact that multiple successive instances of
gdb_test_multiple use 'pass $cmd', but one of them forgets to reset $cmd
to a new test name.
Fix by using 'pass $gdb_test_name', given that the gdb_test_name is set
by gdb_test_multiple.
While fixing this, this patch refactors all occurrences of the following
pattern:
set cmd foo
gdb_test_multiple $cmd $cmd {
-re ... {
pass $cmd
}
}
into
gdb_test_multiple foo "" {
-re ... {
pass $gdb_test_name
}
}
This makes this test file coherent in its use of $gdb_test_name.
Tested on x86_64-linux.
---
gdb/testsuite/gdb.base/interp.exp | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/gdb/testsuite/gdb.base/interp.exp b/gdb/testsuite/gdb.base/interp.exp
index fc95ee113c2..1f2bde250fc 100644
--- a/gdb/testsuite/gdb.base/interp.exp
+++ b/gdb/testsuite/gdb.base/interp.exp
@@ -22,10 +22,9 @@ if { [prepare_for_testing "failed to prepare" ${testfile} $srcfile {debug}] } {
}
# Do not use gdb_test for this test, since it has two prompts.
-set cmd "interpreter-exec mi \"-var-update *\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi \"-var-update *\"" "" {
-re "\\^done,changelist=\\\[\\\]\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
@@ -37,47 +36,43 @@ gdb_test "interpreter-exec console \"show version\"" "GNU gdb .*"
gdb_test_multiple "interpreter-exec mi \"-break-insert --thread a\"" \
"regression test for mi_parse crash" {
-re ".error,msg=.Invalid value for the '--thread' option.\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
-set cmd "interpreter-exec mi \"-stack-info-frame\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi \"-stack-info-frame\"" "" {
-re ".error,msg=.No registers\..\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
-set cmd "interpreter-exec mi1 \"-break-insert main\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi1 \"-break-insert main\"" "" {
-re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
-set cmd "interpreter-exec mi2 \"-break-insert main\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi2 \"-break-insert main\"" "" {
-re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
}
}
-set cmd "interpreter-exec mi3 \"-break-insert main\""
-gdb_test_multiple $cmd $cmd {
+gdb_test_multiple "interpreter-exec mi3 \"-break-insert main\"" "" {
-re ".done.bkpt=.number=.\[0-9\]\[^\n\]+\r\n$gdb_prompt " {
- pass "$cmd"
+ pass $gdb_test_name
gdb_expect 1 {
-re "\r\n$gdb_prompt $" { }
}
--
2.33.1
next prev parent reply other threads:[~2021-11-22 17:34 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-21 17:56 [PATCH 00/29] Remove DUPLICATEs from testsuite/gdb.base/*.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 01/29] gdb/testsuite: Remove duplicates from gdb.base/stack-checking.exp Lancelot SIX via Gdb-patches
2022-01-04 13:59 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 02/29] gdb/testsuite: Remove duplicates from gdb.base/miscexprs.exp Lancelot SIX via Gdb-patches
2021-12-10 22:06 ` Pedro Alves
2021-12-14 23:28 ` Lancelot SIX via Gdb-patches
2021-12-15 11:52 ` Pedro Alves
2022-01-04 14:00 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 03/29] gdb/testsuite: Remove duplicates from gdb.base/interp.exp Lancelot SIX via Gdb-patches
2021-11-22 14:13 ` Pedro Alves
2021-11-22 17:33 ` Lancelot SIX via Gdb-patches [this message]
2021-12-10 22:01 ` Pedro Alves
2021-11-21 17:56 ` [PATCH 04/29] gdb/testsuite: Remove duplicates from gdb.base/realname-expand.exp Lancelot SIX via Gdb-patches
2022-01-04 14:06 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 05/29] gdb/testsuite: Remove duplicates from gdb.base/pie-fork.exp Lancelot SIX via Gdb-patches
2022-01-04 14:07 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 06/29] gdb/testsuite: Remove duplicates from gdb.base/checkpoint.exp Lancelot SIX via Gdb-patches
2022-01-04 14:11 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 07/29] gdb/testsuite: Remove duplicates from gdb.base/pending.exp Lancelot SIX via Gdb-patches
2022-01-04 14:12 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 08/29] gdb/testsuite: Remove duplicates from gdb.base/decl-before-def.exp Lancelot SIX via Gdb-patches
2022-01-04 14:13 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 09/29] gdb/testsuite: Remove duplicates from gdb.base/solib-display.exp Lancelot SIX via Gdb-patches
2022-01-04 14:17 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 10/29] gdb/testsuite: Remove duplicates from gdb.base/del.exp Lancelot SIX via Gdb-patches
2022-01-04 14:20 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 11/29] gdb/testsuite: Remove duplicates from gdb.base/dfp-test.exp Lancelot SIX via Gdb-patches
2022-01-04 14:26 ` Andrew Burgess via Gdb-patches
2022-01-05 22:03 ` Lancelot SIX via Gdb-patches
2022-01-06 9:34 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 12/29] gdb/testsuite: Remove duplicates from gdb.base/ptype.exp Lancelot SIX via Gdb-patches
2022-01-04 15:13 ` Andrew Burgess via Gdb-patches
2021-11-21 17:56 ` [PATCH 13/29] gdb/testsuite: Remove duplicates from gdb.base/dfp-exprs.exp Lancelot SIX via Gdb-patches
2021-12-10 23:03 ` Pedro Alves
2021-12-15 0:01 ` Lancelot SIX via Gdb-patches
2021-12-15 11:54 ` Pedro Alves
2021-11-21 17:56 ` [PATCH 14/29] gdb/testsuite: Remove duplicates from gdb.base/subst.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 15/29] gdb/testsuite: Remove duplicates from gdb.base/complete-empty.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 16/29] gdb/testsuite: Remove duplicates from gdb.base/ui-redirect.exp Lancelot SIX via Gdb-patches
2021-12-10 23:15 ` Pedro Alves
2021-12-15 0:26 ` Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 17/29] gdb/testsuite: Remove duplicates from gdb.base/pretty-array.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 18/29] gdb/testsuite: Remove duplicates from gdb.base/readline.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 19/29] gdb/testsuite: Remove duplicates from gdb.base/exprs.exp Lancelot SIX via Gdb-patches
2021-12-10 23:15 ` Pedro Alves
2021-12-15 0:21 ` Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 20/29] gdb/testsuite: Remove duplicates from gdb.base/set-cfd.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 21/29] gdb/testsuite: Remove duplicates from gdb.base/shlib-call.exp Lancelot SIX via Gdb-patches
2021-12-10 23:24 ` Pedro Alves
2021-12-16 22:57 ` Lancelot SIX via Gdb-patches
2021-12-17 11:58 ` Pedro Alves
2021-11-21 17:56 ` [PATCH 22/29] gdb/testsuite: Remove duplicates from gdb.base/funcargs.exp Lancelot SIX via Gdb-patches
2021-12-10 23:26 ` Pedro Alves
2021-12-16 23:08 ` Lancelot SIX via Gdb-patches
2021-12-17 12:00 ` Pedro Alves
2021-11-21 17:56 ` [PATCH 23/29] gdb/testsuite: Remove duplicates from gdb.base/define-prefix.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 24/29] gdb/testsuite: Remove duplicates from gdb.base/unload.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 25/29] gdb/testsuite: Remove duplicates from gdb.base/pointers.exp Lancelot SIX via Gdb-patches
2021-12-10 23:27 ` Pedro Alves
2021-12-16 23:14 ` Lancelot SIX via Gdb-patches
2021-12-17 12:18 ` Pedro Alves
2021-12-17 23:14 ` Lancelot SIX via Gdb-patches
2022-01-05 16:05 ` Pedro Alves
2021-11-21 17:56 ` [PATCH 26/29] gdb/testsuite: Remove duplicates from gdb.base/call-signal-resume.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 27/29] gdb/testsuite: Remove duplicates from gdb.base/nested-subp2.exp Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 28/29] gdb/testsuite: Remove duplicates from gdb.base/watchpoints.exp Lancelot SIX via Gdb-patches
2021-12-10 23:30 ` Pedro Alves
2021-12-16 23:15 ` Lancelot SIX via Gdb-patches
2021-11-21 17:56 ` [PATCH 29/29] gdb/testsuite: Remove duplicates from gdb.base/corefile-buildid.exp Lancelot SIX via Gdb-patches
2021-12-10 23:38 ` Pedro Alves
2021-12-10 23:40 ` [PATCH 00/29] Remove DUPLICATEs from testsuite/gdb.base/*.exp Pedro Alves
2021-12-18 0:39 ` Lancelot SIX via Gdb-patches
2022-01-05 16:23 ` Pedro Alves
2022-01-07 22:36 ` Lancelot SIX via Gdb-patches
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=20211122173357.iyzk2puf7uxcczie@Plymouth \
--to=gdb-patches@sourceware.org \
--cc=lsix@lancelotsix.com \
--cc=pedro@palves.net \
/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