public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [RFC][gdb/testsuite] Register test for each arch separately in register_test_foreach_arch
Date: Mon, 20 Sep 2021 20:07:30 +0200	[thread overview]
Message-ID: <410fff03-8b65-184e-b96c-b9e0b79dac93@suse.de> (raw)
In-Reply-To: <1786b296-3fb6-881e-2e08-f030a0d5a513@polymtl.ca>

On 9/20/21 6:01 PM, Simon Marchi wrote:
> 
> 
> On 2021-09-13 11:40 a.m., Tom de Vries via Gdb-patches wrote:
>> Hi,
>>
>> In gdb/disasm-selftests.c we have:
>> ...
>>   selftests::register_test_foreach_arch ("print_one_insn",
>>                                          selftests::print_one_insn_test);
>> ...
>> and we get:
>> ...
>> $ gdb -q -batch -ex "maint selftest print_one_insn" 2>&1 \
>>   | grep ^Running
>> Running selftest print_one_insn.
>> $
>> ...
>>
>> Change the semantics register_test_foreach_arch such that a version of
>> print_one_insn is registered for each architecture, such that we have:
>> ...
>> $ gdb -q -batch -ex "maint selftest print_one_insn" 2>&1 \
>>   | grep ^Running
>> Running selftest print_one_insn::A6.
>> Running selftest print_one_insn::A7.
>> Running selftest print_one_insn::ARC600.
>>   ...
>> $
>> ...
>>
>> This makes it f.i. possible to do:
>> ...
>> $ gdb -q -batch a.out -ex "maint selftest print_one_insn::armv8.1-m.main"
>> Running selftest print_one_insn::armv8.1-m.main.
>> Self test failed: self-test failed at src/gdb/disasm-selftests.c:165
>> Ran 1 unit tests, 1 failed
>> ...
>>
>> Currently this runs into a bfd problem, filed at PR28336 - "bfd printable arch
>> names not unique" ( https://sourceware.org/bugzilla/show_bug.cgi?id=28336 ).
>>
>> Any comments?
> 
> I think the idea is good.

Great :)

> It's still possible to run the test for all
> arches, since the argument to "maint selftest" can match just a subset
> of the test name.  So we don't lose anything.

Ack.

> The problem with PR28336
> makes it so that we try to register tests with duplicate names, and that
> asserts?

Yes, but that PR's fixed now, so that assert no longer triggers.

[ FWIW, we could make things less dramatic by not asserting but throwing
an exception in register_test, and handling the exception in
register_test_foreach_arch.  But there's no immediate need atm, so I'll
leave it as is in this patch. ]

Thanks,
- Tom

      reply	other threads:[~2021-09-20 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 15:40 Tom de Vries
2021-09-20 16:01 ` Simon Marchi
2021-09-20 18:07   ` 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=410fff03-8b65-184e-b96c-b9e0b79dac93@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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).