kselftest/alsa: pcm-test: Report cards declared in config but missing
Subsystems (3)
PATCH 1/1 kselftest/alsa: pcm-test: Report cards declared in config but missing
When parsing the configs, keep track of card configurations that match the current system but haven't matched any card, and report those as test failures as they represent that a card which was expected to be present on the system is missing. This allows the configuration files to not only be used to detect missing PCM devices (which is currently possible) but also that the soundcard hasn't been registered at all.
---
tools/testing/selftests/alsa/alsa-local.h | 10 +++ tools/testing/selftests/alsa/conf.c | 100 ++++++++++++---------- tools/testing/selftests/alsa/pcm-test.c | 10 +++ 3 files changed, 73 insertions(+), 47 deletions(-)
tools/testing/selftests/alsa/alsa-local.h +10 -0
@@ -24,4 +24,14 @@ int conf_get_bool(snd_config_t *root, const char *key1, const char *key2, int devoid conf_get_string_array (snd_config_t *root,const char *key1,const char *key2,const char **array,int array_size,const char *def); +struct card_cfg_data { +int card; +snd_config_t *config; +const char *filename; +const char *config_id; +struct card_cfg_data *next; +}; + +extern struct card_cfg_data *conf_cards; +#endif /* __ALSA_LOCAL_H */
tools/testing/selftests/alsa/conf.c +53 -47
161 lines not on this page · raw message
tools/testing/selftests/alsa/pcm-test.c +10 -0
@@ -566,6 +566,7 @@ void *card_thread(void *data)int main (void ) {struct card_data *card; +struct card_cfg_data *conf;struct pcm_data *pcm;snd_config_t *global_config, *cfg;int num_pcm_tests =0 , num_tests, num_std_pcm_tests;
@@ -583,6 +584,10 @@ int main(void)find_pcms (); +for (conf = conf_cards; conf; conf = conf->next) +if (conf->card <0 ) + num_missing++; + num_std_pcm_tests =conf_get_count (default_pcm_config,"test" ,NULL );for (pcm = pcm_list; pcm !=NULL ; pcm = pcm->next) {
@@ -598,6 +603,11 @@ int main(void)ksft_set_plan (num_missing + num_pcm_tests); +for (conf = conf_cards; conf; conf = conf->next) +if (conf->card <0 ) +ksft_test_result_fail ("test.missing.%s.%s\n" , + conf->filename, conf->config_id); +for (pcm = pcm_missing; pcm !=NULL ; pcm = pcm->next) { ksft_test_result(false, "test.missing.%d.%d.%d.%s\n", pcm->card, pcm->device, pcm->subdevice,
Signature · 1 line
2.42.0
Quoted 8 lines · Nícolas F. R. A. Prado
When parsing the configs, keep track of card configurations that match the current system but haven't matched any card, and report those as test failures as they represent that a card which was expected to be present on the system is missing. This allows the configuration files to not only be used to detect missing PCM devices (which is currently possible) but also that the soundcard hasn't been registered at all.
Signed-off-by Nícolas F. R. A. Prado <[email protected]>
Thanks,
Signature · 2 lines
Jaroslav Kysela <[email protected]> Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
Quoted 6 lines · Nícolas F. R. A. Prado
When parsing the configs, keep track of card configurations that match the current system but haven't matched any card, and report those as test failures as they represent that a card which was expected to be present on the system is missing. This allows the configuration files to not only be used to detect missing PCM devices (which is currently possible) but also that the soundcard hasn't been registered at all.
Quoted 9 lines · Nícolas F. R. A. Prado
When parsing the configs, keep track of card configurations that match the current system but haven't matched any card, and report those as test failures as they represent that a card which was expected to be present on the system is missing. This allows the configuration files to not only be used to detect missing PCM devices (which is currently possible) but also that the soundcard hasn't been registered at all.
Signed-off-by Nícolas F. R. A. Prado <[email protected]>
Applied now. Thanks.
Takashi