public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Lancelot SIX <lsix@lancelotsix.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: Lancelot SIX <lancelot.six@amd.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3] gdb/selftest-arch: Make register_test_foreach_arch generate arch tests lazily
Date: Tue, 19 Apr 2022 21:10:30 +0000	[thread overview]
Message-ID: <20220419211030.vo6foyt2xrvkotcs@ubuntu.lan> (raw)
In-Reply-To: <e35a8f37-d67d-0b25-7c50-48219ba9c234@polymtl.ca>

On Tue, Apr 19, 2022 at 02:55:19PM -0400, Simon Marchi wrote:
> On 2022-04-01 09:00, Lancelot SIX via Gdb-patches wrote:
> > The register_test_foreach_arch is used to instantiate a given selftest
> > for all architectures supported by GDB.  It is used in many _initialize_*
> > functions (under initialize_all_files, called by gdb_init).
> > 
> > Because the call is done during GDB's initialization, and because there
> > is no guaranty about the order in which all the _initialize_* functions
> > are executed, when register_test_foreach_arch is called, GDB is not
> > fully initialized.  Specifically, when a particular initialize function
> > is executed, only the architectures registered at that point are listed
> > by gdbarch_printable_names.
> > 
> > As a consequence, the list of selftest effectively executed depends on
> > the order the _initialize_* functions are called.  This can be observed
> > with the following:
> > 
> >     $ ./gdb/gdb \
> >         -data-directory ./gdb/data-directory \
> >         -quiet -batch -ex "maint selftest" 2>&1 \
> >         | grep -E "Ran [0-9]+ unit tests"
> >     Ran 145 unit tests, 0 failed
> >     $ GDB_REVERSE_INIT_FUNCTIONS=1 ./gdb/gdb \
> >         -data-directory ./gdb/data-directory \
> >         -quiet -batch -ex "maint selftest" 2>&1 \
> >         | grep -E "Ran [0-9]+ unit tests"
> >     Ran 82 unit tests, 0 failed
> > 
> > To fix this, make register_test_foreach_arch register a lazy selftest
> > generator.  This way when the test generator is eventually executed, all
> > architectures are registered and we do not have a dependency on the
> > order the initialize functions are executed in.
> > 
> > Tested on x86_64-linux
> 
> Hi Lancelot,
> 
> I see this new failure, when testing with the native-extended-gdbserver
> board:
> 
>     FAIL: gdb.gdb/unittest.exp: reversed initialization: maintenance selftest, failed none
> 
> Note that these two failures were already present before your patch,
> with the same board:
> 
>     FAIL: gdb.gdb/unittest.exp: no executable loaded: maintenance selftest, failed none
>     FAIL: gdb.gdb/unittest.exp: executable loaded: maintenance selftest, failed none
> 
> Simon

Hi,

Thanks for letting me know.  From the errors you show I am tempted to
think that the new failure is just the same as the previous ones.
Given that I run the selftests one more time (with gdb launched with
GDB_REVERSE_INIT_FUNCTIONS=1), if the testsuite was unable to launch
selftests before, it makes sence that this new execution produces a new
erroer.

I’ll still try to have a look to check if we can have a good condition
to skip those tests, or at least fail only once and skip the next
similar tests.

Best,
Lancelot.

  reply	other threads:[~2022-04-19 21:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 13:00 [PATCH 0/3] Fix register_test_foreach_arch Lancelot SIX
2022-04-01 13:00 ` [PATCH 1/3] gdbsupport/selftest: Replace for_each_selftest with an iterator_range Lancelot SIX
2022-04-01 13:00 ` [PATCH 2/3] gdbsupport/selftest: Allow lazy registration Lancelot SIX
2022-04-01 13:00 ` [PATCH 3/3] gdb/selftest-arch: Make register_test_foreach_arch generate arch tests lazily Lancelot SIX
2022-04-15 17:52   ` Tom Tromey
2022-04-15 18:10     ` Lancelot SIX
2022-04-15 18:50       ` Tom Tromey
2022-04-19 18:55   ` Simon Marchi
2022-04-19 21:10     ` Lancelot SIX [this message]
2022-04-12  8:17 ` [PING] [PATCH 0/3] Fix register_test_foreach_arch Lancelot SIX
2022-04-15 17:53 ` Tom Tromey
2022-04-19  8:18   ` 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=20220419211030.vo6foyt2xrvkotcs@ubuntu.lan \
    --to=lsix@lancelotsix.com \
    --cc=gdb-patches@sourceware.org \
    --cc=lancelot.six@amd.com \
    --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).