Skip to contentSkip to conversation

Fix up building KUnit tests for Cirrus Logic modules

PATCH In review Richard Fitzgerald 3 participants 6 messages Apr 11, 2025 – Apr 14, 2025

Subsystems (5)
Sound Kselftest ASoC KUnit +1 more subsystems
lore
Share & tools
lore

Richard Fitzgerald

author maintainer
#0 lore raw

cover Fix up building KUnit tests for Cirrus Logic modules

This series fixes the KConfig for cs_dsp and cs-amp-lib tests so that CONFIG_KUNIT_ALL_TESTS doesn't cause them to add modules to the build.

Patch 1 adds the ASoC CS35L56 driver to KUnit all_tests.config so that
cs_dsp and cs-amp-lib will be included in the test build.

Patch 2 and 3 fixup the KConfig entries for cs_dsp and cs-amp-lib.

Nico Pache (1):
firmware: cs_dsp: tests: Depend on FW_CS_DSP rather then enabling it

Richard Fitzgerald (2):
kunit: configs: Add some Cirrus Logic modules to all_tests
ASoC: cs-amp-lib-test: Don't select SND_SOC_CS_AMP_LIB

 drivers/firmware/cirrus/Kconfig              | 5 +----
 sound/soc/codecs/Kconfig                     | 5 ++---
 tools/testing/kunit/configs/all_tests.config | 2 ++
 3 files changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.39.5
author maintainer
#1 lore raw

PATCH 1/3 kunit: configs: Add some Cirrus Logic modules to all_tests

Add CONFIG_I2C and CONFIG_SND_SOC_CS35L56_I2C to all_tests.config so that Cirrus Logic modules with KUnit tests will be built.

The CS35L56 driver doesn't currently have any KUnit tests itself, but it enables two other libraries that have KUnit tests:
cs_dsp and cs-amp-lib.

---
 tools/testing/kunit/configs/all_tests.config | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/kunit/configs/all_tests.config +2 -0
index 4a60bb71fe72..4ce38c4f697f 100644
@@ -21,6 +21,7 @@ CONFIG_VFAT_FS=y
 
 CONFIG_PCI=y
 CONFIG_USB4=y
+CONFIG_I2C=y
 
 CONFIG_NET=y
 CONFIG_MCTP=y
@@ -52,3 +53,4 @@ CONFIG_SOUND=y
 CONFIG_SND=y
 CONFIG_SND_SOC=y
 CONFIG_SND_SOC_TOPOLOGY_BUILD=y
+CONFIG_SND_SOC_CS35L56_I2C=y
Signature · 1 line
2.39.5
author maintainer
#2 lore raw

PATCH 2/3 ASoC: cs-amp-lib-test: Don't select SND_SOC_CS_AMP_LIB

In reply to Richard Fitzgerald

Depend on SND_SOC_CS_AMP_LIB instead of selecting it.

KUNIT_ALL_TESTS should only build tests for components that are already being built, it should not cause other stuff to be added to the build.

Fixes 177862317a98 ("ASoC: cs-amp-lib: Add KUnit test for calibration helpers")
---
 sound/soc/codecs/Kconfig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
sound/soc/codecs/Kconfig +2 -3
index 870eb90116f1..c388676ce380 100644
@@ -776,10 +776,9 @@ config SND_SOC_CS_AMP_LIB
 	tristate
 
 config SND_SOC_CS_AMP_LIB_TEST
-	tristate "KUnit test for Cirrus Logic cs-amp-lib"
-	depends on KUNIT
+	tristate "KUnit test for Cirrus Logic cs-amp-lib" if !KUNIT_ALL_TESTS
+	depends on SND_SOC_CS_AMP_LIB && KUNIT
 	default KUNIT_ALL_TESTS
-	select SND_SOC_CS_AMP_LIB
 	help
 	  This builds KUnit tests for the Cirrus Logic common
 	  amplifier library.
Signature · 1 line
2.39.5
author maintainer
#3 lore raw

PATCH 3/3 firmware: cs_dsp: tests: Depend on FW_CS_DSP rather then enabling it

In reply to Richard Fitzgerald

From: Nico Pache <[email protected]>

FW_CS_DSP gets enabled if KUNIT is enabled. The test should rather depend on if the feature is enabled. Fix this by moving FW_CS_DSP to the depends on clause.

Fixes dd0b6b1f29b9 ("firmware: cs_dsp: Add KUnit testing of bin file download")
---
 drivers/firmware/cirrus/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/firmware/cirrus/Kconfig +1 -4
index 0a883091259a..e3c2e38b746d 100644
@@ -6,14 +6,11 @@ config FW_CS_DSP
 
 config FW_CS_DSP_KUNIT_TEST_UTILS
 	tristate
-	depends on KUNIT && REGMAP
-	select FW_CS_DSP
 
 config FW_CS_DSP_KUNIT_TEST
 	tristate "KUnit tests for Cirrus Logic cs_dsp" if !KUNIT_ALL_TESTS
-	depends on KUNIT && REGMAP
+	depends on KUNIT && REGMAP && FW_CS_DSP
 	default KUNIT_ALL_TESTS
-	select FW_CS_DSP
 	select FW_CS_DSP_KUNIT_TEST_UTILS
 	help
 	  This builds KUnit tests for cs_dsp.
Signature · 1 line
2.39.5
Reviewed-by on the v1 series
#4 lore raw
In reply to Richard Fitzgerald
Quoted 8 lines · Richard Fitzgerald

This series fixes the KConfig for cs_dsp and cs-amp-lib tests so that CONFIG_KUNIT_ALL_TESTS doesn't cause them to add modules to the build.

Patch 1 adds the ASoC CS35L56 driver to KUnit all_tests.config so that
cs_dsp and cs-amp-lib will be included in the test build.

Patch 2 and 3 fixup the KConfig entries for cs_dsp and cs-amp-lib.

This looks great to me.

The series is:

Do you want us to take this (either the whole thing, or just the first patch) via the KUnit tree, or will you take it yourself? Either should work here.

Cheers,
-- David

Quoted 16 lines

Nico Pache (1):
firmware: cs_dsp: tests: Depend on FW_CS_DSP rather then enabling it

Richard Fitzgerald (2):
kunit: configs: Add some Cirrus Logic modules to all_tests
ASoC: cs-amp-lib-test: Don't select SND_SOC_CS_AMP_LIB

 drivers/firmware/cirrus/Kconfig              | 5 +----
 sound/soc/codecs/Kconfig                     | 5 ++---
 tools/testing/kunit/configs/all_tests.config | 2 ++
 3 files changed, 5 insertions(+), 7 deletions(-)

--
2.39.5

maintainer
#5 lore raw
In reply to Richard Fitzgerald
Quoted 9 lines · Richard Fitzgerald

This series fixes the KConfig for cs_dsp and cs-amp-lib tests so that CONFIG_KUNIT_ALL_TESTS doesn't cause them to add modules to the build.

Patch 1 adds the ASoC CS35L56 driver to KUnit all_tests.config so that
cs_dsp and cs-amp-lib will be included in the test build.

Patch 2 and 3 fixup the KConfig entries for cs_dsp and cs-amp-lib.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/3] kunit: configs: Add some Cirrus Logic modules to all_tests

      commit: 1aa495a6572f8641da4ec4cd32210deca61bed64
[2/3] ASoC: cs-amp-lib-test: Don't select SND_SOC_CS_AMP_LIB
      commit: 96014d91cffb335d3b396771524ff2aba3549865
[3/3] firmware: cs_dsp: tests: Depend on FW_CS_DSP rather then enabling it
      commit: a0b887f6eb9a0d1be3c57d00b0f3ba8408d3018a

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark