Commit 3e39acf5 authored by Ivan Orlov's avatar Ivan Orlov Committed by Takashi Iwai

ALSA: core: Add sound core KUnit test

At the moment, we have a decent amount of integration tests (selftests)
covering different aspects of the sound subsystem. However, a lot of
of sound-related in-kernel functions remains uncovered. This patch
introduces the KUnit test for the core part of the sound subsystem.
It includes 10 test cases:

- Coverage of the format-related inline functions from 'pcm.h' header
file: snd_pcm_format_physical_width, snd_pcm_format_width,
snd_pcm_format_signed, test_format_endianness

- Coverage of the available bytes counting functions from 'pcm.h'
header: snd_pcm_capture_avail, snd_pcm_playback_avail

- Coverage of functions from pcm_misc: snd_pcm_format_set_silence,
snd_pcm_format_name

- Coverage of card-related functions from init.c: snd_card_set_id,
snd_component_add

This patch depends on the previous patches in this patch series as they
contain fix for the bug, which was found during the test development.
Without them, the test doesn't pass.
Signed-off-by: default avatarIvan Orlov <ivan.orlov0322@gmail.com>
Link: https://lore.kernel.org/r/20240125223522.1122765-3-ivan.orlov0322@gmail.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d1eb913c
......@@ -20484,6 +20484,12 @@ F: include/uapi/sound/compress_*
F: sound/core/compress_offload.c
F: sound/soc/soc-compress.c
SOUND - CORE KUNIT TEST
M: Ivan Orlov <ivan.orlov0322@gmail.com>
L: linux-sound@vger.kernel.org
S: Supported
F: sound/core/sound_kunit.c
SOUND - DMAENGINE HELPERS
M: Lars-Peter Clausen <lars@metafoo.de>
S: Supported
......
......@@ -39,6 +39,22 @@ config SND_UMP_LEGACY_RAWMIDI
legacy MIDI 1.0 byte streams is created for each UMP Endpoint.
The device contains 16 substreams corresponding to UMP groups.
config SND_CORE_TEST
tristate "Sound core KUnit test"
depends on KUNIT
default KUNIT_ALL_TESTS
help
This options enables the sound core functions KUnit test.
KUnit tests run during boot and output the results to the debug
log in TAP format (https://testanything.org/). Only useful for
kernel devs running KUnit test harness and are not for inclusion
into a production build.
For more information on KUnit and unit tests in general, refer
to the KUnit documentation in Documentation/dev-tools/kunit/.
config SND_COMPRESS_OFFLOAD
tristate
......
......@@ -49,6 +49,8 @@ obj-$(CONFIG_SND_SEQ_DEVICE) += snd-seq-device.o
obj-$(CONFIG_SND_RAWMIDI) += snd-rawmidi.o
obj-$(CONFIG_SND_UMP) += snd-ump.o
obj-$(CONFIG_SND_CORE_TEST) += sound_kunit.o
obj-$(CONFIG_SND_OSSEMUL) += oss/
obj-$(CONFIG_SND_SEQUENCER) += seq/
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment