On 19/03/2025 11:05 pm, Nico Pache wrote:
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, and set CONFIG_FW_CS_DSP=y in the kunit tooling.

Fixes: dd0b6b1f29b9 ("firmware: cs_dsp: Add KUnit testing of bin file download")
Signed-off-by: Nico Pache <npa...@redhat.com>

This patch doesn't actually work and breaks kunit.py.

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

diff --git a/drivers/firmware/cirrus/Kconfig b/drivers/firmware/cirrus/Kconfig
index 0a883091259a..989568ab5712 100644
--- a/drivers/firmware/cirrus/Kconfig
+++ b/drivers/firmware/cirrus/Kconfig
@@ -11,9 +11,8 @@ config FW_CS_DSP_KUNIT_TEST_UTILS
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

These changes result in a circular reference:

error: recursive dependency detected!
        symbol FW_CS_DSP is selected by FW_CS_DSP_KUNIT_TEST_UTILS
        symbol FW_CS_DSP_KUNIT_TEST_UTILS is selected by
FW_CS_DSP_KUNIT_TEST
        symbol FW_CS_DSP_KUNIT_TEST depends on FW_CS_DSP

        select FW_CS_DSP_KUNIT_TEST_UTILS
        help
          This builds KUnit tests for cs_dsp.
diff --git a/tools/testing/kunit/configs/all_tests.config 
b/tools/testing/kunit/configs/all_tests.config
index b0049be00c70..96c6b4aca87d 100644
--- a/tools/testing/kunit/configs/all_tests.config
+++ b/tools/testing/kunit/configs/all_tests.config
@@ -49,3 +49,5 @@ CONFIG_SOUND=y
  CONFIG_SND=y
  CONFIG_SND_SOC=y
  CONFIG_SND_SOC_TOPOLOGY_BUILD=y
+
+CONFIG_FW_CS_DSP=y

This won't work because CONFIG_FW_CS_DSP isn't a visible option so it
breaks kunit.py:

ERROR:root:Not all Kconfig options selected in kunitconfig were in the
generated .config.
This is probably due to unsatisfied dependencies.
Missing: CONFIG_FW_CS_DSP=y

I suggest dropping this change to all_tests.config and only fixing
the Kconfig so that CONFIG_KUNIT_ALL_TESTS doesn't force
CONFIG_FW_CS_DSP.

Reply via email to