public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Cc: Pedro Alves <pedro@palves.net>
Subject: [committed][gdb/testsuite] Fix gdb.threads/manythreads.exp with check-read1
Date: Sat, 4 Jun 2022 11:16:57 +0200	[thread overview]
Message-ID: <290e44d3-b75a-a48f-3678-f4194540c70b@suse.de> (raw)
In-Reply-To: <20220525123430.GA22147@delia>

On 5/25/22 14:34, Tom de Vries wrote:
> Hi,
> 
> When running test-case gdb.threads/manythreads.exp with check-read1, I ran
> into this hard-to-reproduce FAIL:
> ...
> [New Thread 0x7ffff7318700 (LWP 31125)]^M
> [Thread 0x7ffff7321700 (LWP 31124) exited]^M
> [New T^C^M
> ^M
> Thread 769 "manythreads" received signal SIGINT, Interrupt.^M
> [Switching to Thread 0x7ffff6d66700 (LWP 31287)]^M
> 0x00007ffff7586a81 in clone () from /lib64/libc.so.6^M
> (gdb) FAIL: gdb.threads/manythreads.exp: stop threads 1
> ...
> 
> The matching in the failing gdb_test_multiple is done in an intricate way,
> trying to pass on some order and fail on another order.
> 
> Fix this by rewriting the regexps to match one line at most, and detecting
> invalid order by setting and checking state variables.
> 
> Tested on x86_64-linux.
> 
> Any comments?

Committed.

Thanks,
- Tom

> [gdb/testsuite] Fix gdb.threads/manythreads.exp with check-read1
> 
> ---
>   gdb/testsuite/gdb.threads/manythreads.exp | 34 +++++++++++++++++--------------
>   1 file changed, 19 insertions(+), 15 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp
> index f2b8bb791c6..8e0df3ef95c 100644
> --- a/gdb/testsuite/gdb.threads/manythreads.exp
> +++ b/gdb/testsuite/gdb.threads/manythreads.exp
> @@ -63,21 +63,12 @@ proc interrupt_and_wait { message } {
>   
>       send_gdb "\003"
>   
> +    set saw_signal 0
> +    set order_ok 1
>       gdb_test_multiple "" $message {
> -	-re "\\\[New \[^\]\]*\\\]\r\n" {
> -	    exp_continue
> -	}
> -	-re "\\\[\[^\]\]* exited\\\]\r\n" {
> -	    exp_continue
> -	}
> -	-re " received signal SIGINT.*$gdb_prompt $" {
> -	    pass "$message"
> -	}
> -	-re "$gdb_prompt $" {
> -	    # Note that with this regex order, if GDB emits [New
> -	    # Thread ...] output between "Thread NNN received signal"
> -	    # and the prompt, the "received signal" regex won't match.
> -	    # That's good, as if we see that happening, it's a
> +	-re "\r\n\\\[New \[^\r\n\]*(?=\r\n)" {
> +	    # Note if GDB emits [New Thread ...] output between
> +	    # "Thread NNN received signal" and the prompt, it's a
>   	    # regression.
>   	    #
>   	    # GDB makes sure to notify about signal stops, end of
> @@ -100,7 +91,20 @@ proc interrupt_and_wait { message } {
>   	    #  foo () at foo.c:31
>   	    #  31      bar ();
>   	    #
> -	    fail $message
> +	    if { $saw_signal } {
> +		set order_ok 0
> +	    }
> +	    exp_continue
> +	}
> +	-re "\r\n\\\[\[^\r\n]* exited\\\](?=\r\n)" {
> +	    exp_continue
> +	}
> +	-re "\r\n\[^\r\n]* received signal SIGINT\[^\r\n\]*(?=\r\n)" {
> +	    set saw_signal 1
> +	    exp_continue
> +	}
> +	-re -wrap "" {
> +	    gdb_assert {$saw_signal && $order_ok} $gdb_test_name
>   	}
>       }
>   }

      reply	other threads:[~2022-06-04  9:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-25 12:34 [PATCH][gdb/testsuite] " Tom de Vries
2022-06-04  9:16 ` Tom de Vries [this message]

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=290e44d3-b75a-a48f-3678-f4194540c70b@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).