kselftest/alsa: Log card and control information during startup
Subsystems (3)
Mark Brown
maintainercover kselftest/alsa: Log card and control information during startup
These patches help make the logs a bit more friendly to work with by adding human readable names for cards and controls alongside the numbers assigned to them even when things are working well.
---
Mark Brown (2):
kselftest/alsa - mixer: Always log control names kselftest/alsa: Log card names during startup
tools/testing/selftests/alsa/mixer-test.c | 13 +++++++++++++ tools/testing/selftests/alsa/pcm-test.c | 10 ++++++++++ 2 files changed, 23 insertions(+)
---
base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
change-id: 20230223-alsa-log-ctl-name-fb07f30d7217
Best regards,
Signature · 1 line
Mark Brown <[email protected]>
Mark Brown
maintainerPATCH 1/2 kselftest/alsa - mixer: Always log control names
Currently we only log the names of controls on error but it can be useful to know what control we're testing (for example, when looking at why the tests are taking a while to run). People looking at test logs may not have direct access to the target system. This will increase the amount we write to the console, hopefully that's buffered.
--- tools/testing/selftests/alsa/mixer-test.c | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/alsa/mixer-test.c +3 -0
@@ -422,6 +422,9 @@ static void test_ctl_name(struct ctl_data *ctl)bool name_ok = true;bool check; +ksft_print_msg ("%d.%d %s\n" , ctl->card->card, ctl->elem, + ctl->name); +/* Only boolean controls should end in Switch */ if (strend (ctl->name," Switch" )) {if (snd_ctl_elem_info_get_type (ctl->info) !=SND_CTL_ELEM_TYPE_BOOLEAN ) {
Signature · 1 line
2.30.2
Mark Brown
maintainerPATCH 2/2 kselftest/alsa: Log card names during startup
In reply to Mark BrownIt can be helpful to know which card numbers apply to which cards in a multi-card system so log the card names when we start the test programs. People looking at the logs may not have direct access to the systems being tested.
--- tools/testing/selftests/alsa/mixer-test.c | 10 ++++++++++ tools/testing/selftests/alsa/pcm-test.c | 10 ++++++++++ 2 files changed, 20 insertions(+)
tools/testing/selftests/alsa/mixer-test.c +10 -0
@@ -63,6 +63,7 @@ static void find_controls(void)struct card_data *card_data;struct ctl_data *ctl_data;snd_config_t *config; +char *card_name, *card_longname; card =-1 ;if (snd_card_next (&card) <0 || card <0 )
@@ -84,6 +85,15 @@ static void find_controls(void) goto next_card; } + err =snd_card_get_name (card, &card_name); +if (err !=0 ) + card_name ="Unknown" ; + err =snd_card_get_longname (card, &card_longname); +if (err !=0 ) + card_longname ="Unknown" ; +ksft_print_msg ("Card %d - %s (%s)\n" , card, + card_name, card_longname); +/* Count controls */ snd_ctl_elem_list_malloc (&card_data->ctls);snd_ctl_elem_list (card_data->handle, card_data->ctls);
tools/testing/selftests/alsa/pcm-test.c +10 -0
@@ -149,6 +149,7 @@ static void missing_devices(int card, snd_config_t *card_config)static void find_pcms (void ) {char name[32 ], key[64 ]; +char *card_name, *card_longname;int card, dev, subdev, count, direction, err;snd_pcm_stream_t stream;struct pcm_data *pcm_data;
@@ -175,6 +176,15 @@ static void find_pcms(void) goto next_card; } + err =snd_card_get_name (card, &card_name); +if (err !=0 ) + card_name ="Unknown" ; + err =snd_card_get_longname (card, &card_longname); +if (err !=0 ) + card_longname ="Unknown" ; +ksft_print_msg ("Card %d - %s (%s)\n" , card, + card_name, card_longname); + card_config =conf_by_card (card); card_data =calloc (1 ,sizeof (*card_data));
Signature · 1 line
2.30.2
Takashi Iwai
AppliedQuoted 10 lines · Mark Brown
These patches help make the logs a bit more friendly to work with by adding human readable names for cards and controls alongside the numbers assigned to them even when things are working well.
Signed-off-by Mark Brown <[email protected]>---
Mark Brown (2):
kselftest/alsa - mixer: Always log control names kselftest/alsa: Log card names during startup
Applied both to for-next branch now. Thanks.
Takashi