[LTP] [PATCH] lib: do_setup(): Check for supported arch first
Andrea Cervesato
andrea.cervesato@suse.com
Tue Apr 29 16:55:28 CEST 2025
Hi Cyril,
On 4/29/25 15:55, Cyril Hrubis wrote:
> This commit moves the check for supported architecture before the check
> for test function existence. This allows us do ifdef out the run
> function pointer initialization and properly TCONF on unsupported
> platform.
>
> Example usage:
>
> #include "tst_test.h"
>
> #ifdef __x86_64__
> static void run(void)
> {
> ...
> }
> #endif
>
> struct tst_test test = {
> #ifdef __x86_64__
> .run = run,
> #endif
> .supported_archs = {"x86_64", NULL},
> }
>
I guess the reason is that we want to skip code which is not compiling
for our architecture, right?
But do we already have TST_TEST_CONF, so I'm a bit puzzled on the use case.
Isn't way more easy to use:
#ifndef __x86_64__
...
#else
TST_TEST_TCONF("Test supports x86_64 arch only");
#endif
And eventually combined statements can be used, so:
#if defined __i386__ || defined(__x86_64__)
...
is still valid and it looks easier to use.
- Andrea
More information about the ltp
mailing list