Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb-patches <gdb-patches@sourceware.org>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable
Date: Thu, 23 Sep 2021 11:12:21 -0400	[thread overview]
Message-ID: <5b995a81-afd0-adbb-1639-b1aecfa4d8e7@polymtl.ca> (raw)
In-Reply-To: <20210917224909.GA15407@delia>

On 2021-09-17 6:49 p.m., Tom de Vries via Gdb-patches wrote:
> Hi,
> 
> I noticed a pattern:
> ...
> if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
>     return -1
> }
> 
> foreach var {a b} {
>     clean_restart ${binfile}
>     ...
> }
> ...
> 
> In this case, gdb is restarted three times, while it's only necessary two
> times.
> 
> Fix this by replacing prepare_for_testing with build_executable.
> 
> I wrote a script that attempts this tranformation on each test-case (only the
> per-test part shown here):
> ...
>         cd $build
>         make check RUNTESTFLAGS=$test
>         sum=$build/testsuite/gdb.sum
>         if ! grep -q "expected passes" $sum; then
>             echo skipping $test
>             return
>         fi
> 
>         grep ^# $sum > ref.txt
>         sed -i 's/prepare_for_testing/build_executable/' $src/$test
>         make check RUNTESTFLAGS=$test
> 
>         grep ^# $sum > mod.txt
>         if cmp ref.txt mod.txt; then
>             return
>         else
>             ( cd $src; git ch -f $test )
>         fi
> ...
> 
> This patch is the result of running the script on all test-cases, minus the
> cases where prepare_for_testing was used in a comment.  Touches 76 test-cases.

I didn't check all changes, but I agree with the idea of the patch.

Simon

  reply	other threads:[~2021-09-23 15:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 22:49 Tom de Vries via Gdb-patches
2021-09-23 15:12 ` Simon Marchi via Gdb-patches [this message]
2021-09-23 21:43   ` Tom de Vries via Gdb-patches
2021-09-24 12:34     ` [PATCH][gdb/testsuite] Don't leave gdb instance running after function_range Tom de Vries via Gdb-patches
2021-09-24 13:56       ` Simon Marchi via Gdb-patches
2021-09-24 14:10 ` [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable Pedro Alves
2021-09-24 19:40   ` Tom de Vries 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=5b995a81-afd0-adbb-1639-b1aecfa4d8e7@polymtl.ca \
    --to=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tdevries@suse.de \
    /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