Hi Rasmus,

On 2026-05-22T21:27:48, Rasmus Villemoes <[email protected]> wrote:
> test: avoid use of special characters in ELF section names
>
> While the use of the ! and ~ characters currently works, it is a bit
> hacky, and conflicts with later patches that will require the
> arguments to ll_entry_start() to be allowed at least as assembly
> identifiers.
>
> linker_lists.rst actually describes how one can do what the test
> framework wants to do: We have one 'outer' list, ut, with individual
> 'inner' lists (each suite). In order to be able to delineate the outer
> list using the ordinary ll_ helpers, we just have to make sure that
> all the inner lists use the section name ut_2_<suite> instead of
> ut_<suite>.
>
> Signed-off-by: Rasmus Villemoes <[email protected]>
> Reviewed-by: Tom Rini <[email protected]>
>
> include/test/test.h | 15 +++++++--------
>  test/cmd_ut.c       |  4 ++--
>  2 files changed, 9 insertions(+), 10 deletions(-)

> diff --git a/include/test/test.h b/include/test/test.h
> @@ -169,13 +169,12 @@ struct unit_test {
>
>  /* Get the start of a list of unit tests for a particular suite */
>  #define UNIT_TEST_SUITE_START(_suite) \
> -     ll_entry_start(struct unit_test, ut_ ## _suite)
> +     ll_entry_start(struct unit_test, ut_2_ ## _suite)
>  #define UNIT_TEST_SUITE_COUNT(_suite) \
> -     ll_entry_count(struct unit_test, ut_ ## _suite)
> +     ll_entry_count(struct unit_test, ut_2_ ## _suite)
>
> -/* Use ! and ~ so that all tests will be sorted between these two values */
> -#define UNIT_TEST_ALL_START()        ll_entry_start(struct unit_test, ut_!)
> -#define UNIT_TEST_ALL_END()  ll_entry_start(struct unit_test, ut_~)
> +#define UNIT_TEST_ALL_START()        ll_entry_start(struct unit_test, ut)
> +#define UNIT_TEST_ALL_END()  ll_entry_end(struct unit_test, ut)

Each suite symbol now becomes _u_boot_list_ut_2_<suite>_2_<name>, so
the regex in test/py/conftest.py (already broken by patch 5) needs
further adjusting to capture the suite correctly.

generate_ut_subtest() and the docstring above UNIT_TEST() that calls
out the strict naming convention need updating in lockstep, otherwise
test_ut.py / test_spl.py / test_vpl.py silently stop generating
subtests.

Regards,
Simon

Reply via email to