Skip to content

Commit f944f8b

Browse files
broonietiwai
authored andcommitted
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: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 22eeb8f commit f944f8b

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

tools/testing/selftests/alsa/pcm-test.c

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ static void test_pcm_time1(struct pcm_data *data,
247247
bool pass = false, automatic = true;
248248
snd_pcm_hw_params_t *hw_params;
249249
snd_pcm_sw_params_t *sw_params;
250+
bool skip = false;
250251

251252
snd_pcm_hw_params_alloca(&hw_params);
252253
snd_pcm_sw_params_alloca(&sw_params);
@@ -321,7 +322,8 @@ static void test_pcm_time1(struct pcm_data *data,
321322
goto __close;
322323
}
323324
if (rrate != rate) {
324-
snprintf(msg, sizeof(msg), "rate mismatch %ld != %ld", rate, rrate);
325+
snprintf(msg, sizeof(msg), "rate unsupported %ld != %ld", rate, rrate);
326+
skip = true;
325327
goto __close;
326328
}
327329
rperiod_size = period_size;
@@ -417,11 +419,20 @@ static void test_pcm_time1(struct pcm_data *data,
417419
msg[0] = '\0';
418420
pass = true;
419421
__close:
420-
ksft_test_result(pass, "%s.%d.%d.%d.%s%s%s\n",
421-
test->cfg_prefix,
422-
data->card, data->device, data->subdevice,
423-
snd_pcm_stream_name(data->stream),
424-
msg[0] ? " " : "", msg);
422+
if (!skip) {
423+
ksft_test_result(pass, "%s.%d.%d.%d.%s%s%s\n",
424+
test->cfg_prefix,
425+
data->card, data->device, data->subdevice,
426+
snd_pcm_stream_name(data->stream),
427+
msg[0] ? " " : "", msg);
428+
} else {
429+
ksft_test_result_skip("%s.%d.%d.%d.%s%s%s\n",
430+
test->cfg_prefix,
431+
data->card, data->device,
432+
data->subdevice,
433+
snd_pcm_stream_name(data->stream),
434+
msg[0] ? " " : "", msg);
435+
}
425436
free(samples);
426437
if (handle)
427438
snd_pcm_close(handle);

0 commit comments

Comments
 (0)