Re: [PATCH v2 2/9] kunit: Add KUNIT_CASE_PARAM_UNIQUE() and KUNIT_CASE_PARAM_WITH_INIT_UNIQUE()

From: David Gow

Date: Fri Nov 27 2026 - 04:04:53 EST


> KUNIT_CASE_PARAM() and KUNIT_CASE_PARAM_WITH_INIT() name the test case
> after the test function. Several suites reuse one test function with
> more than one parameter generator or param_init() function, listing it
> once per set of parameters, which leads to multiple tests being created
> with the same name. Same-named cases cannot be told apart in the results
> and cannot be selected individually with kunit.filter_glob=, so kunit.py
> --run_isolated=test boots a kernel for every entry and each kernel runs
> all of the same-named cases.
>
> We could fix this by having the KUNIT_CASE_PARAM() macros always include
> the parameter name but this would not only rename all existing users but
> also result in some awkwardly named tests. Instead introduce some new
> macros for use in cases where we need to disambiguate.
>
> Add KUNIT_CASE_PARAM_UNIQUE() and KUNIT_CASE_PARAM_WITH_INIT_UNIQUE()
> which behave identically to the existing macros but include the name of
> the parameter generator or the param_init() function in the name of
> the case, giving names such as sha1_test-sha1_gen_params. The
> param_init() function is used for the WITH_INIT variant since currently
> all the tests which register parameter arrays from param_init() all
> share the generic kunit_array_gen_params() generator.
>
> Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
>

Thanks very much: I hadn't tried this with --run-isolated=test, so missed
that part of it.

This is definitely long overdue (and while I'm not completely sure
'UNIQUE' is the best possible name for it, I couldn't think of a better
one, so let's go with it)!

Reviewed-by: David Gow <david@xxxxxxxxxxxx>

Cheers,
-- David

--
David Gow <david@xxxxxxxxxxxx>