public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Lancelot SIX <lancelot.six@amd.com>, gdb-patches@sourceware.org
Cc: lsix@lancelotsix.com
Subject: Re: [PATCH] [testsuite] gdb.base/dlmopen: Fix test name and use gdb_attach
Date: Fri, 4 Nov 2022 12:10:17 -0400	[thread overview]
Message-ID: <6dab4cb2-c1d5-35d3-a295-9c8a5b4927d8@simark.ca> (raw)
In-Reply-To: <20221104155703.756252-1-lancelot.six@amd.com>

On 11/4/22 11:57, Lancelot SIX via Gdb-patches wrote:
> One test name in gdb.base/dlmopen.exp changes from run to run
> since it includes a process id:
> 
>     PASS: gdb.base/dlmopen.exp: attach 3442682
> 
> This is not convenient do diff gdb.sum files to compare test runs.
> 
> Fix by using gdb_attach helper function to handle attaching to the
> process as it produce a constant test name.
> 
> While at it also check gdb_attach's return value to only run the
> rest of the test if the attach was successful.
> ---
>  gdb/testsuite/gdb.base/dlmopen.exp | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/dlmopen.exp b/gdb/testsuite/gdb.base/dlmopen.exp
> index a80db75f9ac..9a2c9d78636 100644
> --- a/gdb/testsuite/gdb.base/dlmopen.exp
> +++ b/gdb/testsuite/gdb.base/dlmopen.exp
> @@ -159,16 +159,16 @@ set test_spawn_id [spawn_wait_for_attach $binfile]
>  set testpid [spawn_id_get_pid $test_spawn_id]
>  
>  # Attach.
> -gdb_test "attach $testpid" "Attaching to program.*, process $testpid.*"
> +if { [gdb_attach $testpid] } {
> +    with_test_prefix "attach" {
> +	# Remove the pause.  We no longer need it.
> +	gdb_test "print wait_for_gdb = 0" "\\\$1 = 0"

I would prefer doing an early return:

if { ![gdb_attach $testpid] } {
    return
}

... just because it keeps the following code at the original column.
But regardless:

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

  reply	other threads:[~2022-11-04 16:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 15:57 Lancelot SIX
2022-11-04 16:10 ` Simon Marchi [this message]
2022-11-04 16:13   ` 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=6dab4cb2-c1d5-35d3-a295-9c8a5b4927d8@simark.ca \
    --to=simark@simark.ca \
    --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).