linux/sound/soc
Mark Brown 29be3f0263
Merge series "Add KUNIT tests for ASoC topology" from Amadeusz Sławiński<amadeuszx.slawinski@linux.intel.com>:
This series adds unit tests for ASoC topology.

First fix problems found when developing and running test cases and
then add tests implementation.

Tests themselves are quite simple and just call
snd_soc_tplg_component_load() with various parameters and check the
result. Tests themselves are described in more detail in commits
adding them.

Goal is to expand the amount of test cases in following patches.

Prerequisity for this patchset are 2 patches which have already been
sent:
https://lore.kernel.org/alsa-devel/20210114163602.911205-1-amadeuszx.slawinski@linux.intel.com/T/#t

Description on how typical test case itself works:

In order to load topology we need to have 3 things:
card, codec component & platform component.

In typical test case we register card and platform component and bind
to dummy codec. There are of course execeptions, when we want to
test behaviour of topology API when component or card is missing.
Note that this is bit different from typical scenario (in SOF and skylake
drivers) where card is registered by machine driver and component by
platform driver, as we register both when setting up test.

If you check the test case most of them have similar architecture of:
1.
	/* run test */
	ret = snd_soc_register_card(&kunit_comp->card);
	if (ret != 0 && ret != -EPROBE_DEFER)
		KUNIT_FAIL(test, "Failed to register card");

2.
	ret = snd_soc_component_initialize(&kunit_comp->comp, &test_component, test_dev);
	KUNIT_EXPECT_EQ(test, 0, ret);

3.
	ret = snd_soc_add_component(&kunit_comp->comp, NULL, 0);
	KUNIT_EXPECT_EQ(test, 0, ret);

Ad. 1.
First we register card, which in most tests returns -EPROBE_DEFER
(from snd_soc_bind_card()), as platform component is not yet created.
I test for both 0 and -EPROBE_DEFER, as it makes it easier to reshuffle
this code around if needed and there is one test case which does it in
different order.

Ad. 2.
Then we initialize platform component with structure pointing at proper
probe function, which calls snd_soc_tplg_component_load() with test
parameters and checks expected result.

Ad. 3.
And then in follow up we call snd_soc_add_component() which creates
platform component for us and calls snd_soc_try_rebind_card() which
if everything is bound properly calls previously set probe function.

Amadeusz Sławiński (5):
  ASoC: topology: Properly unregister DAI on removal
  Revert "ASoC: soc-devres: add devm_snd_soc_register_dai()"
  ASoC: topology: KUnit: Add KUnit tests passing various arguments to
    snd_soc_tplg_component_load
  ASoC: topology: KUnit: Add KUnit tests passing empty topology with
    variants to snd_soc_tplg_component_load
  ASoC: topology: KUnit: Add KUnit tests passing topology with PCM to
    snd_soc_tplg_component_load

 include/sound/soc.h           |   4 -
 sound/soc/Kconfig             |  17 +
 sound/soc/Makefile            |   5 +
 sound/soc/soc-devres.c        |  37 --
 sound/soc/soc-topology-test.c | 843 ++++++++++++++++++++++++++++++++++
 sound/soc/soc-topology.c      |   9 +-
 6 files changed, 870 insertions(+), 45 deletions(-)
 create mode 100644 sound/soc/soc-topology-test.c

--
2.25.1
2021-01-21 00:00:52 +00:00
..
adi ASoc: adi: Kconfig: Remove depends on for ADI reference designs 2020-11-17 17:08:42 +00:00
amd ASoC: AMD Renoir - refine DMI entries for some Lenovo products 2021-01-20 16:46:46 +00:00
atmel ASoC: atmel: fix spelling mistake in Kconfig "programable" -> "programmable" 2020-12-16 13:53:53 +00:00
au1x
bcm ASoC: bcm2835-i2s: remove unneeded semicolon 2020-11-02 15:53:22 +00:00
cirrus
codecs ASoC: wm_adsp: Fix control name parsing for multi-fw 2021-01-18 14:02:47 +00:00
dwc
fsl ASoC: hdmi-codec: Fix return value in hdmi_codec_set_jack() 2021-01-08 14:00:42 +00:00
generic ASoC: Fix 7/8 spaces indentation in Kconfig 2020-11-17 17:08:45 +00:00
hisilicon
img
intel Linux 5.11-rc1 2020-12-28 14:16:53 +00:00
jz4740 Merge remote-tracking branch 'asoc/for-5.11' into asoc-next 2020-12-11 17:48:04 +00:00
kirkwood ASoC: kirkwood: armada-370-db: mark OF related data as maybe unused 2020-11-26 13:07:04 +00:00
mediatek ASoC: mediatek: mt8183: delete some unreachable code 2020-12-11 13:23:02 +00:00
meson ASoC: meson: axg-tdm-interface: fix loopback 2020-12-17 17:11:42 +00:00
mxs
pxa ASoC: mmp-sspa: set phase two word length register 2020-11-20 13:49:08 +00:00
qcom ASoC: qcom: lpass-ipq806x: fix bitwidth regmap field 2021-01-20 16:46:47 +00:00
rockchip ASoC: rockchip: mark OF related data as maybe unused 2020-11-26 13:07:07 +00:00
samsung ASoC: samsung: smdk_wm8994: remove redundant of_match_ptr() 2020-11-26 13:07:33 +00:00
sh ASoC: rsnd: don't call clk_disable_unprepare() if can't use 2020-12-17 14:24:42 +00:00
sirf
sof ASoC: SOF: Intel: fix page fault at probe if i915 init fails 2021-01-13 16:33:40 +00:00
spear
sprd
sti
stm Staging / IIO driver patches for 5.11-rc1 2020-12-15 14:18:40 -08:00
sunxi ASoC: sunxi: do not select COMMON_CLK to fix builds 2020-11-19 13:00:01 +00:00
tegra ASoC: tegra: Don't warn on probe deferral 2020-11-11 12:35:10 +00:00
ti ASoC: Updates for v5.11 2020-12-14 15:57:14 +01:00
txx9
uniphier ASoC: uniphier: mark OF related data as maybe unused 2020-11-26 13:07:09 +00:00
ux500
xilinx
xtensa
zte
Kconfig
Makefile
soc-ac97.c
soc-acpi.c
soc-card.c
soc-component.c ASoC: soc-pcm: care trigger rollback 2020-12-09 12:13:38 +00:00
soc-compress.c ASoC: soc-compress: add soc_compr_clean() and call it from soc_compr_open/free() 2020-11-26 13:09:37 +00:00
soc-core.c Auxiliary Bus support tag for 5.11-rc1 2020-12-04 20:39:45 +00:00
soc-dai.c ASoC: soc-pcm: care trigger rollback 2020-12-09 12:13:38 +00:00
soc-dapm.c ASoC: dapm: remove widget from dirty list on free 2020-12-15 13:29:01 +00:00
soc-devres.c
soc-generic-dmaengine-pcm.c ASoC: dmaengine: Document support for TX only or RX only streams 2020-10-09 15:11:20 +01:00
soc-jack.c
soc-link.c ASoC: soc-pcm: care trigger rollback 2020-12-09 12:13:38 +00:00
soc-ops.c
soc-pcm.c ASoC: soc-pcm: care trigger rollback 2020-12-09 12:13:38 +00:00
soc-topology.c Merge series "Add KUNIT tests for ASoC topology" from Amadeusz Sławiński<amadeuszx.slawinski@linux.intel.com>: 2021-01-21 00:00:52 +00:00
soc-utils.c