[PATCH 2/2] selftests: ALSA: pcmtest: Load the module when it is missing
From: HyeongJun An
Date: Wed Nov 25 2026 - 22:55:48 EST
test-pcmtest-driver skips when the pcmtest debugfs files are missing.
The driver has no device to bind to, so nothing loads the module, and the
test skips even on a kernel that builds it.
Run modprobe once before skipping, as the net pktgen test does. The
module stays loaded. In the default order the test runs after mixer-test
and pcm-test, so the extra card does not change what they check.
Signed-off-by: HyeongJun An <sammiee5311@xxxxxxxxx>
---
tools/testing/selftests/alsa/test-pcmtest-driver.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/testing/selftests/alsa/test-pcmtest-driver.c b/tools/testing/selftests/alsa/test-pcmtest-driver.c
index b796a5613c6f..ea6a9e0f7483 100644
--- a/tools/testing/selftests/alsa/test-pcmtest-driver.c
+++ b/tools/testing/selftests/alsa/test-pcmtest-driver.c
@@ -6,6 +6,7 @@
* Copyright 2023 Ivan Orlov <ivan.orlov0322@xxxxxxxxx>
*/
#include <errno.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <alsa/asoundlib.h>
@@ -171,6 +172,9 @@ FIXTURE_SETUP(pcmtest) {
SKIP(return, "This test needs root to run!");
err = read_patterns();
+ /* nothing loads the module on its own, so ask for it */
+ if (err && !system("modprobe -q snd-pcmtest"))
+ err = read_patterns();
if (err)
SKIP(return, "Can't read patterns. Probably, module isn't loaded");
--
2.43.0