We have some KUnit tests for ASoC but they're not being run as much as they should be since ASoC isn't enabled in the configs used by default with KUnit and in the case of the topolofy tests there is no way to enable them without enabling drivers that use them. Let's improve that.
Signed-off-by: Mark Brown broonie@kernel.org --- Mark Brown (2): kunit: Enable ASoC in all_tests.config ASoC: topology: Add explicit build option
sound/soc/Kconfig | 11 +++++++++++ tools/testing/kunit/configs/all_tests.config | 5 +++++ 2 files changed, 16 insertions(+) --- base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 change-id: 20230701-asoc-topology-kunit-enable-5e8dd50d0ed7
Best regards,
There are KUnit tests for some of the ASoC utility functions which are not enabled in the KUnit all_tests.config, do so.
Signed-off-by: Mark Brown broonie@kernel.org --- tools/testing/kunit/configs/all_tests.config | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/testing/kunit/configs/all_tests.config b/tools/testing/kunit/configs/all_tests.config index 0393940c706a..13d15bc693fb 100644 --- a/tools/testing/kunit/configs/all_tests.config +++ b/tools/testing/kunit/configs/all_tests.config @@ -35,3 +35,7 @@ CONFIG_DAMON_DBGFS=y
CONFIG_SECURITY=y CONFIG_SECURITY_APPARMOR=y + +CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_SOC=y
On Wed, 12 Jul 2023 at 23:40, Mark Brown broonie@kernel.org wrote:
There are KUnit tests for some of the ASoC utility functions which are not enabled in the KUnit all_tests.config, do so.
Signed-off-by: Mark Brown broonie@kernel.org
While I love the idea of this, it breaks the default UML --alltests build, as all of ALSA is behind an "if !UML".
I think that's a dealbreaker for this change as-is, which leaves us with a few options: 1. Don't include this in --alltests, but provide a separate kunitconfig to run it. Not ideal, but simplest. 2. Make ALSA build with UML. Just removing the "if !UML" makes this work, but I imagine would uncover a lot of other issues. 3. Change the way --alltests works to allow for UML-only / non-UML / architecture-specific options.
I suspect the ultimately ideal option would be a bit of all three, but I'd be happy with any of them in the meantime.
ALSA folks, how horrifying a prospect is removing the "if !UML" everywhere? If it's not trivial, how do we feel about adding "sound/soc/.kunitconfig" containing these tests?
On the KUnit side, we can look into adding 'all_tests_nonuml.config" or something as a workaround.
Cheers, -- David
tools/testing/kunit/configs/all_tests.config | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/tools/testing/kunit/configs/all_tests.config b/tools/testing/kunit/configs/all_tests.config index 0393940c706a..13d15bc693fb 100644 --- a/tools/testing/kunit/configs/all_tests.config +++ b/tools/testing/kunit/configs/all_tests.config @@ -35,3 +35,7 @@ CONFIG_DAMON_DBGFS=y
CONFIG_SECURITY=y CONFIG_SECURITY_APPARMOR=y
+CONFIG_SOUND=y +CONFIG_SND=y +CONFIG_SND_SOC=y
-- 2.39.2
On Thu, Jul 13, 2023 at 12:19:13PM +0800, David Gow wrote:
While I love the idea of this, it breaks the default UML --alltests build, as all of ALSA is behind an "if !UML".
Oh, UML finally works again - that's good.
ALSA folks, how horrifying a prospect is removing the "if !UML" everywhere? If it's not trivial, how do we feel about adding "sound/soc/.kunitconfig" containing these tests?
I suspect this is due to UML not providing some key APIs like DMA, if it's building now I guess those dependencies might have been fixed. Do all the drivers build properly if you enable UML, otherwise all the randconfig people will get upset, it could've been to save all the drivers from having to deal with UML features issues?
Another option would be for the KUnit runner to just ignore kconfig options getting disabled.
The default KUnit build options are not supposed to enable any subsystems that were not already enabled but the topology code is a library which is generally selected by drivers that want to use it. Since KUnit is frequently run in virtual environments with minimal driver support this makes it difficult to enable the toplogy tests so provide an explicit Kconfig option which can be directly enabled when using KUnit, and also include this in the KUnit all_tests.config.
Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/Kconfig | 11 +++++++++++ tools/testing/kunit/configs/all_tests.config | 1 + 2 files changed, 12 insertions(+)
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index bfa9622e1ab1..439fa631c342 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -38,6 +38,17 @@ config SND_SOC_TOPOLOGY bool select SND_DYNAMIC_MINORS
+config SND_SOC_TOPOLOGY_BUILD + bool "Build topology core" + select SND_SOC_TOPOLOGY + depends on KUNIT + help + This option exists to facilitate running the KUnit tests for + the topology core, KUnit is frequently tested in virtual + environments with minimal drivers enabled but the topology + core is usually selected by drivers. There is little reason + to enable it if not doing a KUnit build. + config SND_SOC_TOPOLOGY_KUNIT_TEST tristate "KUnit tests for SoC topology" depends on KUNIT diff --git a/tools/testing/kunit/configs/all_tests.config b/tools/testing/kunit/configs/all_tests.config index 13d15bc693fb..b8adb59455ef 100644 --- a/tools/testing/kunit/configs/all_tests.config +++ b/tools/testing/kunit/configs/all_tests.config @@ -39,3 +39,4 @@ CONFIG_SECURITY_APPARMOR=y CONFIG_SOUND=y CONFIG_SND=y CONFIG_SND_SOC=y +CONFIG_SND_SOC_TOPOLOGY_BUILD=y
On Wed, 12 Jul 2023 at 23:40, Mark Brown broonie@kernel.org wrote:
The default KUnit build options are not supposed to enable any subsystems that were not already enabled but the topology code is a library which is generally selected by drivers that want to use it. Since KUnit is frequently run in virtual environments with minimal driver support this makes it difficult to enable the toplogy tests so provide an explicit Kconfig option which can be directly enabled when using KUnit, and also include this in the KUnit all_tests.config.
Signed-off-by: Mark Brown broonie@kernel.org
Thanks a bunch for this: the topology tests have always been some of the most annoying to run, and this makes it so much easier.
That being said, it does still break when run with ARCH=um (see the response to patch 1/2), so we might need to remove it from all_tests.config or make some other changes.
Having the CONFIG_SND_SOC_TOPOLOGY_BUILD option is definitely much better, regardless of whether it's default or not.
Reviewed-by: David Gow davidgow@google.com
Cheers, -- David
sound/soc/Kconfig | 11 +++++++++++ tools/testing/kunit/configs/all_tests.config | 1 + 2 files changed, 12 insertions(+)
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig index bfa9622e1ab1..439fa631c342 100644 --- a/sound/soc/Kconfig +++ b/sound/soc/Kconfig @@ -38,6 +38,17 @@ config SND_SOC_TOPOLOGY bool select SND_DYNAMIC_MINORS
+config SND_SOC_TOPOLOGY_BUILD
bool "Build topology core"
select SND_SOC_TOPOLOGY
depends on KUNIT
help
This option exists to facilitate running the KUnit tests for
the topology core, KUnit is frequently tested in virtual
environments with minimal drivers enabled but the topology
core is usually selected by drivers. There is little reason
to enable it if not doing a KUnit build.
config SND_SOC_TOPOLOGY_KUNIT_TEST tristate "KUnit tests for SoC topology" depends on KUNIT diff --git a/tools/testing/kunit/configs/all_tests.config b/tools/testing/kunit/configs/all_tests.config index 13d15bc693fb..b8adb59455ef 100644 --- a/tools/testing/kunit/configs/all_tests.config +++ b/tools/testing/kunit/configs/all_tests.config @@ -39,3 +39,4 @@ CONFIG_SECURITY_APPARMOR=y CONFIG_SOUND=y CONFIG_SND=y CONFIG_SND_SOC=y +CONFIG_SND_SOC_TOPOLOGY_BUILD=y
-- 2.39.2
On Wed, 12 Jul 2023 16:40:33 +0100, Mark Brown wrote:
We have some KUnit tests for ASoC but they're not being run as much as they should be since ASoC isn't enabled in the configs used by default with KUnit and in the case of the topolofy tests there is no way to enable them without enabling drivers that use them. Let's improve that.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] kunit: Enable ASoC in all_tests.config commit: 5aaa4024e14f8b878a348338a74b4c97bc2478b1 [2/2] ASoC: topology: Add explicit build option commit: b7dc237ef8b0897f5750a738d2c57469909a6a15
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
linux-kselftest-mirror@lists.linaro.org