Skip to content

Commit aba51cd

Browse files
perexgtiwai
authored andcommitted
selftests: alsa - add PCM test
This initial code does a simple sample transfer tests. By default, all PCM devices are detected and tested with short and long buffering parameters for 4 seconds. If the sample transfer timing is not in a +-100ms boundary, the test fails. Only the interleaved buffering scheme is supported in this version. The configuration may be modified with the configuration files. A specific hardware configuration is detected and activated using the sysfs regex matching. This allows to use the DMI string (/sys/class/dmi/id/* tree) or any other system parameters exposed in sysfs for the matching for the CI automation. The configuration file may also specify the PCM device list to detect the missing PCM devices. v1..v2: - added missing alsa-local.h header file Cc: Mark Brown <[email protected]> Cc: Pierre-Louis Bossart <[email protected]> Cc: Liam Girdwood <[email protected]> Cc: Jesse Barnes <[email protected]> Cc: Jimmy Cheng-Yi Chiang <[email protected]> Cc: Curtis Malainey <[email protected]> Cc: Brian Norris <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 3827597 commit aba51cd

File tree

5 files changed

+1003
-1
lines changed

5 files changed

+1003
-1
lines changed

tools/testing/selftests/alsa/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ ifeq ($(LDLIBS),)
77
LDLIBS += -lasound
88
endif
99

10-
TEST_GEN_PROGS := mixer-test
10+
TEST_GEN_PROGS := mixer-test pcm-test
11+
12+
pcm-test: pcm-test.c conf.c
1113

1214
include ../lib.mk
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
//
3+
// kselftest configuration helpers for the hw specific configuration
4+
//
5+
// Original author: Jaroslav Kysela <[email protected]>
6+
// Copyright (c) 2022 Red Hat Inc.
7+
8+
#ifndef __ALSA_LOCAL_H
9+
#define __ALSA_LOCAL_H
10+
11+
#include <alsa/asoundlib.h>
12+
13+
void conf_load(void);
14+
void conf_free(void);
15+
snd_config_t *conf_by_card(int card);
16+
snd_config_t *conf_get_subtree(snd_config_t *root, const char *key1, const char *key2);
17+
int conf_get_count(snd_config_t *root, const char *key1, const char *key2);
18+
const char *conf_get_string(snd_config_t *root, const char *key1, const char *key2, const char *def);
19+
long conf_get_long(snd_config_t *root, const char *key1, const char *key2, long def);
20+
int conf_get_bool(snd_config_t *root, const char *key1, const char *key2, int def);
21+
22+
#endif /* __ALSA_LOCAL_H */

0 commit comments

Comments
 (0)