[LTP] [PATCH v5 1/3] lib: adding .supported_archs field in tst_test structure

Cyril Hrubis chrubis@suse.cz
Thu Nov 18 13:07:29 CET 2021


Hi!
> > Testcases for specific arch should be limited on that only being supported
> > platform to run, we now involve a .supported_archs to achieve this feature
> > in LTP library. All you need to run a test on the expected arch is to set
> > the '.supported_archs' array in the 'struct tst_test' to choose the required
> > arch list. e.g.
> >
> >      .supported_archs = (const char *const []){"x86_64", "ppc64", NULL}
> >
> > This helps move the TCONF info from code to tst_test metadata as well.
> 
> while I do like this, I wonder if it wouldn't be better to do this using 
> kernel config. IIRC there are config switches
> for all architectures. Further more this would allow adding more complex 
> conditions in the future.
> 
> E.g: I am pretty sure, that there are some syscalls, that have existed 
> "forever" in x86_64, but where only added
> in a specific version for aarch64. By making the arch a separate option, 
> there is no way, to model this.
> If it was done in the kernel config check, it could be possible to add 
> version and arch checks like
> (CONFIG_AARCH64 && CONFIG_VERSION > 5.3) || CONFIG_X86_64
> 
> While this probably does not produce a very good error message, it is 
> more versatile.
> 
> Sorry for this late questioning the whole approach.

Not at all, this is a good point.

The main problem is that the kernel architecture does not need to match
the binary architecture which is what this patchset tries to cover. That
means that 32bit binary on 64bit kernel would not match what we are
supposed to match. Even more the config variables are confusing, on
x86_64 with compat layer enabled we get:

CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y

That makes any reasoning quite messy.

What would make much more sense would be injecting LTP specific
variables to the parsed variables before evaluation. So for instance we
would insert BINARY_ARCH variable which would cover this exact case and
the check would look like:

"(BINARY_ARCH == "aarch64" && CONFIG_VERSION > 5.3) || CONFIG_X86_64"

However I would still like to have a simple list of supported
architectures in the test structure as well, since that is much easier
to read and reason about and it covers 99% of the cases. Nothing stops
us for adding the more complex checks in the case that we see the need
later on.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list