public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] sim: testsuite: push $arch out to targets
Date: Fri, 22 Jan 2021 01:36:05 -0500	[thread overview]
Message-ID: <YApyVRlk65IGZThI@vapier> (raw)
In-Reply-To: <20210121092253.GW265215@embecosm.com>

On 21 Jan 2021 09:22, Andrew Burgess wrote:
> * Mike Frysinger <vapier@gentoo.org> [2021-01-18 13:01:53 -0500]:
> > On 18 Jan 2021 09:52, Andrew Burgess wrote:
> > > * Mike Frysinger [2021-01-17 11:09:45 -0500]:
> > > > This is needed to move to automake & its dejagnu-provided logic,
> > > > and eventually by the unified sim logic.
> > > 
> > > I looked through this patch and I didn't understand what's going on
> > > here.
> > > 
> > > If this needs doing at all, could it not be done in some global location?
> > 
> > the sim ports use a unique subdir for their `run` program.  the tests
> > need to find that path.  this $arch value is what binds the specific
> > subdir to the test.
> 
> I don't understand that paragraph I'm afraid.
> 
> I guess my question is each *.exp file gets invoked by dejagnu, but
> there are other hooks that dejagnu calls, like the ${tool}_init proc.
> Could we not use that to set these things instead?  It seems like
> there's a 1:1 mapping between [istarget ????] patterns and the values
> pushed into both arch and all_machs.

i'm not seeing how any hooks would help.  the targets need to know where
their sim program lives.  let me brain dump on you :p.

lets look at a bfin & frv build tree.
build-bfin-elf/
`-- sim/
    `-- bfin/
        `-- run
build-frv-elf/
`-- sim/
    `-- frv/
        `-- run

sim/testsuite/frv/*.exp files need to know to look for $(builddir)/frv/run
while sim/testsuite/bfin/*.exp files need $(builddir)/bfin/run.

i know the variable is called $arch and that can be confusing.  i could
rename it if it helps.  just keep in mind that this is used for exactly
one thing: where to find `run` under $(builddir)/.

when we invoke dejagnu, it was with --tool=sim.  if we had combined trees
with other tools (gas/gdb/etc...), this would make sense, but it doesn't,
so we changed it to --tool="".  now when you run `runtest`, it will find
all *.exp files under sim/testsuite/ and attempt to execute them.

today, for any given target, there is at most one sim port available to
them.  the opposite obviously cannot be said:
* bfin-*-* will match the bare-metal, the Linux FLAT, and the Linux FDPIC
  toolchains, not to mention every infinite variation of the vendor field
* arm*-*-* will match every ARM CPU variant out there, plus every other
  OS & vendor variant

if we focus on [istarget ????] to $arch mappings, they would only map to
one $arch value, but more than one ???? can map to the same $arch.  i
don't mean this in terms of the infinite tuples i mentioned above, but
in a more real world sense:
* mips/*.exp has many variations
* h8300/*.exp has a few variations
* cris/**.exp has a few variations

this is why stuffing the $arch from configure.tgt has worked OK up to
now: it controls whether the sim port is enabled (e.g. bfin-*-*), and
then the tests will run only for a subset (e.g. [istarget bfin-*-elf]).

but the [istarget] check is a relic of the past.  we should not care
what we're targetting, we should care whether the sim port is enabled.
so for most arches, i could flip the check like:
	-if [istarget bfin-*-elf] {
	+set arch "bfin"
	+set sim "$objdir/../$arch/run"
	+if [file exists $sim] {

but some ports have assumptions built into their testsuites that i
don't want to untangle today.  and assumptions in the toolchain like
gas not supporting multitarget well.

so getting back to why i'm pushing $arch out: as an incremental step
to multibuild & eventually multitarget.  in multibuild, i have now:
build/
`-- sim/
    |-- arm/
    |   `-- run
    |-- bfin/
    |   `-- run
    |-- frv/
    |   `-- run
    ...

with multitarget, we'd start with the multibuild layout above, but
slowly migrate ports one-by-one to:
build/
`-- sim/
    |-- run     <-- supports multiple arches in one binary e.g. bfin
    |-- arm/    <-- arm hasn't migrated yet
    |           <-- no bfin because it's in the multione above
    |-- frv/    <-- frv hasn't migrated yet
    ...
even in a non-multitarget scenario, we'd still use the flat layout:
build-bfin/
`-- sim/
    `-- run

as the arch cuts over to multitarget, we'd also update its corresponding
*.exp settings so that it'd use sim/run instead of sim/$arch/run.  but
all the ones that haven't migrated would still need $arch set.

one might argue this change is a little premature when i don't have a
working multitarget build working now, but i found it helpful as i've
been migrating things to automake & a centralized build to do this now,
and i know we'll need to eventually kick the value out of configure.
so might as well do it now and be done.
-mike

  reply	other threads:[~2021-01-22  6:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-17 16:09 Mike Frysinger
2021-01-18  9:52 ` Andrew Burgess
2021-01-18 18:01   ` Mike Frysinger
2021-01-20 19:53     ` Tom Tromey
2021-01-21  0:37       ` Mike Frysinger
2021-01-22 16:29         ` Tom Tromey
2021-01-23  4:35           ` Mike Frysinger
2021-01-23 17:33             ` Tom Tromey
2021-01-25  5:34               ` Mike Frysinger
2021-01-21  9:22     ` Andrew Burgess
2021-01-22  6:36       ` Mike Frysinger [this message]
2021-01-31  1:27         ` Mike Frysinger
2021-01-31 10:54         ` Andrew Burgess
2021-01-31 19:41           ` Mike Frysinger
2021-02-06 17:16             ` Mike Frysinger
2021-02-08 12:12             ` Andrew Burgess
2021-02-09  5:25               ` Mike Frysinger
2021-01-18 17:54 ` [PATCH 1/2] sim: switch top level to automake Mike Frysinger
2021-01-18 17:54   ` [PATCH 2/2] sim: testsuite: merge into toplevel automake Mike Frysinger

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=YApyVRlk65IGZThI@vapier \
    --to=vapier@gentoo.org \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    /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).