public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29036] [gdb][testcase-failure, taskset] FAIL: gdb.mi/mi-multi-commands.exp: args=separate-mi-tty: look for first command output, command length 234
Date: Mon, 02 May 2022 09:20:36 +0000	[thread overview]
Message-ID: <bug-29036-4717-uLqKcTxsdt@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29036-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29036

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Andrew Burgess from comment #2)
> Hi Tom,
> 
> Thanks for reporting this.  I took another look at the MI code, and I
> suspect this patch might be the way to go:
> 
> ## START ##
> 
> diff --git a/gdb/testsuite/gdb.mi/mi-multi-commands.exp
> b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
> index d00e0aaea8b..58187b15815 100644
> --- a/gdb/testsuite/gdb.mi/mi-multi-commands.exp
> +++ b/gdb/testsuite/gdb.mi/mi-multi-commands.exp
> @@ -100,7 +100,7 @@ proc run_test { args } {
>  	set seen_second_message false
>  
>  	gdb_test_multiple "" "look for first command output, command length $i"
> -prompt "$mi_gdb_prompt" {
> -	    -re "\\^done,value=\"\\\\\"FIRST COMMAND\\\\\"\"" {
> +	    -re "\\^done.*,value=\"\\\\\"FIRST COMMAND\\\\\"\"" {
>  		set seen_first_message true
>  		exp_continue
>  	    }
> 
> ## END ##
> 
> The problem is that the '^done' and the ',value="...."' are printed by two
> separate write calls, and so, depending on timing, it is possible that the
> terminal might choose to echo some output between these two write calls.
> 

I see, that makes sense.

> I don't think the same protection is needed for the "TEST COMPLETE" case
> (just below the hunk I patched above) as that message is from the second
> (and last command), thus by the time we are printing that we know there
> should be no additional incoming command text that might interrupt the
> command output.
> 

Ack, sounds reasonable.

> I tried a few times to reproduce the failure you are seeing (before
> patching) and was not successful.  If you can reproduce the failure more
> consistently, could you give this patch a go please and let me know if it
> fixes things.

For me it's not trivial to reproduce at this point, but I managed twice in an
(undisturbed, meaning afk) run of 100, like this:
...
$ for n in $(seq 1 100); do echo -n "$n: "; taskset -c 0 ./test.sh 2>&1 | grep
"expected passes"; cp gdb.log gdb.$n.log; done
...

Then, with your patch applied, I got clean results for all 100 runs.

So, LGTM.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-05-02  9:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-07 13:16 [Bug gdb/29036] New: " vries at gcc dot gnu.org
2022-04-29  9:33 ` [Bug gdb/29036] " vries at gcc dot gnu.org
2022-04-29  9:37 ` vries at gcc dot gnu.org
2022-04-29 11:15 ` aburgess at redhat dot com
2022-05-02  9:20 ` vries at gcc dot gnu.org [this message]
2022-05-09 15:57 ` cvs-commit at gcc dot gnu.org
2022-05-23 13:49 ` [Bug testsuite/29036] " vries at gcc dot gnu.org

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=bug-29036-4717-uLqKcTxsdt@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /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).