Skip to contentSkip to conversation

kunit: Add KUNIT_CASE_PARAM_UNIQUE() and KUNIT_CASE_PARAM_WITH_INIT_UNIQUE()

PATCH In review Mark Brown 3 participants 29 messages Nov 5 – Nov 29

Subsystems (10)
Documentation Sound Kselftest ASoC +6 more subsystems
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

v2 cover kunit: Add KUNIT_CASE_PARAM_UNIQUE() and KUNIT_CASE_PARAM_WITH_INIT_UNIQUE()

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.

The series also includes a fix for what looks like a cut'n'paste issue in the cs_dsp code that overlaps with the main set of changes. Most of the affected tests are in ASoC, though there are some ext4 tests too.

---
Changes in v2:
- Rebase onto v7.4-rc1.
- Link to v1: https://patch.msgid.link/[email protected]

---
Mark Brown (9):
firmware: cs_dsp: Run the wmfw payload error tests with invalid block types
kunit: Add KUNIT_CASE_PARAM_UNIQUE() and KUNIT_CASE_PARAM_WITH_INIT_UNIQUE()
ext4: Give the extents KUnit cases distinct names
firmware: cs_dsp: Give the control read/write KUnit cases distinct names
firmware: cs_dsp: Give the control cache KUnit cases distinct names
firmware: cs_dsp: Give the wmfw block error KUnit cases distinct names
firmware: cs_dsp: Give the bin file KUnit cases distinct names
ASoC: cs35l56: Give the speaker ID pad config KUnit cases distinct names
ASoC: wm_adsp: Give the firmware search order KUnit cases distinct names

 Documentation/dev-tools/kunit/usage.rst            |   9 +
 drivers/firmware/cirrus/test/cs_dsp_test_bin.c     | 222 ++++++++++-----------
 .../cirrus/test/cs_dsp_test_control_cache.c        | 143 ++++++-------
 .../firmware/cirrus/test/cs_dsp_test_control_rw.c  |  50 ++---
 .../firmware/cirrus/test/cs_dsp_test_wmfw_error.c  |  72 ++++---
 fs/ext4/extents-test.c                             |  12 +-
 include/kunit/test.h                               |  41 ++++
 sound/soc/codecs/cs35l56-shared-test.c             |   8 +-
 sound/soc/codecs/wm_adsp_fw_find_test.c            |  24 +--
 9 files changed, 329 insertions(+), 252 deletions(-)

---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
base-tree: git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm master
change-id: 20261012-kunit-param-names-d6cb1450c3ce

Best regards,

Signature · 1 line
Mark Brown <[email protected]>
author maintainer
#1 lore raw

PATCH v2 1/9 firmware: cs_dsp: Run the wmfw payload error tests with invalid block types

Each of the wmfw error suites lists the truncated block header, truncated block payload and garbage payload length tests twice, once with valid block types and once with invalid block types. For the payload and garbage length tests the second entry names wmfw_too_short_for_block_header rather than the test on the preceding line, so the block header test is run four times with invalid block types while the other two are only ever run with valid ones.

Point the second entries at the intended tests so that wmfw_too_short_for_block_payload() and wmfw_block_payload_len_garbage() are also run with invalid block types, as the header test already is.

Fixes feb5fb0615f3 ("firmware: cs_dsp: Add KUnit testing of wmfw error cases")
---
 drivers/firmware/cirrus/test/cs_dsp_test_wmfw_error.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_test_wmfw_error.c +8 -8
index e7bf5dc474f5..b07978d90fa9 100644
@@ -1222,9 +1222,9 @@ static struct kunit_case cs_dsp_wmfw_err_test_cases_v0[] = {
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_valid_block_types_adsp2_gen_params),
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_invalid_block_types_gen_params),
 	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_invalid_block_types_gen_params),
 
 	{ } /* terminator */
 };
@@ -1239,9 +1239,9 @@ static struct kunit_case cs_dsp_wmfw_err_test_cases_v1[] = {
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_valid_block_types_adsp2_gen_params),
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_invalid_block_types_gen_params),
 	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_invalid_block_types_gen_params),
 
 	KUNIT_CASE(wmfw_too_short_for_alg_header),
 	KUNIT_CASE(wmfw_v1_alg_name_unterminated),
@@ -1261,9 +1261,9 @@ static struct kunit_case cs_dsp_wmfw_err_test_cases_v2[] = {
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_valid_block_types_adsp2_gen_params),
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_invalid_block_types_gen_params),
 	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_invalid_block_types_gen_params),
 
 	KUNIT_CASE(wmfw_too_short_for_alg_header),
 	KUNIT_CASE(wmfw_v2_alg_name_exceeds_block),
@@ -1287,9 +1287,9 @@ static struct kunit_case cs_dsp_wmfw_err_test_cases_v3[] = {
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_valid_block_types_halo_gen_params),
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
 	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_valid_block_types_halo_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_invalid_block_types_gen_params),
 	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_valid_block_types_halo_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_invalid_block_types_gen_params),
 
 	KUNIT_CASE(wmfw_too_short_for_alg_header),
 	KUNIT_CASE(wmfw_v2_alg_name_exceeds_block),
Signature · 1 line
2.47.3
author maintainer
#4 lore raw

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

In reply to Mark Brown

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.

---
 Documentation/dev-tools/kunit/usage.rst |  9 ++++++++
 include/kunit/test.h                    | 41 +++++++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
Documentation/dev-tools/kunit/usage.rst +9 -0
index 1c78dfff94e8..193233fd2925 100644
@@ -662,6 +662,15 @@ Custom Parameter Generator Function:
    You can pass the generator function to the ``KUNIT_CASE_PARAM``
    or ``KUNIT_CASE_PARAM_WITH_INIT`` macros.
 
+   These macros name the test case after the test function. If the same test
+   function is listed in a suite with more than one generator (or, for
+   ``KUNIT_CASE_PARAM_WITH_INIT``, more than one ``param_init()`` function)
+   use ``KUNIT_CASE_PARAM_UNIQUE`` or ``KUNIT_CASE_PARAM_WITH_INIT_UNIQUE``
+   instead. These also include the name of the generator or ``param_init()``
+   function in the test case name, for example ``sha1_test-sha1_gen_params``,
+   so that each case has a distinct name which can be selected with
+   ``kunit.filter_glob=``.
+
    The function receives the previously generated parameter as the ``prev`` argument
    (which is ``NULL`` on the first call) and can also access the parameterized
    test context passed as the ``test`` argument. KUnit calls this function
include/kunit/test.h +41 -0

53 lines not on this page · raw message

Signature · 1 line
2.47.3
author maintainer
#7 lore raw

PATCH v2 3/9 ext4: Give the extents KUnit cases distinct names

In reply to Mark Brown

The ext4_extents_test suite runs test_split_convert() against three different parameter arrays by listing it three times with KUNIT_CASE_PARAM_WITH_INIT(), which names each case after the function. All three cases are therefore called test_split_convert, so they cannot be told apart in the results.

Use KUNIT_CASE_PARAM_WITH_INIT_UNIQUE() for these entries so that each case is also named for the param_init() function which registers its parameter array, for example test_split_convert-test_convert_initialized_param_init.

---
 fs/ext4/extents-test.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
fs/ext4/extents-test.c +6 -6
index 2e997f228330..ebef078e292f 100644
@@ -1045,12 +1045,12 @@ static int test_handle_unwritten_init(struct kunit *test)
  * https://lore.kernel.org/linux-kselftest/[email protected]/
  */
 static struct kunit_case extents_test_cases[] = {
-	KUNIT_CASE_PARAM_WITH_INIT(test_split_convert, kunit_array_gen_params,
-				   test_split_convert_param_init, NULL),
-	KUNIT_CASE_PARAM_WITH_INIT(test_split_convert, kunit_array_gen_params,
-				   test_convert_initialized_param_init, NULL),
-	KUNIT_CASE_PARAM_WITH_INIT(test_split_convert, kunit_array_gen_params,
-				   test_handle_unwritten_init, NULL),
+	KUNIT_CASE_PARAM_WITH_INIT_UNIQUE(test_split_convert, kunit_array_gen_params,
+					  test_split_convert_param_init, NULL),
+	KUNIT_CASE_PARAM_WITH_INIT_UNIQUE(test_split_convert, kunit_array_gen_params,
+					  test_convert_initialized_param_init, NULL),
+	KUNIT_CASE_PARAM_WITH_INIT_UNIQUE(test_split_convert, kunit_array_gen_params,
+					  test_handle_unwritten_init, NULL),
 	{}
 };
 
Signature · 1 line
2.47.3
author maintainer
#11 lore raw

PATCH v2 4/9 firmware: cs_dsp: Give the control read/write KUnit cases distinct names

In reply to Mark Brown

The cs_dsp_ctl_rw suites run cs_dsp_ctl_write_running() and cs_dsp_ctl_read_volatile_running() against several sets of parameters by listing each function several times with KUNIT_CASE_PARAM(), which names the case after the function. The resulting cases all share a name, so they cannot be told apart in the results.

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example cs_dsp_ctl_write_running-all_pop_varying_len_gen_params.

---
 .../firmware/cirrus/test/cs_dsp_test_control_rw.c  | 50 +++++++++++-----------
 1 file changed, 26 insertions(+), 24 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_test_control_rw.c +26 -24
index d800f163b099..085a1cb92912 100644
@@ -2483,19 +2483,20 @@ KUNIT_ARRAY_PARAM(all_pop_volatile_writeable_flags,
 		  cs_dsp_ctl_all_param_desc);
 
 static struct kunit_case cs_dsp_ctl_rw_test_cases_adsp[] = {
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_z_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_writeable_flags_gen_params),
-
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running, all_pop_z_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running,
-			 all_pop_volatile_readable_flags_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_z_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_writeable_flags_gen_params),
+
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running,
+				all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running, all_pop_z_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running,
+				all_pop_volatile_readable_flags_gen_params),
 
 	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_not_started,
 			 all_pop_volatile_readable_flags_gen_params),
@@ -2559,17 +2560,18 @@ static struct kunit_case cs_dsp_ctl_rw_test_cases_adsp[] = {
 };
 
 static struct kunit_case cs_dsp_ctl_rw_test_cases_halo[] = {
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_write_running, all_pop_writeable_flags_gen_params),
-
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_running,
-			 all_pop_volatile_readable_flags_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_write_running, all_pop_writeable_flags_gen_params),
+
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running,
+				all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_read_volatile_running,
+				all_pop_volatile_readable_flags_gen_params),
 
 	KUNIT_CASE_PARAM(cs_dsp_ctl_read_volatile_not_started,
 			 all_pop_volatile_readable_flags_gen_params),
Signature · 1 line
2.47.3
author maintainer
#14 lore raw

PATCH v2 5/9 firmware: cs_dsp: Give the control cache KUnit cases distinct names

In reply to Mark Brown

The cs_dsp_ctl_cache suites run cs_dsp_ctl_cache_init(), cs_dsp_ctl_cache_writethrough() and cs_dsp_ctl_cache_writethrough_unchanged() against several sets of parameters by listing each function several times with KUNIT_CASE_PARAM(), which names the case after the function. The resulting cases all share a name, so they cannot be told apart in the results.

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example cs_dsp_ctl_cache_init-all_pop_varying_len_gen_params.

---
 .../cirrus/test/cs_dsp_test_control_cache.c        | 143 +++++++++++----------
 1 file changed, 72 insertions(+), 71 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_test_control_cache.c +72 -71
index b03cd7c37f6e..0a072063dfa7 100644
@@ -2987,12 +2987,12 @@ KUNIT_ARRAY_PARAM(all_pop_nonvol_write_only_length,
 		  cs_dsp_ctl_all_param_desc);
 
 static struct kunit_case cs_dsp_ctl_cache_test_cases_v1[] = {
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_z_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_nonvol_readable_flags_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_z_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_nonvol_readable_flags_gen_params),
 
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init_write_only,
 			 all_pop_nonvol_write_only_length_gen_params),
@@ -3019,25 +3019,25 @@ static struct kunit_case cs_dsp_ctl_cache_test_cases_v1[] = {
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_read_running_zero_flags,
 			 all_pop_varying_len_gen_params),
 
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_z_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_nonvol_writeable_flags_gen_params),
-
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_z_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_nonvol_writeable_flags_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_z_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough,
+				all_pop_nonvol_writeable_flags_gen_params),
+
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged, all_pop_z_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_nonvol_writeable_flags_gen_params),
 
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_write_unchanged_not_started,
 			 all_pop_nonvol_writeable_flags_gen_params),
@@ -3075,12 +3075,12 @@ static struct kunit_case cs_dsp_ctl_cache_test_cases_v1[] = {
 static struct kunit_case cs_dsp_ctl_cache_test_cases_v2[] = {
 	KUNIT_CASE(cs_dsp_ctl_v2_cache_alloc),
 
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_z_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_nonvol_readable_flags_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_z_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_nonvol_readable_flags_gen_params),
 
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init_write_only,
 			 all_pop_nonvol_write_only_length_gen_params),
@@ -3108,25 +3108,25 @@ static struct kunit_case cs_dsp_ctl_cache_test_cases_v2[] = {
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_read_running_zero_flags,
 			 all_pop_varying_len_gen_params),
 
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_z_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_nonvol_writeable_flags_gen_params),
-
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_z_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_nonvol_writeable_flags_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_z_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough,
+				all_pop_nonvol_writeable_flags_gen_params),
+
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged, all_pop_z_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_nonvol_writeable_flags_gen_params),
 
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_write_unchanged_not_started,
 			 all_pop_nonvol_writeable_flags_gen_params),
@@ -3164,11 +3164,11 @@ static struct kunit_case cs_dsp_ctl_cache_test_cases_v2[] = {
 static struct kunit_case cs_dsp_ctl_cache_test_cases_v3[] = {
 	KUNIT_CASE(cs_dsp_ctl_v2_cache_alloc),
 
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init, all_pop_nonvol_readable_flags_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_init, all_pop_nonvol_readable_flags_gen_params),
 
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_init_write_only,
 			 all_pop_nonvol_write_only_length_gen_params),
@@ -3194,22 +3194,23 @@ static struct kunit_case cs_dsp_ctl_cache_test_cases_v3[] = {
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_read_running,
 			 all_pop_nonvol_readable_nonzero_flags_gen_params),
 
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough, all_pop_nonvol_writeable_flags_gen_params),
-
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_len_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_offset_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_xy_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_varying_alg_gen_params),
-	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_writethrough_unchanged,
-			 all_pop_nonvol_writeable_flags_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough, all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough,
+				all_pop_nonvol_writeable_flags_gen_params),
+
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_len_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_xy_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_varying_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs_dsp_ctl_cache_writethrough_unchanged,
+				all_pop_nonvol_writeable_flags_gen_params),
 
 	KUNIT_CASE_PARAM(cs_dsp_ctl_cache_write_unchanged_not_started,
 			 all_pop_nonvol_writeable_flags_gen_params),
Signature · 1 line
2.47.3
author maintainer
#17 lore raw

PATCH v2 6/9 firmware: cs_dsp: Give the wmfw block error KUnit cases distinct names

In reply to Mark Brown

The wmfw error suites run wmfw_too_short_for_block_header(), wmfw_too_short_for_block_payload() and wmfw_block_payload_len_garbage() both with valid and with invalid block types by listing each twice with KUNIT_CASE_PARAM(), which names the case after the function. The two cases for each function share a name, so they cannot be told apart in the results.

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example wmfw_too_short_for_block_header-wmfw_invalid_block_types_gen_params.

---
 .../firmware/cirrus/test/cs_dsp_test_wmfw_error.c  | 72 ++++++++++++++--------
 1 file changed, 48 insertions(+), 24 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_test_wmfw_error.c +48 -24
index b07978d90fa9..44f9c8d71326 100644
@@ -1219,12 +1219,18 @@ static struct kunit_case cs_dsp_wmfw_err_test_cases_v0[] = {
 	KUNIT_CASE(wmfw_err_bad_header_length),
 	KUNIT_CASE(wmfw_err_bad_core_type),
 
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_invalid_block_types_gen_params),
-	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_header,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_header,
+				wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_payload,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_payload,
+				wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_block_payload_len_garbage,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_block_payload_len_garbage,
+				wmfw_invalid_block_types_gen_params),
 
 	{ } /* terminator */
 };
@@ -1236,12 +1242,18 @@ static struct kunit_case cs_dsp_wmfw_err_test_cases_v1[] = {
 	KUNIT_CASE(wmfw_err_bad_header_length),
 	KUNIT_CASE(wmfw_err_bad_core_type),
 
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_invalid_block_types_gen_params),
-	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_header,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_header,
+				wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_payload,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_payload,
+				wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_block_payload_len_garbage,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_block_payload_len_garbage,
+				wmfw_invalid_block_types_gen_params),
 
 	KUNIT_CASE(wmfw_too_short_for_alg_header),
 	KUNIT_CASE(wmfw_v1_alg_name_unterminated),
@@ -1258,12 +1270,18 @@ static struct kunit_case cs_dsp_wmfw_err_test_cases_v2[] = {
 	KUNIT_CASE(wmfw_err_bad_header_length),
 	KUNIT_CASE(wmfw_err_bad_core_type),
 
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_invalid_block_types_gen_params),
-	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_valid_block_types_adsp2_gen_params),
-	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_header,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_header,
+				wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_payload,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_payload,
+				wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_block_payload_len_garbage,
+				wmfw_valid_block_types_adsp2_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_block_payload_len_garbage,
+				wmfw_invalid_block_types_gen_params),
 
 	KUNIT_CASE(wmfw_too_short_for_alg_header),
 	KUNIT_CASE(wmfw_v2_alg_name_exceeds_block),
@@ -1284,12 +1302,18 @@ static struct kunit_case cs_dsp_wmfw_err_test_cases_v3[] = {
 	KUNIT_CASE(wmfw_err_bad_header_length),
 	KUNIT_CASE(wmfw_err_bad_core_type),
 
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_valid_block_types_halo_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_header, wmfw_invalid_block_types_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_valid_block_types_halo_gen_params),
-	KUNIT_CASE_PARAM(wmfw_too_short_for_block_payload, wmfw_invalid_block_types_gen_params),
-	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_valid_block_types_halo_gen_params),
-	KUNIT_CASE_PARAM(wmfw_block_payload_len_garbage, wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_header,
+				wmfw_valid_block_types_halo_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_header,
+				wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_payload,
+				wmfw_valid_block_types_halo_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_too_short_for_block_payload,
+				wmfw_invalid_block_types_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_block_payload_len_garbage,
+				wmfw_valid_block_types_halo_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wmfw_block_payload_len_garbage,
+				wmfw_invalid_block_types_gen_params),
 
 	KUNIT_CASE(wmfw_too_short_for_alg_header),
 	KUNIT_CASE(wmfw_v2_alg_name_exceeds_block),
Signature · 1 line
2.47.3
author maintainer
#20 lore raw

PATCH v2 7/9 firmware: cs_dsp: Give the bin file KUnit cases distinct names

In reply to Mark Brown

The cs_dsp_bin suites run many of their test functions against more than one set of parameters, listing the function once per set with KUNIT_CASE_PARAM(), which names the case after the function:

- the ADSP2 suites run the XM/YM tests again for ZM,
- the WMDR v3 suite runs the whole set again with long offset blocks,
- the multiple memory tests are run varying the offset and the algorithm.

The resulting cases share a name, so they cannot be told apart in the results.

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example bin_patch_one_word-x_or_y_and_offset_gen_params and bin_patch_one_word-z_and_offset_gen_params.

---
 drivers/firmware/cirrus/test/cs_dsp_test_bin.c | 222 ++++++++++++-------------
 1 file changed, 111 insertions(+), 111 deletions(-)
drivers/firmware/cirrus/test/cs_dsp_test_bin.c +111 -111
index 63416838f865..40a827120d6c 100644
@@ -2654,8 +2654,8 @@ static struct kunit_case cs_dsp_bin_test_cases_halo[] = {
 	KUNIT_CASE_PARAM(bin_patch_one_multiword, x_or_y_and_offset_gen_params),
 	KUNIT_CASE_PARAM(bin_patch_multi_oneword, x_or_y_and_offset_gen_params),
 	KUNIT_CASE_PARAM(bin_patch_multi_oneword_unordered, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_mems, offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_mems, alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_mems, offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_mems, alg_gen_params),
 	KUNIT_CASE_PARAM(bin_patch_multi_oneword_sparse_unordered, x_or_y_and_alg_gen_params),
 	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs, x_or_y_and_offset_gen_params),
 	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs_unordered, x_or_y_and_offset_gen_params),
@@ -2687,8 +2687,8 @@ static struct kunit_case cs_dsp_bin_test_cases_halo[] = {
 			 packed_x_or_y_and_offset_gen_params),
 	KUNIT_CASE_PARAM(bin_patch_multi_onepacked_unordered,
 			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_mems, offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_mems, alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_mems, offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_mems, alg_gen_params),
 	KUNIT_CASE_PARAM(bin_patch_multi_onepacked_sparse_unordered,
 			 packed_x_or_y_and_alg_gen_params),
 	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_algs,
@@ -2705,103 +2705,100 @@ static struct kunit_case cs_dsp_bin_test_cases_halo[] = {
 
 static struct kunit_case cs_dsp_bin_test_cases_halo_wmdr3[] = {
 	/* Unpacked memory */
-	KUNIT_CASE_PARAM(bin_patch_one_word, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_multiword, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword_unordered, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_mems, offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_mems, alg_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword_sparse_unordered, x_or_y_and_alg_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs_unordered, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_multiword, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword_unordered, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_mems, offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_mems, alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword_sparse_unordered,
+				x_or_y_and_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_algs, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_algs_unordered,
+				x_or_y_and_offset_gen_params),
 
 	/* Packed memory tests */
-	KUNIT_CASE_PARAM(bin_patch_1_packed,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_1_single_trailing,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_2_single_trailing,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_3_single_trailing,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_2_trailing,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_3_trailing,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_single_leading_1_packed,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_2_single_leading_1_packed,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_2_leading_1_packed,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_3_single_leading_1_packed,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_3_leading_1_packed,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_onepacked,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_onepacked_unordered,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_mems, offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_mems, alg_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_onepacked_sparse_unordered,
-			 packed_x_or_y_and_alg_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_algs,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_algs_unordered,
-			 packed_x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_mixed_packed_unpacked_random,
-			 packed_x_or_y_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed, packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_1_single_trailing,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_2_single_trailing,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_3_single_trailing,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_2_trailing, packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_3_trailing, packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_single_leading_1_packed,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_2_single_leading_1_packed,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_2_leading_1_packed, packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_3_single_leading_1_packed,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_3_leading_1_packed, packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_onepacked, packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_onepacked_unordered,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_mems, offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_mems, alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_onepacked_sparse_unordered,
+				packed_x_or_y_and_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_algs,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_algs_unordered,
+				packed_x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_mixed_packed_unpacked_random, packed_x_or_y_gen_params),
 
 	/* Unpacked memory with long-offset blocks */
-	KUNIT_CASE_PARAM(bin_patch_one_word, x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_multiword, x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword, x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword_unordered, x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_mems, long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_mems, alg_long_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword_sparse_unordered, x_or_y_and_alg_long_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs, x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs_unordered,
-			   x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word, x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_multiword, x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword, x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword_unordered,
+				x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_mems, long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_mems, alg_long_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword_sparse_unordered,
+				x_or_y_and_alg_long_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_algs,
+				x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_algs_unordered,
+				x_or_y_and_long_offset_gen_params),
 
 	/* Packed memory tests with long offset blocks */
-	KUNIT_CASE_PARAM(bin_patch_1_packed,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_1_single_trailing,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_2_single_trailing,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_3_single_trailing,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_2_trailing,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_3_trailing,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_single_leading_1_packed,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_2_single_leading_1_packed,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_2_leading_1_packed,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_3_single_leading_1_packed,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_3_leading_1_packed,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_onepacked,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_onepacked_unordered,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_mems, long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_mems, alg_long_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_onepacked_sparse_unordered,
-			 packed_x_or_y_and_alg_long_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_algs,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_1_packed_multiple_algs_unordered,
-			 packed_x_or_y_and_long_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_mixed_packed_unpacked_random,
-			 packed_x_or_y_long_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed, packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_1_single_trailing,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_2_single_trailing,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_3_single_trailing,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_2_trailing,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_3_trailing,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_single_leading_1_packed,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_2_single_leading_1_packed,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_2_leading_1_packed,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_3_single_leading_1_packed,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_3_leading_1_packed,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_onepacked,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_onepacked_unordered,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_mems, long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_mems, alg_long_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_onepacked_sparse_unordered,
+				packed_x_or_y_and_alg_long_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_algs,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_1_packed_multiple_algs_unordered,
+				packed_x_or_y_and_long_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_mixed_packed_unpacked_random,
+				packed_x_or_y_long_gen_params),
 
 	KUNIT_CASE(bin_patch_name_and_info),
 
@@ -2810,26 +2807,29 @@ static struct kunit_case cs_dsp_bin_test_cases_halo_wmdr3[] = {
 
 static struct kunit_case cs_dsp_bin_test_cases_adsp2[] = {
 	/* XM and YM */
-	KUNIT_CASE_PARAM(bin_patch_one_word, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_multiword, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword_unordered, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword_sparse_unordered, x_or_y_and_alg_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs, x_or_y_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs_unordered, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_multiword, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword_unordered, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword_sparse_unordered,
+				x_or_y_and_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_algs, x_or_y_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_algs_unordered,
+				x_or_y_and_offset_gen_params),
 
 	/* ZM */
-	KUNIT_CASE_PARAM(bin_patch_one_word, z_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_multiword, z_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword, z_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword_unordered, z_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_multi_oneword_sparse_unordered, z_and_alg_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs, z_and_offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_algs_unordered, z_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word, z_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_multiword, z_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword, z_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword_unordered, z_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_multi_oneword_sparse_unordered, z_and_alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_algs, z_and_offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_algs_unordered,
+				z_and_offset_gen_params),
 
 	/* Other */
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_mems, offset_gen_params),
-	KUNIT_CASE_PARAM(bin_patch_one_word_multiple_mems, alg_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_mems, offset_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(bin_patch_one_word_multiple_mems, alg_gen_params),
 
 	KUNIT_CASE(bin_patch_name_and_info),
 
Signature · 1 line
2.47.3
author maintainer
#23 lore raw

PATCH v2 8/9 ASoC: cs35l56: Give the speaker ID pad config KUnit cases distinct names

In reply to Mark Brown

The cs35l56 shared test suites run cs35l56_shared_test_onchip_speaker_id_pad_config() both with and without pulls configured on the speaker ID pins by listing it twice with KUNIT_CASE_PARAM(), which names the case after the function. Both cases share a name, so they cannot be told apart in the results.

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is
also named for the parameter generator it is run with, giving cs35l56_shared_test_onchip_speaker_id_pad_config-cs35l56_shared_test_onchip_spkid_gen_params and cs35l56_shared_test_onchip_speaker_id_pad_config-cs35l56_shared_test_onchip_spkid_pull_gen_params.

---
 sound/soc/codecs/cs35l56-shared-test.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/cs35l56-shared-test.c +4 -4
index 34bb3d44b51f..ccf5adb7cf2a 100644
@@ -899,10 +899,10 @@ static struct kunit_case cs35l56_shared_test_cases[] = {
 			 cs35l56_shared_test_gpios_selftest_gen_params),
 	KUNIT_CASE_PARAM(cs35l56_shared_test_get_onchip_speaker_id,
 			 cs35l56_shared_test_onchip_spkid_gen_params),
-	KUNIT_CASE_PARAM(cs35l56_shared_test_onchip_speaker_id_pad_config,
-			 cs35l56_shared_test_onchip_spkid_gen_params),
-	KUNIT_CASE_PARAM(cs35l56_shared_test_onchip_speaker_id_pad_config,
-			 cs35l56_shared_test_onchip_spkid_pull_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs35l56_shared_test_onchip_speaker_id_pad_config,
+				cs35l56_shared_test_onchip_spkid_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(cs35l56_shared_test_onchip_speaker_id_pad_config,
+				cs35l56_shared_test_onchip_spkid_pull_gen_params),
 	KUNIT_CASE_PARAM(cs35l56_shared_test_stash_onchip_spkid_pins,
 			 cs35l56_shared_test_onchip_spkid_pull_gen_params),
 	KUNIT_CASE(cs35l56_shared_test_stash_onchip_spkid_pins_reject_invalid),
Signature · 1 line
2.47.3
author maintainer
#26 lore raw

PATCH v2 9/9 ASoC: wm_adsp: Give the firmware search order KUnit cases distinct names

In reply to Mark Brown

The wm-adsp-fw-find suite runs wm_adsp_fw_find_test_search_order() against six different sets of parameters by listing it six times with KUNIT_CASE_PARAM(), which names each case after the function. All six cases are therefore called wm_adsp_fw_find_test_search_order, which makes the results ambiguous.

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example wm_adsp_fw_find_test_search_order-wm_adsp_fw_find_full_search_gen_params.

---
 sound/soc/codecs/wm_adsp_fw_find_test.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
sound/soc/codecs/wm_adsp_fw_find_test.c +12 -12
index ae686dc4fa94..0b2b7db3f9f9 100644
@@ -1219,23 +1219,23 @@ KUNIT_ARRAY_PARAM(wm_adsp_fw_find_pick,
 		  wm_adsp_fw_find_test_param_desc);
 
 static struct kunit_case wm_adsp_fw_find_test_cases[] = {
-	KUNIT_CASE_PARAM(wm_adsp_fw_find_test_search_order,
-			 wm_adsp_fw_find_full_search_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wm_adsp_fw_find_test_search_order,
+				wm_adsp_fw_find_full_search_gen_params),
 
-	KUNIT_CASE_PARAM(wm_adsp_fw_find_test_search_order,
-			 wm_adsp_fw_find_system_alsaname_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wm_adsp_fw_find_test_search_order,
+				wm_adsp_fw_find_system_alsaname_gen_params),
 
-	KUNIT_CASE_PARAM(wm_adsp_fw_find_test_search_order,
-			 wm_adsp_fw_find_system_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wm_adsp_fw_find_test_search_order,
+				wm_adsp_fw_find_system_gen_params),
 
-	KUNIT_CASE_PARAM(wm_adsp_fw_find_test_search_order,
-			 wm_adsp_fw_find_alsaname_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wm_adsp_fw_find_test_search_order,
+				wm_adsp_fw_find_alsaname_gen_params),
 
-	KUNIT_CASE_PARAM(wm_adsp_fw_find_test_search_order,
-			 wm_adsp_fw_find_noqual_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wm_adsp_fw_find_test_search_order,
+				wm_adsp_fw_find_noqual_gen_params),
 
-	KUNIT_CASE_PARAM(wm_adsp_fw_find_test_search_order,
-			 wm_adsp_fw_find_normalization_gen_params),
+	KUNIT_CASE_PARAM_UNIQUE(wm_adsp_fw_find_test_search_order,
+				wm_adsp_fw_find_normalization_gen_params),
 
 	KUNIT_CASE_PARAM(wm_adsp_fw_find_test_pick_file,
 			 wm_adsp_fw_find_pick_gen_params),
Signature · 1 line
2.47.3
#2 lore raw

Re: [PATCH v2 1/9] firmware: cs_dsp: Run the wmfw payload error tests with invalid block types

In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines

Each of the wmfw error suites lists the truncated block header, truncated block payload and garbage payload length tests twice, once with valid block types and once with invalid block types. For the payload and garbage length tests the second entry names wmfw_too_short_for_block_header rather than the test on the preceding line, so the block header test is run four times with invalid block types while the other two are only ever run with valid ones.

Quoted 7 lines

Point the second entries at the intended tests so that wmfw_too_short_for_block_payload() and wmfw_block_payload_len_garbage() are also run with invalid block types, as the header test already is.

Fixes feb5fb0615f3 ("firmware: cs_dsp: Add KUnit testing of wmfw error cases")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
#5 lore raw
In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 22 lines

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.

Quoted 1 line

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#8 lore raw

Re: [PATCH v2 3/9] ext4: Give the extents KUnit cases distinct names

In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

The ext4_extents_test suite runs test_split_convert() against three different parameter arrays by listing it three times with KUNIT_CASE_PARAM_WITH_INIT(), which names each case after the function. All three cases are therefore called test_split_convert, so they cannot be told apart in the results.

Quoted 6 lines

Use KUNIT_CASE_PARAM_WITH_INIT_UNIQUE() for these entries so that each case is also named for the param_init() function which registers its parameter array, for example test_split_convert-test_convert_initialized_param_init.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
#12 lore raw

Re: [PATCH v2 4/9] firmware: cs_dsp: Give the control read/write KUnit cases distinct names

In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

The cs_dsp_ctl_rw suites run cs_dsp_ctl_write_running() and cs_dsp_ctl_read_volatile_running() against several sets of parameters by listing each function several times with KUNIT_CASE_PARAM(), which names the case after the function. The resulting cases all share a name, so they cannot be told apart in the results.

Quoted 6 lines

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example cs_dsp_ctl_write_running-all_pop_varying_len_gen_params.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#15 lore raw

Re: [PATCH v2 5/9] firmware: cs_dsp: Give the control cache KUnit cases distinct names

In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 8 lines

The cs_dsp_ctl_cache suites run cs_dsp_ctl_cache_init(), cs_dsp_ctl_cache_writethrough() and cs_dsp_ctl_cache_writethrough_unchanged() against several sets of parameters by listing each function several times with KUNIT_CASE_PARAM(), which names the case after the function. The resulting cases all share a name, so they cannot be told apart in the results.

Quoted 6 lines

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example cs_dsp_ctl_cache_init-all_pop_varying_len_gen_params.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
#18 lore raw

Re: [PATCH v2 6/9] firmware: cs_dsp: Give the wmfw block error KUnit cases distinct names

In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 7 lines

The wmfw error suites run wmfw_too_short_for_block_header(), wmfw_too_short_for_block_payload() and wmfw_block_payload_len_garbage() both with valid and with invalid block types by listing each twice with KUNIT_CASE_PARAM(), which names the case after the function. The two cases for each function share a name, so they cannot be told apart in the results.

Quoted 6 lines

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example wmfw_too_short_for_block_header-wmfw_invalid_block_types_gen_params.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
#21 lore raw

Re: [PATCH v2 7/9] firmware: cs_dsp: Give the bin file KUnit cases distinct names

In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 12 lines

The cs_dsp_bin suites run many of their test functions against more than one set of parameters, listing the function once per set with KUNIT_CASE_PARAM(), which names the case after the function:

- the ADSP2 suites run the XM/YM tests again for ZM,
- the WMDR v3 suite runs the whole set again with long offset blocks,
- the multiple memory tests are run varying the offset and the algorithm.

The resulting cases share a name, so they cannot be told apart in the results.

Quoted 7 lines

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example bin_patch_one_word-x_or_y_and_offset_gen_params and bin_patch_one_word-z_and_offset_gen_params.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
#24 lore raw

Re: [PATCH v2 8/9] ASoC: cs35l56: Give the speaker ID pad config KUnit cases distinct names

In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

The cs35l56 shared test suites run cs35l56_shared_test_onchip_speaker_id_pad_config() both with and without pulls configured on the speaker ID pins by listing it twice with KUNIT_CASE_PARAM(), which names the case after the function. Both cases share a name, so they cannot be told apart in the results.

Quoted 8 lines

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is
also named for the parameter generator it is run with, giving cs35l56_shared_test_onchip_speaker_id_pad_config-cs35l56_shared_test_onchip_spkid_gen_params and cs35l56_shared_test_onchip_speaker_id_pad_config-cs35l56_shared_test_onchip_spkid_pull_gen_params.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
#27 lore raw

Re: [PATCH v2 9/9] ASoC: wm_adsp: Give the firmware search order KUnit cases distinct names

In reply to Mark Brown
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

The wm-adsp-fw-find suite runs wm_adsp_fw_find_test_search_order() against six different sets of parameters by listing it six times with KUNIT_CASE_PARAM(), which names each case after the function. All six cases are therefore called wm_adsp_fw_find_test_search_order, which makes the results ambiguous.

Quoted 6 lines

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example wm_adsp_fw_find_test_search_order-wm_adsp_fw_find_full_search_gen_params.

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
maintainer Acked-by on v2 1/9
#3 lore raw

Re: [PATCH v2 1/9] firmware: cs_dsp: Run the wmfw payload error tests with invalid block types

In reply to Mark Brown
Quoted 9 lines · Mark Brown

Each of the wmfw error suites lists the truncated block header, truncated block payload and garbage payload length tests twice, once with valid block types and once with invalid block types. For the payload and garbage length tests the second entry names wmfw_too_short_for_block_header rather than the test on the preceding line, so the block header test is run four times with invalid block types while the other two are only ever run with valid ones.

[...]

Signature · 1 line
David Gow <[email protected]>
maintainer Reviewed-by on v2 2/9
#6 lore raw
In reply to Mark Brown
Quoted 22 lines

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.

Quoted 2 lines

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)!

Cheers,
-- David

Signature · 1 line
David Gow <[email protected]>
maintainer Acked-by on v2 3/9
#9 lore raw

Re: [PATCH v2 3/9] ext4: Give the extents KUnit cases distinct names

In reply to Mark Brown
Quoted 6 lines

The ext4_extents_test suite runs test_split_convert() against three different parameter arrays by listing it three times with KUNIT_CASE_PARAM_WITH_INIT(), which names each case after the function. All three cases are therefore called test_split_convert, so they cannot be told apart in the results.

Quoted 6 lines

Use KUNIT_CASE_PARAM_WITH_INIT_UNIQUE() for these entries so that each case is also named for the param_init() function which registers its parameter array, for example test_split_convert-test_convert_initialized_param_init.

Note: This is probably going to have a conflict with all of the changes to the ext4 tests which have just landed. It still applies cleanly to the kselftest/kunit brach for the moment, though.

Quoted 14 lines
fs/ext4/extents-test.c +0 -5
index 2e997f228330..ebef078e292f 100644
@@ -1045,12 +1045,12 @@ static int test_handle_unwritten_init(struct kunit *test)
  * https://lore.kernel.org/linux-kselftest/[email protected]/
  */
 static struct kunit_case extents_test_cases[] = {
-	KUNIT_CASE_PARAM_WITH_INIT(test_split_convert, kunit_array_gen_params,
-				   test_split_convert_param_init, NULL),
-	KUNIT_CASE_PARAM_WITH_INIT(test_split_convert, kunit_array_gen_params,
-				   test_convert_initialized_param_init, NULL),
-	KUNIT_CASE_PARAM_WITH_INIT(test_split_convert, kunit_array_gen_params,

fs/ext4/extents-test.c static int test_handle_unwritten_init(struct kunit *test) · line 1056

Quoted 10 lines
fs/ext4/extents-test.c +6 -1
-				   test_handle_unwritten_init, NULL),
+	KUNIT_CASE_PARAM_WITH_INIT_UNIQUE(test_split_convert, kunit_array_gen_params,
+					  test_split_convert_param_init, NULL),
+	KUNIT_CASE_PARAM_WITH_INIT_UNIQUE(test_split_convert, kunit_array_gen_params,
+					  test_convert_initialized_param_init, NULL),
+	KUNIT_CASE_PARAM_WITH_INIT_UNIQUE(test_split_convert, kunit_array_gen_params,
+					  test_handle_unwritten_init, NULL),
 	{}
 };
 
Signature · 1 line
David Gow <[email protected]>
maintainer Acked-by on v2 4/9
#13 lore raw

Re: [PATCH v2 4/9] firmware: cs_dsp: Give the control read/write KUnit cases distinct names

In reply to Mark Brown
Quoted 11 lines · Mark Brown

The cs_dsp_ctl_rw suites run cs_dsp_ctl_write_running() and cs_dsp_ctl_read_volatile_running() against several sets of parameters by listing each function several times with KUNIT_CASE_PARAM(), which names the case after the function. The resulting cases all share a name, so they cannot be told apart in the results.

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example cs_dsp_ctl_write_running-all_pop_varying_len_gen_params.

[...]

Signature · 1 line
David Gow <[email protected]>
maintainer Acked-by on v2 5/9
#16 lore raw

Re: [PATCH v2 5/9] firmware: cs_dsp: Give the control cache KUnit cases distinct names

In reply to Mark Brown
Quoted 9 lines · Mark Brown

The cs_dsp_ctl_cache suites run cs_dsp_ctl_cache_init(), cs_dsp_ctl_cache_writethrough() and cs_dsp_ctl_cache_writethrough_unchanged() against several sets of parameters by listing each function several times with KUNIT_CASE_PARAM(), which names the case after the function. The resulting cases all share a name, so they cannot be told apart in the results.

[...]

Signature · 1 line
David Gow <[email protected]>
maintainer Acked-by on v2 6/9
#19 lore raw

Re: [PATCH v2 6/9] firmware: cs_dsp: Give the wmfw block error KUnit cases distinct names

In reply to Mark Brown
Quoted 8 lines · Mark Brown

The wmfw error suites run wmfw_too_short_for_block_header(), wmfw_too_short_for_block_payload() and wmfw_block_payload_len_garbage() both with valid and with invalid block types by listing each twice with KUNIT_CASE_PARAM(), which names the case after the function. The two cases for each function share a name, so they cannot be told apart in the results.

[...]

Signature · 1 line
David Gow <[email protected]>
maintainer Acked-by on v2 7/9
#22 lore raw

Re: [PATCH v2 7/9] firmware: cs_dsp: Give the bin file KUnit cases distinct names

In reply to Mark Brown
Quoted 10 lines · Mark Brown

The cs_dsp_bin suites run many of their test functions against more than one set of parameters, listing the function once per set with KUNIT_CASE_PARAM(), which names the case after the function:

- the ADSP2 suites run the XM/YM tests again for ZM,
- the WMDR v3 suite runs the whole set again with long offset blocks,
- the multiple memory tests are run varying the offset and the algorithm.

[...]

Signature · 1 line
David Gow <[email protected]>
maintainer Acked-by on v2 8/9
#25 lore raw

Re: [PATCH v2 8/9] ASoC: cs35l56: Give the speaker ID pad config KUnit cases distinct names

In reply to Mark Brown
Quoted 6 lines · Mark Brown

The cs35l56 shared test suites run cs35l56_shared_test_onchip_speaker_id_pad_config() both with and without pulls configured on the speaker ID pins by listing it twice with KUNIT_CASE_PARAM(), which names the case after the function. Both cases share a name, so they cannot be told apart in the results.

Quoted 7 lines

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is
also named for the parameter generator it is run with, giving cs35l56_shared_test_onchip_speaker_id_pad_config-cs35l56_shared_test_onchip_spkid_gen_params and cs35l56_shared_test_onchip_speaker_id_pad_config-cs35l56_shared_test_onchip_spkid_pull_gen_params.

[...]

Signature · 1 line
David Gow <[email protected]>
maintainer Acked-by on v2 9/9
#28 lore raw

Re: [PATCH v2 9/9] ASoC: wm_adsp: Give the firmware search order KUnit cases distinct names

In reply to Mark Brown
Quoted 11 lines · Mark Brown

The wm-adsp-fw-find suite runs wm_adsp_fw_find_test_search_order() against six different sets of parameters by listing it six times with KUNIT_CASE_PARAM(), which names each case after the function. All six cases are therefore called wm_adsp_fw_find_test_search_order, which makes the results ambiguous.

Use KUNIT_CASE_PARAM_UNIQUE() for these entries so that each case is also named for the parameter generator it is run with, for example wm_adsp_fw_find_test_search_order-wm_adsp_fw_find_full_search_gen_params.

[...]

Signature · 1 line
David Gow <[email protected]>
author maintainer
#10 lore raw

Re: [PATCH v2 3/9] ext4: Give the extents KUnit cases distinct names

In reply to David Gow
Quoted 12 lines · David Gow
Quoted 11 lines

The ext4_extents_test suite runs test_split_convert() against three different parameter arrays by listing it three times with KUNIT_CASE_PARAM_WITH_INIT(), which names each case after the function. All three cases are therefore called test_split_convert, so they cannot be told apart in the results.

Use KUNIT_CASE_PARAM_WITH_INIT_UNIQUE() for these entries so that each case is also named for the param_init() function which registers its parameter array, for example test_split_convert-test_convert_initialized_param_init.

Quoted 3 lines

Note: This is probably going to have a conflict with all of the changes to the ext4 tests which have just landed. It still applies cleanly to the kselftest/kunit brach for the moment, though.

I suspect that the best way forward is just to drop this patch from the series, then redo it on top of the ext4 changes after the merge window (assuming the rest goes in, hopefully it will). Nothing else here directly depends on this.