From: Bruno Larsen <blarsen@redhat.com>
To: Lancelot SIX <lancelot.six@amd.com>, gdb-patches@sourceware.org
Cc: lsix@lancelotsix.com
Subject: Re: [PATCH] gdb/testsuite: Fix race in gdb.dwarf2/calling-convention.exp
Date: Wed, 30 Mar 2022 10:12:28 -0300 [thread overview]
Message-ID: <d5a18e10-1140-c998-5aa3-bfae2b81d2b7@redhat.com> (raw)
In-Reply-To: <20220330125013.137768-1-lancelot.six@amd.com>
On 3/30/22 09:50, Lancelot SIX via Gdb-patches wrote:
> Pedro Alves warned me that there is a race in
> gdb.dwarf2/calling-convention.exp making the test sometimes fail on his
> setup. This can be reliably reproduced using :
>
> make check-read1 TESTS="gdb.dwarf2/calling-convention.exp"
>
> The relevant part of the gdb.log file is:
>
> return 35
> Function 'foo' does not follow the target calling convention.
> If you continue, setting the return value will probably lead to unpredictable behaviors.
> Make foo return now? (y or n) PASS: gdb.dwarf2/calling-convention.exp: return 35
> n
> Not confirmed
> (gdb) FAIL: gdb.dwarf2/calling-convention.exp: finish
>
> The issue is that when doing the test for "return 35", the DejaGnu test
> sends "n" (to tell GDB not to perform the return action) but never
> consumes the "Not confirmed" acknowledgment sent by GDB. Later, when
> trying to do the next test, DejaGnu tries to match the leftover output
> from the "return" test. As this output is not expected, the test fails.
>
> Fix this by consuming the "Not confirmed\r\n$gdb_prompt " output.
>
> While at cleaning up this test, also improve the regex for the return
> test:
> - Remove the leading ".*" pattern.
> - Replace the "$" (end of line marker) with "\$" because it does not
> identify a TCL variable.
>
> Tested on x86_64-gnu-linux, using
>
> - make check TESTS="gdb.dwarf2/calling-convention.exp"
> - make check-read1 TESTS="gdb.dwarf2/calling-convention.exp"
>
> Change-Id: I42858b13db2cbd623c5c1739de65ad423e0c0938
Thanks for looking at this! It had me quite confused. The change and explanation looks good to me, but I can't approve patches.
> ---
> gdb/testsuite/gdb.dwarf2/calling-convention.exp | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.dwarf2/calling-convention.exp b/gdb/testsuite/gdb.dwarf2/calling-convention.exp
> index 0a11cb15c68..7ea9ae7c768 100644
> --- a/gdb/testsuite/gdb.dwarf2/calling-convention.exp
> +++ b/gdb/testsuite/gdb.dwarf2/calling-convention.exp
> @@ -84,9 +84,9 @@ gdb_breakpoint "foo"
> gdb_continue_to_breakpoint "foo"
>
> gdb_test_multiple "return 35" "" {
> - -re ".*Function 'foo' does not follow the target calling convention.\r\nIf you continue, setting the return value will probably lead to unpredictable behaviors.\r\nMake foo return now?.*\\(y or n\\) $" {
> - send_gdb "n\n"
> + -re "Function 'foo' does not follow the target calling convention.\r\nIf you continue, setting the return value will probably lead to unpredictable behaviors.\r\nMake foo return now?.*\\(y or n\\) \$" {
> pass $gdb_test_name
> + gdb_test "n" "Not confirmed" "Cancel return"
> }
> }
>
>
> base-commit: 5321c31bc78379a33f07dc7bef9256d05b942ad7
--
Cheers!
Bruno Larsen
next prev parent reply other threads:[~2022-03-30 13:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-30 12:50 Lancelot SIX
2022-03-30 13:12 ` Bruno Larsen [this message]
2022-03-30 14:21 ` Pedro Alves
2022-03-30 14:46 ` Lancelot SIX
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=d5a18e10-1140-c998-5aa3-bfae2b81d2b7@redhat.com \
--to=blarsen@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=lancelot.six@amd.com \
--cc=lsix@lancelotsix.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).