Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Li Wang <liwang@redhat.com>
Cc: LTP List <ltp@lists.linux.it>
Subject: Re: [LTP] [PATCH v2 1/3] lib: adding .arch field in tst_test structure
Date: Fri, 5 Nov 2021 15:22:43 +0100	[thread overview]
Message-ID: <YYU+M0vYgqu6Nzr+@yuki> (raw)
In-Reply-To: <CAEemH2cYPVqJBQzLoZwNCkv1m4X2o5LgOmVxr18mEyGrxjj9Ug@mail.gmail.com>

Hi!
> > > Also I guess that it would be slightly easier to work with as an enum,
> > > so that we can do:
> > >
> > >       switch (tst_arch) {
> > >       case TST_X86_64:
> > >               ...
> > >       break;
> > >       case TST_PPC64_LE:
> >
> > I prefer enum as well. As an aside, we don't want to include LE in
> >
> 
> Sure, but I'm now thinking to extend the tst_arch as a structure
> so that could also be used in a string:
> 
>     enum tst_arch_type {
>             TST_I386,
>             TST_X86_64,
>             ...
>             TST_SPARC,
>     };
> 
>     /*
>      * This tst_arch is to save the system architecture for
>      * using in the whole test case.
>      */
>     extern struct arch {
>              const char name[16];
>              enum tst_arch_type type;
>     } tst_arch;

Or we can add a function to translate the enums into strings as:

const char *tst_arch_name(enum tst_arch arch);

> then we just can do simply in case:
> 
>     switch (tst_arch.type) {
>     case TST_X86_64:
>         ...
>     break;
> 
> 
> 
> > ppc64. If someone finds that the byte order is significant for a test
> >
> 
> Yes, or we can read info via uname() into 'utsname.machine' for
> ppc64le if really needed.
> 
> 
> > then we can add ppc64le or ppc64be. Also at some point we may need to
> > add a "machine" field for e.g. POWER8, i386 etc.
> >
> 
> Adding a new field '.machine' maybe not be necessary if just
> for POWER8/9/10, or can we find a way to combine them together
> with .supported_arch?  Umm, I'm still hesitating.

This is going to get complicated quite fast. I do not think that we need
such granularity now, but if we ever do I think it can be done as a
subtype. E.g.:

enum tst_arch {
	TST_X86,
	TST_X86_64,
	TST_PPC64,
};

enum tst_x86_subarch {
	TST_386,
	TST_486,
	TST_686,
};

enum tst_ppc_subarch {
{
	TST_POWER8,
	TST_POWER9,
	TST_POWER10,
};

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

      parent reply	other threads:[~2021-11-05 14:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15  4:20 [LTP] [PATCH v2 1/3] lib: adding .arch field in tst_test structure Li Wang
2019-06-15  4:20 ` [LTP] [PATCH v2 2/3] testcase: taking use of .arch in tst_test Li Wang
2019-06-17 21:49   ` Petr Vorel
2019-06-15  4:20 ` [LTP] [PATCH v2 3/3] testcase: get rid of compiling errors Li Wang
2019-06-17 21:42   ` Petr Vorel
2019-06-17 21:44   ` Jan Stancek
2019-06-18  4:03     ` Li Wang
2019-06-17 21:46 ` [LTP] [PATCH v2 1/3] lib: adding .arch field in tst_test structure Petr Vorel
2019-06-18  2:53   ` Li Wang
2019-06-17 21:49 ` Petr Vorel
2019-06-18  3:07   ` Li Wang
2019-06-18  5:51     ` Petr Vorel
2021-11-03 12:00 ` Richard Palethorpe
2021-11-03 14:03   ` Li Wang
2021-11-03 14:10     ` Cyril Hrubis
2021-11-04 10:18       ` Li Wang
2021-11-04 10:26         ` Cyril Hrubis
2021-11-05  9:47           ` Richard Palethorpe
2021-11-05 13:23             ` Li Wang
2021-11-05 13:55               ` Richard Palethorpe
2021-11-05 14:22               ` Cyril Hrubis [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=YYU+M0vYgqu6Nzr+@yuki \
    --to=chrubis@suse.cz \
    --cc=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /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