mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-14 10:19:08 +08:00
kselftest/alsa: pcm - skip tests when we fail to set params
Since we don't know what the capabilities of an unknown card is any of our standard tests may fail due to not being supported by the system. Set a flag once we've configured the stream, just before we start data, to say that the system accepted our stream configuration. Since there shouldn't be a use case for tests that are specified for the individual system failing for those tests we also add a new test which fails if we are unable to configure the settings specified in the system specific configuration file. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20221208-alsa-pcm-test-hacks-v4-4-5a152e65b1e1@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
@@ -243,6 +243,7 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class,
|
||||
snd_pcm_hw_params_t *hw_params;
|
||||
snd_pcm_sw_params_t *sw_params;
|
||||
const char *test_class_name;
|
||||
bool skip = true;
|
||||
|
||||
switch (class) {
|
||||
case TEST_CLASS_DEFAULT:
|
||||
@@ -395,6 +396,9 @@ __format:
|
||||
(long)rperiod_size, (long)rbuffer_size,
|
||||
(long)start_threshold);
|
||||
|
||||
/* Set all the params, actually run the test */
|
||||
skip = false;
|
||||
|
||||
timestamp_now(&tstamp);
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (data->stream == SND_PCM_STREAM_PLAYBACK) {
|
||||
@@ -434,12 +438,34 @@ __format:
|
||||
msg[0] = '\0';
|
||||
pass = true;
|
||||
__close:
|
||||
switch (class) {
|
||||
case TEST_CLASS_SYSTEM:
|
||||
test_class_name = "system";
|
||||
/*
|
||||
* Anything specified as specific to this system
|
||||
* should always be supported.
|
||||
*/
|
||||
ksft_test_result(!skip, "%s.%s.%d.%d.%d.%s.params\n",
|
||||
test_class_name, test_name,
|
||||
data->card, data->device, data->subdevice,
|
||||
snd_pcm_stream_name(data->stream));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
ksft_test_result(pass, "%s.%s.%d.%d.%d.%s%s%s\n",
|
||||
test_class_name, test_name,
|
||||
data->card, data->device, data->subdevice,
|
||||
snd_pcm_stream_name(data->stream),
|
||||
msg[0] ? " " : "", msg);
|
||||
if (!skip)
|
||||
ksft_test_result(pass, "%s.%s.%d.%d.%d.%s%s%s\n",
|
||||
test_class_name, test_name,
|
||||
data->card, data->device, data->subdevice,
|
||||
snd_pcm_stream_name(data->stream),
|
||||
msg[0] ? " " : "", msg);
|
||||
else
|
||||
ksft_test_result_skip("%s.%s.%d.%d.%d.%s%s%s\n",
|
||||
test_class_name, test_name,
|
||||
data->card, data->device, data->subdevice,
|
||||
snd_pcm_stream_name(data->stream),
|
||||
msg[0] ? " " : "", msg);
|
||||
free(samples);
|
||||
if (handle)
|
||||
snd_pcm_close(handle);
|
||||
@@ -495,7 +521,8 @@ int main(void)
|
||||
cfg = pcm->pcm_config;
|
||||
if (cfg == NULL)
|
||||
continue;
|
||||
num_tests = conf_get_count(cfg, "test", NULL);
|
||||
/* Setting params is reported as a separate test */
|
||||
num_tests = conf_get_count(cfg, "test", NULL) * 2;
|
||||
if (num_tests > 0)
|
||||
num_pcm_tests += num_tests;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user