From: Mark Brown <broonie@kernel.org>
To: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>,
Shuah Khan <shuah@kernel.org>
Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org,
Mark Brown <broonie@kernel.org>
Subject: [PATCH v2 3/6] kselftest/alsa: Report failures to set the requested channels as skips
Date: Thu, 1 Dec 2022 17:07:42 +0000 [thread overview]
Message-ID: <20221201170745.1111236-4-broonie@kernel.org> (raw)
In-Reply-To: <20221201170745.1111236-1-broonie@kernel.org>
If constraint selection gives us a number of channels other than the one
that we asked for that isn't a failure, that is the device implementing
constraints and advertising that it can't support whatever we asked
for. Report such cases as a test skip rather than failure so we don't have
false positives.
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/alsa/pcm-test.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c
index edb820fe2ee6..c701cf507a95 100644
--- a/tools/testing/selftests/alsa/pcm-test.c
+++ b/tools/testing/selftests/alsa/pcm-test.c
@@ -241,6 +241,7 @@ static void test_pcm_time1(struct pcm_data *data,
snd_pcm_sframes_t frames;
long long ms;
long rate, channels, period_size, buffer_size;
+ unsigned int rchannels;
unsigned int rrate;
snd_pcm_uframes_t rperiod_size, rbuffer_size, start_threshold;
timestamp_t tstamp;
@@ -310,11 +311,17 @@ static void test_pcm_time1(struct pcm_data *data,
snd_pcm_format_name(format), snd_strerror(err));
goto __close;
}
- err = snd_pcm_hw_params_set_channels(handle, hw_params, channels);
+ rchannels = channels;
+ err = snd_pcm_hw_params_set_channels_near(handle, hw_params, &rchannels);
if (err < 0) {
snprintf(msg, sizeof(msg), "snd_pcm_hw_params_set_channels %ld: %s", channels, snd_strerror(err));
goto __close;
}
+ if (rchannels != channels) {
+ snprintf(msg, sizeof(msg), "channels unsupported %ld != %ld", channels, rchannels);
+ skip = true;
+ goto __close;
+ }
rrate = rate;
err = snd_pcm_hw_params_set_rate_near(handle, hw_params, &rrate, 0);
if (err < 0) {
--
2.30.2
next prev parent reply other threads:[~2022-12-01 17:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-01 17:07 [PATCH v2 0/6] kselftest/alsa: pcm-test improvements Mark Brown
2022-12-01 17:07 ` [PATCH v2 1/6] kselftest/alsa: Refactor pcm-test to list the tests to run in a struct Mark Brown
2022-12-01 17:07 ` [PATCH v2 2/6] kselftest/alsa: Report failures to set the requested sample rate as skips Mark Brown
2022-12-01 17:07 ` Mark Brown [this message]
2022-12-01 17:07 ` [PATCH v2 4/6] kselftest/alsa: Don't any configuration in the sample config Mark Brown
2022-12-01 17:07 ` [PATCH v2 5/6] kselftest/alsa: Provide more meaningful names for tests Mark Brown
2022-12-01 17:07 ` [PATCH v2 6/6] kselftest/alsa: Add more coverage of sample rates and channel counts Mark Brown
2022-12-01 19:06 ` [PATCH v2 0/6] kselftest/alsa: pcm-test improvements Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221201170745.1111236-4-broonie@kernel.org \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=perex@perex.cz \
--cc=shuah@kernel.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox