Commit f944f8b5 authored by Mark Brown's avatar Mark Brown Committed by Takashi Iwai

kselftest/alsa: Report failures to set the requested sample rate as skips

If constraint selection gives us a sample rate other than the one that we
asked for that isn't a failure, that is the device implementing sample
rate 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: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20221201170745.1111236-3-broonie@kernel.orgSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 22eeb8f5
...@@ -247,6 +247,7 @@ static void test_pcm_time1(struct pcm_data *data, ...@@ -247,6 +247,7 @@ static void test_pcm_time1(struct pcm_data *data,
bool pass = false, automatic = true; bool pass = false, automatic = true;
snd_pcm_hw_params_t *hw_params; snd_pcm_hw_params_t *hw_params;
snd_pcm_sw_params_t *sw_params; snd_pcm_sw_params_t *sw_params;
bool skip = false;
snd_pcm_hw_params_alloca(&hw_params); snd_pcm_hw_params_alloca(&hw_params);
snd_pcm_sw_params_alloca(&sw_params); snd_pcm_sw_params_alloca(&sw_params);
...@@ -321,7 +322,8 @@ static void test_pcm_time1(struct pcm_data *data, ...@@ -321,7 +322,8 @@ static void test_pcm_time1(struct pcm_data *data,
goto __close; goto __close;
} }
if (rrate != rate) { if (rrate != rate) {
snprintf(msg, sizeof(msg), "rate mismatch %ld != %ld", rate, rrate); snprintf(msg, sizeof(msg), "rate unsupported %ld != %ld", rate, rrate);
skip = true;
goto __close; goto __close;
} }
rperiod_size = period_size; rperiod_size = period_size;
...@@ -417,11 +419,20 @@ static void test_pcm_time1(struct pcm_data *data, ...@@ -417,11 +419,20 @@ static void test_pcm_time1(struct pcm_data *data,
msg[0] = '\0'; msg[0] = '\0';
pass = true; pass = true;
__close: __close:
ksft_test_result(pass, "%s.%d.%d.%d.%s%s%s\n", if (!skip) {
test->cfg_prefix, ksft_test_result(pass, "%s.%d.%d.%d.%s%s%s\n",
data->card, data->device, data->subdevice, test->cfg_prefix,
snd_pcm_stream_name(data->stream), data->card, data->device, data->subdevice,
msg[0] ? " " : "", msg); snd_pcm_stream_name(data->stream),
msg[0] ? " " : "", msg);
} else {
ksft_test_result_skip("%s.%d.%d.%d.%s%s%s\n",
test->cfg_prefix,
data->card, data->device,
data->subdevice,
snd_pcm_stream_name(data->stream),
msg[0] ? " " : "", msg);
}
free(samples); free(samples);
if (handle) if (handle)
snd_pcm_close(handle); snd_pcm_close(handle);
......
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