[LTP] [PATCH v3 2/3] testcase: make use of .supported_archs

Li Wang liwang@redhat.com
Tue Nov 9 07:52:14 CET 2021


On Mon, Nov 8, 2021 at 8:40 PM Cyril Hrubis <chrubis@suse.cz> wrote:

> Hi!
> >       asm volatile (
> >               "add $0x400, %%esp\n\t"
> >               "int $0x80\n\t"
> > @@ -114,15 +112,14 @@ static void run(void)
> >
> >  static struct tst_test test = {
> >       .test_all = run,
> > +     .supported_archs = (const char *const []) {
> > +             "i386",
> > +             "ppc",
> > +             NULL
> > +     },
> >       .tags = (const struct tst_tag[]) {
> >               {"linux-git", "cf01fb9985e8"},
> >               {"CVE", "CVE-2017-7616"},
> >               {}
> >       }
> >  };
> > -
> > -#else /* #if defined(__x86_64__) || defined(__powerpc__) */
> > -
> > -TST_TEST_TCONF("not i386 or powerpc");
> > -
> > -#endif /* #else #if defined(__x86_64__) || defined(__powerpc__) */
>
> Accordingly to this table:
>
> https://wiki.debian.org/ArchitectureSpecificsMemo
>
> __powerpc__ matches both 32bit and 64bit variants.
>
> I guess that we would have to change the checks in the library as:
>

Yes, but I think we can simply reverse the order to solve this.
It will try to match 64bit firstly otherwise 32bit. The s390 does as well.

....
#elif defined(__powerpc64__ || __ppc64__)
        .name = "ppc64",
        .type = TST_PPC64,
#elif defined(__powerpc__ || __ppc__)
        .name = "ppc",
        .type = TST_PPC,
#elif defined(__s390x__)
        .name = "s390x",
        .type = TST_S390X,
#elif defined(__s390__)
        .name = "s390",
        .type = TST_S390,
....



>
> #ifdef __powerpc__
> # ifdef __powerpc64__ || __ppc64__
> .arch = "ppc64",
> .type = TST_PPC64,
> # else
> .arch = "ppc",
> .type = "TST_PPC"
> # endif
> #endif
>
> Also I guess that gcc does not define __x86__ for historical reasons and
> __i386__ really means __x86__, but I haven't checked that one.
>

You are right. And next we have to get rid of __x86__ from ltp testcase.


-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20211109/3f2377bd/attachment.htm>


More information about the ltp mailing list