Skip to content

Commit 2144833

Browse files
rfvirgiltiwai
authored andcommitted
ALSA: hda: cirrus_scodec: Add KUnit test
Add a KUnit test for cirrus_scodec_get_speaker_id(). It is impractical to have enough hardware with every possible permutation of speaker id. So use a test harness to test all theoretically supported options. The test harness consists of: - a mock GPIO controller. - a mock struct device to represent the scodec driver - software nodes to provide the fwnode info that would normally come from ACPI. Signed-off-by: Richard Fitzgerald <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 6f03b44 commit 2144833

File tree

4 files changed

+394
-0
lines changed

4 files changed

+394
-0
lines changed

sound/pci/hda/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,18 @@ config SND_HDA_PATCH_LOADER
9494
config SND_HDA_CIRRUS_SCODEC
9595
tristate
9696

97+
config SND_HDA_CIRRUS_SCODEC_KUNIT_TEST
98+
tristate "KUnit test for Cirrus side-codec library" if !KUNIT_ALL_TESTS
99+
select SND_HDA_CIRRUS_SCODEC
100+
depends on KUNIT
101+
default KUNIT_ALL_TESTS
102+
help
103+
This builds KUnit tests for the cirrus side-codec library.
104+
For more information on KUnit and unit tests in general,
105+
please refer to the KUnit documentation in
106+
Documentation/dev-tools/kunit/.
107+
If in doubt, say "N".
108+
97109
config SND_HDA_SCODEC_CS35L41
98110
tristate
99111
select SND_HDA_GENERIC

sound/pci/hda/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o
2929

3030
# side codecs
3131
snd-hda-cirrus-scodec-objs := cirrus_scodec.o
32+
snd-hda-cirrus-scodec-test-objs := cirrus_scodec_test.o
3233
snd-hda-scodec-cs35l41-objs := cs35l41_hda.o cs35l41_hda_property.o
3334
snd-hda-scodec-cs35l41-i2c-objs := cs35l41_hda_i2c.o
3435
snd-hda-scodec-cs35l41-spi-objs := cs35l41_hda_spi.o
@@ -58,6 +59,7 @@ obj-$(CONFIG_SND_HDA_CODEC_HDMI) += snd-hda-codec-hdmi.o
5859

5960
# side codecs
6061
obj-$(CONFIG_SND_HDA_CIRRUS_SCODEC) += snd-hda-cirrus-scodec.o
62+
obj-$(CONFIG_SND_HDA_CIRRUS_SCODEC_KUNIT_TEST) += snd-hda-cirrus-scodec-test.o
6163
obj-$(CONFIG_SND_HDA_SCODEC_CS35L41) += snd-hda-scodec-cs35l41.o
6264
obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_I2C) += snd-hda-scodec-cs35l41-i2c.o
6365
obj-$(CONFIG_SND_HDA_SCODEC_CS35L41_SPI) += snd-hda-scodec-cs35l41-spi.o

0 commit comments

Comments
 (0)