Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Replace prepare_for_testing with build_executable
Date: Thu, 23 Sep 2021 23:43:14 +0200	[thread overview]
Message-ID: <13a04bcb-6842-a5ce-5457-ed4510a0a79b@suse.de> (raw)
In-Reply-To: <5b995a81-afd0-adbb-1639-b1aecfa4d8e7@polymtl.ca>

On 9/23/21 5:12 PM, Simon Marchi wrote:
> 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.

Good to hear.

I've reviewed all changes once more.

I found a problem in cpp-linkage-name.exp.  The test passes, but the gdb
commands execute on a lingering gdb instance started by function_range,
so I had to fix that first (by adding gdb_exit at the end of
function_range) to trigger the FAIL introduced by the script.  I've
removed the change in that test-case, and similar cases, and am
currently retesting.

Thanks,
- Tom

  reply	other threads:[~2021-09-23 21:43 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
2021-09-23 21:43   ` Tom de Vries via Gdb-patches [this message]
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=13a04bcb-6842-a5ce-5457-ed4510a0a79b@suse.de \
    --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