[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230908181242.95714-1-nfraprado@collabora.com>
Date: Fri, 8 Sep 2023 14:12:40 -0400
From: Nícolas F. R. A. Prado
<nfraprado@...labora.com>
To: Takashi Iwai <tiwai@...e.com>
Cc: kernel@...labora.com,
Nícolas F. R. A. Prado
<nfraprado@...labora.com>, Jaroslav Kysela <perex@...ex.cz>,
Mark Brown <broonie@...nel.org>, Shuah Khan <shuah@...nel.org>,
alsa-devel@...a-project.org, linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org
Subject: [PATCH] kselftest/alsa: Mark test plan as skipped when no cards are available
When no soundcards are available, it won't be possible to run any tests.
Currently, when this happens, in both pcm-test and mixer-test, 0
tests are reported, and the pass exit code is returned. Instead, call
ksft_exit_skip() so that the whole test plan is marked as skipped in the
KTAP output and it exits with the skip exit code.
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@...labora.com>
---
tools/testing/selftests/alsa/mixer-test.c | 7 +++++--
tools/testing/selftests/alsa/pcm-test.c | 7 +++++--
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index c95d63e553f4..8f45c15a5667 100644
--- a/tools/testing/selftests/alsa/mixer-test.c
+++ b/tools/testing/selftests/alsa/mixer-test.c
@@ -66,8 +66,11 @@ static void find_controls(void)
char *card_name, *card_longname;
card = -1;
- if (snd_card_next(&card) < 0 || card < 0)
- return;
+ err = snd_card_next(&card);
+ if (err < 0)
+ ksft_exit_skip("Couldn't open first soundcard. rc=%d\n", err);
+ if (card < 0)
+ ksft_exit_skip("No soundcard available\n");
config = get_alsalib_config();
diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c
index 2f5e3c462194..74d9cf8b5a69 100644
--- a/tools/testing/selftests/alsa/pcm-test.c
+++ b/tools/testing/selftests/alsa/pcm-test.c
@@ -161,8 +161,11 @@ static void find_pcms(void)
snd_pcm_info_alloca(&pcm_info);
card = -1;
- if (snd_card_next(&card) < 0 || card < 0)
- return;
+ err = snd_card_next(&card);
+ if (err < 0)
+ ksft_exit_skip("Couldn't open first soundcard. rc=%d\n", err);
+ if (card < 0)
+ ksft_exit_skip("No soundcard available\n");
config = get_alsalib_config();
--
2.42.0
Powered by blists - more mailing lists