[LTP] [PATCH] lib: do_setup(): Check for supported arch first
Andrea Cervesato
andrea.cervesato@suse.com
Tue Apr 29 17:17:12 CEST 2025
> The problem here is that with TST_TEST_TCONF() the supported architecture
> is not exported into the metadata.
>
> There are two cases where TST_TEST_TCONF() is used in LTP:
>
> - usupported architecture for the test
> - missing headers during compilation
>
> The first case should ideally be converted so that we have the supported
> architectures in the test metadata.
>
> Another option is just to add metadata to the tst_test structure and
> keep TST_TEST_TCONF(), but I do not like that solution, because the
> ifdefs and .supported_archs can go out of sync easily because tst_test
> structure is not used when TST_TEST_TCONF() is used.
>
Ok now it's more clear thanks.
What about adding a macro like TST_TEST_TCONF that sets archs? At the
end, that's what we actually do already in the tst_test structure for
tconf_msg:
#define TST_TEST_TCONF(message) \
static struct tst_test test = { .tconf_msg = message } \
Something like:
#define TST_TEST_TCONF2(message, archs) \
static struct tst_test test = { .tconf_msg = message,
.supported_archs = archs } \
I know it's ugly the way I implemented it here, but it's just to
understand. So we could have only one preprocessor directive checking
for arches and TST_TEST_TCONF2 setting up the metadata anyway.
In general, I don't like adding multiple preprocessor statements inside
tests because code would be puzzled with multiple arch definitions
checks. Maybe you have a better idea than me for this TST_TEST_TCONF2
implementation.
- Andrea
More information about the ltp
mailing list