From patchwork Fri Dec 2 00:17:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 630666 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51FB2C4321E for ; Fri, 2 Dec 2022 00:22:40 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 3175617DE; Fri, 2 Dec 2022 01:21:48 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 3175617DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669940558; bh=JGit28yz6CC6oZb1du0CbibcaHGYu5uCjor59093aOM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gZ4NhaCjxjWscxW81UXBfJpMy7wENbLqpPR/vGefqY8Reugf+iS/sk4V5u55nOjE0 nyHJlY6moxDZf7h+UC7uxjmnOOlvwOqaJ4T9Y+4ZEf8QBDZa9yvxH39o9XB2FtAb+P 4wo0HdabsBfMC8ez9CQfD5MWnVdejZvK5x8RISWQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8ECDCF804ED; Fri, 2 Dec 2022 01:21:30 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 15BDBF80519; Fri, 2 Dec 2022 01:21:29 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2CA9EF80166 for ; Fri, 2 Dec 2022 01:21:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2CA9EF80166 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ARJDOOPE" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B3C08621D6; Fri, 2 Dec 2022 00:21:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34E36C43143; Fri, 2 Dec 2022 00:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669940482; bh=JGit28yz6CC6oZb1du0CbibcaHGYu5uCjor59093aOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ARJDOOPEPFht0dKd8mh4l9PABRNUfX2EGXtbgsGxDwBj/A0LHV/v3svHI5fX4IWoG fNM8B+0XgcH11n9i2VWJAzkdS/DosSU7FFiGte3XfpeMYkvn3N7TSkHB0wxzuOsATk F/v904NAXxfDXIlo+dd7j5egoFkD0ecpgCR4pzWK5ida6ZT06cnJlmBXAoEWkOp50F NPu8/T7VXZUZ80E/PCX8ZOtIo2XtTNbYLLckhTPzmQyspVf4bwPNxqHypnjkyi+997 3DIciRsGdDq1L1ci7aXZZciWCG5sz4Cq9q+bwFLtF62Mf+6mpePexh3/8BdGmjNtPm ciQpenVbnU2NA== From: Mark Brown To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Subject: [PATCH v3 1/7] kselftest/alsa: pcm - Drop recent coverage improvement changes Date: Fri, 2 Dec 2022 00:17:43 +0000 Message-Id: <20221202001749.3321187-2-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202001749.3321187-1-broonie@kernel.org> References: <20221202001749.3321187-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=9304; i=broonie@kernel.org; h=from:subject; bh=JGit28yz6CC6oZb1du0CbibcaHGYu5uCjor59093aOM=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjiUQmtf5o+v0gO1F4W2C/actNiHIawWOeVmexKRan MzRucvCJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY4lEJgAKCRAk1otyXVSH0OWwB/ 41p/7Ib6MxBnMl/4RbAfOZBfspMCfAFoHIO4PMrP2IjknBfwxAtkwzksNEiNix7bnsBEJi2zHjs3bI 0F0I90bSkHdcQYB7EiEJoQF7XxJAd+SvUP68wRx6wPs6YQsoRV13ThFyRasjEZiVirEZtD0HA9Q1pX rT8v3RZ+cxuwXOpLEANx3165DtLV5tpstIE9hcys1fwNp8Jfs2KMBbvmpBP77dolHvSShCDl3raZQQ ktPbwqJLRT93CmEbVz6slAKMTtIMtxev0RHR4c4jEQIslcJZOwUyUp8Lh8Mr1gUcbl0H/DKaJwqjsR INckvWHZfKuP+Eyxnb+5+2i3+X48JS X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" In preparation to adopting a better, more comprehensive approach to adding the coverage that was just added using some changes from Jaroslav which were sent at the same time the recently added improvements were being applied drop what was applied. This reverts: 7d721baea138 "kselftest/alsa: Add more coverage of sample rates and channel counts" ee12040dd53a "kselftest/alsa: Provide more meaningful names for tests" ae95efd9754c "kselftest/alsa: Don't any configuration in the sample config" 8370d9b00c92 Revert "kselftest/alsa: Report failures to set the requested channels as skips" f944f8b539ea "kselftest/alsa: Report failures to set the requested sample rate as skips" 22eeb8f531c1 "kselftest/alsa: Refactor pcm-test to list the tests to run in a struct" Signed-off-by: Mark Brown --- .../alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf | 35 ++++---- tools/testing/selftests/alsa/pcm-test.c | 88 ++++++------------- 2 files changed, 42 insertions(+), 81 deletions(-) diff --git a/tools/testing/selftests/alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf b/tools/testing/selftests/alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf index 9eca985e0c08..0a83f35d43eb 100644 --- a/tools/testing/selftests/alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf +++ b/tools/testing/selftests/alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf @@ -39,25 +39,22 @@ card.hda { # pcm.0.0 { PLAYBACK { - # - # Uncomment to override values for specific tests - # - #test_name1 { - # access RW_INTERLEAVED - # format S16_LE - # rate 48000 - # channels 2 - # period_size 512 - # buffer_size 4096 - #} - #test_name2 { - # access RW_INTERLEAVED - # format S16_LE - # rate 48000 - # channels 2 - # period_size 24000 - # buffer_size 192000 - #} + test.time1 { + access RW_INTERLEAVED # can be omitted - default + format S16_LE # can be omitted - default + rate 48000 # can be omitted - default + channels 2 # can be omitted - default + period_size 512 + buffer_size 4096 + } + test.time2 { + access RW_INTERLEAVED + format S16_LE + rate 48000 + channels 2 + period_size 24000 + buffer_size 192000 + } } CAPTURE { # use default tests, check for the presence diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c index f293c7d81009..6e7dfc395b98 100644 --- a/tools/testing/selftests/alsa/pcm-test.c +++ b/tools/testing/selftests/alsa/pcm-test.c @@ -37,15 +37,6 @@ struct pcm_data *pcm_list = NULL; int num_missing = 0; struct pcm_data *pcm_missing = NULL; -struct time_test_def { - const char *cfg_prefix; - const char *format; - long rate; - long channels; - long period_size; - long buffer_size; -}; - void timestamp_now(timestamp_t *tstamp) { if (clock_gettime(CLOCK_MONOTONIC_RAW, tstamp)) @@ -229,7 +220,9 @@ static void find_pcms(void) } static void test_pcm_time1(struct pcm_data *data, - const struct time_test_def *test) + const char *cfg_prefix, const char *sformat, + long srate, long schannels, + long speriod_size, long sbuffer_size) { char name[64], key[128], msg[256]; const char *cs; @@ -241,32 +234,30 @@ static void test_pcm_time1(struct pcm_data *data, snd_pcm_sframes_t frames; long long ms; long rate, channels, period_size, buffer_size; - unsigned int rchannels; unsigned int rrate; snd_pcm_uframes_t rperiod_size, rbuffer_size, start_threshold; timestamp_t tstamp; bool pass = false, automatic = true; snd_pcm_hw_params_t *hw_params; snd_pcm_sw_params_t *sw_params; - bool skip = false; snd_pcm_hw_params_alloca(&hw_params); snd_pcm_sw_params_alloca(&sw_params); - cs = conf_get_string(data->pcm_config, test->cfg_prefix, "format", test->format); + cs = conf_get_string(data->pcm_config, cfg_prefix, "format", sformat); format = snd_pcm_format_value(cs); if (format == SND_PCM_FORMAT_UNKNOWN) ksft_exit_fail_msg("Wrong format '%s'\n", cs); - rate = conf_get_long(data->pcm_config, test->cfg_prefix, "rate", test->rate); - channels = conf_get_long(data->pcm_config, test->cfg_prefix, "channels", test->channels); - period_size = conf_get_long(data->pcm_config, test->cfg_prefix, "period_size", test->period_size); - buffer_size = conf_get_long(data->pcm_config, test->cfg_prefix, "buffer_size", test->buffer_size); + rate = conf_get_long(data->pcm_config, cfg_prefix, "rate", srate); + channels = conf_get_long(data->pcm_config, cfg_prefix, "channels", schannels); + period_size = conf_get_long(data->pcm_config, cfg_prefix, "period_size", speriod_size); + buffer_size = conf_get_long(data->pcm_config, cfg_prefix, "buffer_size", sbuffer_size); - automatic = strcmp(test->format, snd_pcm_format_name(format)) == 0 && - test->rate == rate && - test->channels == channels && - test->period_size == period_size && - test->buffer_size == buffer_size; + automatic = strcmp(sformat, snd_pcm_format_name(format)) == 0 && + srate == rate && + schannels == channels && + speriod_size == period_size && + sbuffer_size == buffer_size; samples = malloc((rate * channels * snd_pcm_format_physical_width(format)) / 8); if (!samples) @@ -302,7 +293,7 @@ static void test_pcm_time1(struct pcm_data *data, if (automatic && format == SND_PCM_FORMAT_S16_LE) { format = SND_PCM_FORMAT_S32_LE; ksft_print_msg("%s.%d.%d.%d.%s.%s format S16_LE -> S32_LE\n", - test->cfg_prefix, + cfg_prefix, data->card, data->device, data->subdevice, snd_pcm_stream_name(data->stream), snd_pcm_access_name(access)); @@ -311,17 +302,11 @@ static void test_pcm_time1(struct pcm_data *data, snd_pcm_format_name(format), snd_strerror(err)); goto __close; } - rchannels = channels; - err = snd_pcm_hw_params_set_channels_near(handle, hw_params, &rchannels); + err = snd_pcm_hw_params_set_channels(handle, hw_params, channels); if (err < 0) { snprintf(msg, sizeof(msg), "snd_pcm_hw_params_set_channels %ld: %s", channels, snd_strerror(err)); goto __close; } - if (rchannels != channels) { - snprintf(msg, sizeof(msg), "channels unsupported %ld != %ld", channels, rchannels); - skip = true; - goto __close; - } rrate = rate; err = snd_pcm_hw_params_set_rate_near(handle, hw_params, &rrate, 0); if (err < 0) { @@ -329,8 +314,7 @@ static void test_pcm_time1(struct pcm_data *data, goto __close; } if (rrate != rate) { - snprintf(msg, sizeof(msg), "rate unsupported %ld != %ld", rate, rrate); - skip = true; + snprintf(msg, sizeof(msg), "rate mismatch %ld != %ld", rate, rrate); goto __close; } rperiod_size = period_size; @@ -378,7 +362,7 @@ static void test_pcm_time1(struct pcm_data *data, } ksft_print_msg("%s.%d.%d.%d.%s hw_params.%s.%s.%ld.%ld.%ld.%ld sw_params.%ld\n", - test->cfg_prefix, + cfg_prefix, data->card, data->device, data->subdevice, snd_pcm_stream_name(data->stream), snd_pcm_access_name(access), @@ -426,40 +410,21 @@ static void test_pcm_time1(struct pcm_data *data, msg[0] = '\0'; pass = true; __close: - if (!skip) { - ksft_test_result(pass, "%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); - } 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); - } + ksft_test_result(pass, "%s.%d.%d.%d.%s%s%s\n", + cfg_prefix, + data->card, data->device, data->subdevice, + snd_pcm_stream_name(data->stream), + msg[0] ? " " : "", msg); free(samples); if (handle) snd_pcm_close(handle); } -static const struct time_test_def time_tests[] = { - /* name format rate chan period buffer */ - { "8k.1.big", "S16_LE", 8000, 2, 8000, 32000 }, - { "8k.2.big", "S16_LE", 8000, 2, 8000, 32000 }, - { "44k1.2.big", "S16_LE", 44100, 2, 22050, 192000 }, - { "48k.2.small", "S16_LE", 48000, 2, 512, 4096 }, - { "48k.2.big", "S16_LE", 48000, 2, 24000, 192000 }, - { "48k.6.big", "S16_LE", 48000, 6, 48000, 576000 }, - { "96k.2.big", "S16_LE", 96000, 2, 48000, 192000 }, -}; +#define TESTS_PER_PCM 2 int main(void) { struct pcm_data *pcm; - int i; ksft_print_header(); @@ -467,7 +432,7 @@ int main(void) find_pcms(); - ksft_set_plan(num_missing + num_pcms * ARRAY_SIZE(time_tests)); + ksft_set_plan(num_missing + num_pcms * TESTS_PER_PCM); for (pcm = pcm_missing; pcm != NULL; pcm = pcm->next) { ksft_test_result(false, "test.missing.%d.%d.%d.%s\n", @@ -476,9 +441,8 @@ int main(void) } for (pcm = pcm_list; pcm != NULL; pcm = pcm->next) { - for (i = 0; i < ARRAY_SIZE(time_tests); i++) { - test_pcm_time1(pcm, &time_tests[i]); - } + test_pcm_time1(pcm, "test.time1", "S16_LE", 48000, 2, 512, 4096); + test_pcm_time1(pcm, "test.time2", "S16_LE", 48000, 2, 24000, 192000); } conf_free(); From patchwork Fri Dec 2 00:17:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 630665 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 215D1C4332F for ; Fri, 2 Dec 2022 00:23:14 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 36BF117F0; Fri, 2 Dec 2022 01:22:22 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 36BF117F0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669940592; bh=g2bkD9YybNj5zNsXnfABUyKEqPyOz8E9uybTHnDResM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OwJQmamIoL3hzUj/ilVy/d8mmGlSzq44mwHalAbNA/Xrw8xUhNUFti9PlDtj1TxFv KfnZLgEnRd4Qell+6tcVtCed7HUOWXFhVAB6fFwEm0Ct6DXXKZrXKeIEwMdC3aclCc cF8NsZ1geJ7wNFrdVveulkrqqysNE7+8Zfj0bfI8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E2EA6F80568; Fri, 2 Dec 2022 01:21:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4079F80567; Fri, 2 Dec 2022 01:21:32 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8134BF80118 for ; Fri, 2 Dec 2022 01:21:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8134BF80118 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Nn0xo/iC" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC494621BD; Fri, 2 Dec 2022 00:21:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 081CDC433D7; Fri, 2 Dec 2022 00:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669940484; bh=g2bkD9YybNj5zNsXnfABUyKEqPyOz8E9uybTHnDResM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nn0xo/iCrSQXbI9gJ0J6WGIDAMqohoCsx4hgE18vXLIOt33BhWBkmOjQNruFguL8M GI8VYj6opQ7VqYa5jN1zbsuFl6qQBb+5lyNwJ62ir4gmTSjwkQc3Zqxne2F6KlINFJ DgR7VojWg6ncfEO9tn//UaGd6Hp2Y7dLo7J1HxlECMvm6cdiq16OoJN9UncukoV/Ud B9aFM2BDyBj7x0SKV9tZALPgGpld29DNnkwHA0sePzUKKQU89Uhw6zSC8S8HPKmJMt WD9eDYTzotQrb+8htH9Fus1jshb1nb1GZFeorHb9PHooL9cF2SYS09FNKccPO/xPyT 9DSRR3UjvHRXQ== From: Mark Brown To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Subject: [PATCH v3 2/7] kselftest/alsa: pcm - move more configuration to configuration files Date: Fri, 2 Dec 2022 00:17:44 +0000 Message-Id: <20221202001749.3321187-3-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202001749.3321187-1-broonie@kernel.org> References: <20221202001749.3321187-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=12611; i=broonie@kernel.org; h=from:subject; bh=TXdjz7Mb1AMDWf05+sWmuwu8cnSWjWNo88B5FHMTbBQ=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjiUQncnT/M7zVyPxmfpw0/Xj7dIvi0xuPJOFFtiQZ ok0V13GJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY4lEJwAKCRAk1otyXVSH0H/tB/ 4l2HIJbF21P1YZydKB3oBWjks+R7uTxZ5AKebmuMvkw5zxQHqIptzaWnxV+coCFa1sUonp91AZCOLL vlkl/z+P75PdzKWY5fpsrbZfO4f1oCZHcLRWeP+Fw5ker3vvRgJpK0CdbTHGYOqlUugTEVhC8hgGJU KJEBYXtBsiVtIpnHbYuqqBQ5KMc/In2QnBwo9rWetmkJ0sq+ghMr1+8myUzw3mtedgPdFrt5/LvAbs vy59SEv3tr5WtQSH89rSuEmQYdMoskZhYh5Q3ZesTz9eSmDWNV1mfwuLHSaGyxOoAod4pSzTVqrhG0 gUPI+9DiT88P2hvtIWGqLtY8+y6ZfX X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Jaroslav Kysela Obtain all test parameters from the configuration files. The defaults are defined in the pcm-test.conf file. The test count and parameters may be variable per specific hardware. Also, handle alt_formats field now (with the fixes in the format loop). It replaces the original "automatic" logic which is not so universal. The code may be further extended to skip various tests based on the configuration hints, if the exact PCM hardware parameters are not available for the given hardware. Signed-off-by: Jaroslav Kysela Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/Makefile | 2 +- tools/testing/selftests/alsa/alsa-local.h | 3 + tools/testing/selftests/alsa/conf.c | 26 ++++- .../alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf | 8 ++ tools/testing/selftests/alsa/pcm-test.c | 102 ++++++++++++------ tools/testing/selftests/alsa/pcm-test.conf | 16 +++ 6 files changed, 121 insertions(+), 36 deletions(-) create mode 100644 tools/testing/selftests/alsa/pcm-test.conf diff --git a/tools/testing/selftests/alsa/Makefile b/tools/testing/selftests/alsa/Makefile index a8c0383878d3..77fba3e498cc 100644 --- a/tools/testing/selftests/alsa/Makefile +++ b/tools/testing/selftests/alsa/Makefile @@ -14,7 +14,7 @@ TEST_GEN_PROGS := mixer-test pcm-test TEST_GEN_PROGS_EXTENDED := libatest.so -TEST_FILES := conf.d +TEST_FILES := conf.d pcm-test.conf include ../lib.mk diff --git a/tools/testing/selftests/alsa/alsa-local.h b/tools/testing/selftests/alsa/alsa-local.h index 65f197ea9773..de030dc23bd1 100644 --- a/tools/testing/selftests/alsa/alsa-local.h +++ b/tools/testing/selftests/alsa/alsa-local.h @@ -12,6 +12,7 @@ snd_config_t *get_alsalib_config(void); +snd_config_t *conf_load_from_file(const char *filename); void conf_load(void); void conf_free(void); snd_config_t *conf_by_card(int card); @@ -20,5 +21,7 @@ int conf_get_count(snd_config_t *root, const char *key1, const char *key2); const char *conf_get_string(snd_config_t *root, const char *key1, const char *key2, const char *def); long conf_get_long(snd_config_t *root, const char *key1, const char *key2, long def); int conf_get_bool(snd_config_t *root, const char *key1, const char *key2, int def); +void conf_get_string_array(snd_config_t *root, const char *key1, const char *key2, + const char **array, int array_size, const char *def); #endif /* __ALSA_LOCAL_H */ diff --git a/tools/testing/selftests/alsa/conf.c b/tools/testing/selftests/alsa/conf.c index c7ffc8f04195..d7aafe5a1993 100644 --- a/tools/testing/selftests/alsa/conf.c +++ b/tools/testing/selftests/alsa/conf.c @@ -125,7 +125,7 @@ static int dump_config_tree(snd_config_t *top) snd_output_close(out); } -static snd_config_t *load(const char *filename) +snd_config_t *conf_load_from_file(const char *filename) { snd_config_t *dst; snd_input_t *input; @@ -235,7 +235,7 @@ static bool test_filename1(int card, const char *filename, const char *sysfs_car snd_config_t *config, *sysfs_config, *card_config, *sysfs_card_config, *node; snd_config_iterator_t i, next; - config = load(filename); + config = conf_load_from_file(filename); if (snd_config_search(config, "sysfs", &sysfs_config) || snd_config_get_type(sysfs_config) != SND_CONFIG_TYPE_COMPOUND) ksft_exit_fail_msg("Missing global sysfs block in filename %s\n", filename); @@ -446,3 +446,25 @@ int conf_get_bool(snd_config_t *root, const char *key1, const char *key2, int de ksft_exit_fail_msg("key '%s'.'%s' is not an bool\n", key1, key2); return !!ret; } + +void conf_get_string_array(snd_config_t *root, const char *key1, const char *key2, + const char **array, int array_size, const char *def) +{ + snd_config_t *cfg; + char buf[16]; + int ret, index; + + ret = conf_get_by_keys(root, key1, key2, &cfg); + if (ret == -ENOENT) + cfg = NULL; + else if (ret < 0) + ksft_exit_fail_msg("key '%s'.'%s' search error: %s\n", key1, key2, snd_strerror(ret)); + for (index = 0; index < array_size; index++) { + if (cfg == NULL) { + array[index] = def; + } else { + sprintf(buf, "%i", index); + array[index] = conf_get_string(cfg, buf, NULL, def); + } + } +} diff --git a/tools/testing/selftests/alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf b/tools/testing/selftests/alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf index 0a83f35d43eb..5b40a916295d 100644 --- a/tools/testing/selftests/alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf +++ b/tools/testing/selftests/alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf @@ -55,6 +55,14 @@ card.hda { period_size 24000 buffer_size 192000 } + test.time3 { + access RW_INTERLEAVED + format S16_LE + rate 44100 + channels 2 + period_size 24000 + buffer_size 192000 + } } CAPTURE { # use default tests, check for the presence diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c index 6e7dfc395b98..e973b03ae1fd 100644 --- a/tools/testing/selftests/alsa/pcm-test.c +++ b/tools/testing/selftests/alsa/pcm-test.c @@ -31,7 +31,6 @@ struct pcm_data { struct pcm_data *next; }; -int num_pcms = 0; struct pcm_data *pcm_list = NULL; int num_missing = 0; @@ -200,7 +199,6 @@ static void find_pcms(void) pcm_data->pcm_config = conf_get_subtree(card_config, key, NULL); pcm_data->next = pcm_list; pcm_list = pcm_data; - num_pcms++; } } } @@ -219,17 +217,15 @@ static void find_pcms(void) snd_config_delete(config); } -static void test_pcm_time1(struct pcm_data *data, - const char *cfg_prefix, const char *sformat, - long srate, long schannels, - long speriod_size, long sbuffer_size) +static void test_pcm_time(struct pcm_data *data, const char *test_name, snd_config_t *pcm_cfg) { char name[64], key[128], msg[256]; const char *cs; int i, err; snd_pcm_t *handle = NULL; snd_pcm_access_t access = SND_PCM_ACCESS_RW_INTERLEAVED; - snd_pcm_format_t format; + snd_pcm_format_t format, old_format; + const char *alt_formats[8]; unsigned char *samples = NULL; snd_pcm_sframes_t frames; long long ms; @@ -237,27 +233,23 @@ static void test_pcm_time1(struct pcm_data *data, unsigned int rrate; snd_pcm_uframes_t rperiod_size, rbuffer_size, start_threshold; timestamp_t tstamp; - bool pass = false, automatic = true; + bool pass = false; snd_pcm_hw_params_t *hw_params; snd_pcm_sw_params_t *sw_params; snd_pcm_hw_params_alloca(&hw_params); snd_pcm_sw_params_alloca(&sw_params); - cs = conf_get_string(data->pcm_config, cfg_prefix, "format", sformat); + cs = conf_get_string(pcm_cfg, "format", NULL, "S16_LE"); format = snd_pcm_format_value(cs); if (format == SND_PCM_FORMAT_UNKNOWN) ksft_exit_fail_msg("Wrong format '%s'\n", cs); - rate = conf_get_long(data->pcm_config, cfg_prefix, "rate", srate); - channels = conf_get_long(data->pcm_config, cfg_prefix, "channels", schannels); - period_size = conf_get_long(data->pcm_config, cfg_prefix, "period_size", speriod_size); - buffer_size = conf_get_long(data->pcm_config, cfg_prefix, "buffer_size", sbuffer_size); - - automatic = strcmp(sformat, snd_pcm_format_name(format)) == 0 && - srate == rate && - schannels == channels && - speriod_size == period_size && - sbuffer_size == buffer_size; + conf_get_string_array(pcm_cfg, "alt_formats", NULL, + alt_formats, ARRAY_SIZE(alt_formats), NULL); + rate = conf_get_long(pcm_cfg, "rate", NULL, 48000); + channels = conf_get_long(pcm_cfg, "channels", NULL, 2); + period_size = conf_get_long(pcm_cfg, "period_size", NULL, 4096); + buffer_size = conf_get_long(pcm_cfg, "buffer_size", NULL, 16384); samples = malloc((rate * channels * snd_pcm_format_physical_width(format)) / 8); if (!samples) @@ -287,16 +279,29 @@ static void test_pcm_time1(struct pcm_data *data, snd_pcm_access_name(access), snd_strerror(err)); goto __close; } + i = -1; __format: err = snd_pcm_hw_params_set_format(handle, hw_params, format); if (err < 0) { - if (automatic && format == SND_PCM_FORMAT_S16_LE) { - format = SND_PCM_FORMAT_S32_LE; - ksft_print_msg("%s.%d.%d.%d.%s.%s format S16_LE -> S32_LE\n", - cfg_prefix, - data->card, data->device, data->subdevice, - snd_pcm_stream_name(data->stream), - snd_pcm_access_name(access)); + i++; + if (i < ARRAY_SIZE(alt_formats) && alt_formats[i]) { + old_format = format; + format = snd_pcm_format_value(alt_formats[i]); + if (format != SND_PCM_FORMAT_UNKNOWN) { + ksft_print_msg("%s.%d.%d.%d.%s.%s format %s -> %s\n", + test_name, + data->card, data->device, data->subdevice, + snd_pcm_stream_name(data->stream), + snd_pcm_access_name(access), + snd_pcm_format_name(old_format), + snd_pcm_format_name(format)); + samples = realloc(samples, (rate * channels * + snd_pcm_format_physical_width(format)) / 8); + if (!samples) + ksft_exit_fail_msg("Out of memory\n"); + snd_pcm_format_set_silence(format, samples, rate * channels); + goto __format; + } } snprintf(msg, sizeof(msg), "snd_pcm_hw_params_set_format %s: %s", snd_pcm_format_name(format), snd_strerror(err)); @@ -362,7 +367,7 @@ static void test_pcm_time1(struct pcm_data *data, } ksft_print_msg("%s.%d.%d.%d.%s hw_params.%s.%s.%ld.%ld.%ld.%ld sw_params.%ld\n", - cfg_prefix, + test_name, data->card, data->device, data->subdevice, snd_pcm_stream_name(data->stream), snd_pcm_access_name(access), @@ -411,7 +416,7 @@ static void test_pcm_time1(struct pcm_data *data, pass = true; __close: ksft_test_result(pass, "%s.%d.%d.%d.%s%s%s\n", - cfg_prefix, + test_name, data->card, data->device, data->subdevice, snd_pcm_stream_name(data->stream), msg[0] ? " " : "", msg); @@ -420,19 +425,35 @@ static void test_pcm_time1(struct pcm_data *data, snd_pcm_close(handle); } -#define TESTS_PER_PCM 2 - int main(void) { struct pcm_data *pcm; + snd_config_t *global_config, *default_pcm_config, *cfg, *pcm_cfg; + snd_config_iterator_t i, next; + int num_pcm_tests = 0, num_tests; + const char *test_name, *test_type; ksft_print_header(); + global_config = conf_load_from_file("pcm-test.conf"); + default_pcm_config = conf_get_subtree(global_config, "pcm", NULL); + if (default_pcm_config == NULL) + ksft_exit_fail_msg("default pcm test configuration (pcm compound) is missing\n"); + conf_load(); find_pcms(); - ksft_set_plan(num_missing + num_pcms * TESTS_PER_PCM); + for (pcm = pcm_list; pcm != NULL; pcm = pcm->next) { + cfg = pcm->pcm_config; + if (cfg == NULL) + cfg = default_pcm_config; + num_tests = conf_get_count(cfg, "test", NULL); + if (num_tests > 0) + num_pcm_tests += num_tests; + } + + ksft_set_plan(num_missing + num_pcm_tests); for (pcm = pcm_missing; pcm != NULL; pcm = pcm->next) { ksft_test_result(false, "test.missing.%d.%d.%d.%s\n", @@ -441,10 +462,25 @@ int main(void) } for (pcm = pcm_list; pcm != NULL; pcm = pcm->next) { - test_pcm_time1(pcm, "test.time1", "S16_LE", 48000, 2, 512, 4096); - test_pcm_time1(pcm, "test.time2", "S16_LE", 48000, 2, 24000, 192000); + cfg = pcm->pcm_config; + if (cfg == NULL) + cfg = default_pcm_config; + cfg = conf_get_subtree(cfg, "test", NULL); + if (cfg == NULL) + continue; + snd_config_for_each(i, next, cfg) { + pcm_cfg = snd_config_iterator_entry(i); + if (snd_config_get_id(pcm_cfg, &test_name) < 0) + ksft_exit_fail_msg("snd_config_get_id\n"); + test_type = conf_get_string(pcm_cfg, "type", NULL, "time"); + if (strcmp(test_type, "time") == 0) + test_pcm_time(pcm, test_name, pcm_cfg); + else + ksft_exit_fail_msg("unknown test type '%s'\n", test_type); + } } + snd_config_delete(global_config); conf_free(); ksft_exit_pass(); diff --git a/tools/testing/selftests/alsa/pcm-test.conf b/tools/testing/selftests/alsa/pcm-test.conf new file mode 100644 index 000000000000..473a19251b49 --- /dev/null +++ b/tools/testing/selftests/alsa/pcm-test.conf @@ -0,0 +1,16 @@ +pcm.test.time1 { + format S16_LE + alt_formats [ S32_LE ] + rate 48000 + channels 2 + period_size 512 + buffer_size 4096 +} +pcm.test.time2 { + format S16_LE + alt_formats [ S32_LE ] + rate 48000 + channels 2 + period_size 24000 + buffer_size 192000 +} From patchwork Fri Dec 2 00:17:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 630267 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 18450C3A5A7 for ; Fri, 2 Dec 2022 00:23:10 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 39A9017EE; Fri, 2 Dec 2022 01:22:18 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 39A9017EE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669940588; bh=VjJcFh/HJTKeoERtrWYk8wR4SBvW6e/w/fSZ2fzzO9g=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=I+rFexzUCpU65TmpAya0txEeuqb9S8/xkiiRP2H6NP/P1R4J/XsPzZlyLtOHwB2QN 4Dj8jgIUPbLjyzNCj+VOMzGgC2XlEweykKtmHwfXIuAPm9pGzWfPB0ZZFxgDmhRYYx Cyb9iDGqrNbZBWSXh1Um4XvAQSB6Db7BM6D/Jwb4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9724BF8055C; Fri, 2 Dec 2022 01:21:32 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 34D22F8055B; Fri, 2 Dec 2022 01:21:31 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8920AF804D0 for ; Fri, 2 Dec 2022 01:21:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8920AF804D0 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="nFDtMqMF" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EF5C9621D5; Fri, 2 Dec 2022 00:21:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0804BC433B5; Fri, 2 Dec 2022 00:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669940486; bh=VjJcFh/HJTKeoERtrWYk8wR4SBvW6e/w/fSZ2fzzO9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFDtMqMFuOT3pNWTE4JvGeBVXVKn48m4FOrEzhsuZa8Kim1ENlVn0QsKGgRCGyMKr mVZxffkt6nEBZifglTyMoOcWpx86xLCyWCx+0oMptvAGuO0aZnoXHiiopEL2HRZfW2 eNsKvffHLD7pTZZaw7z28EkoFa8DzpwX3TsF5ONi/i6j5mAwxsTgn0K92wMSN8wMMA An+mVsA+xgegCLPUPStnUrg87tpXGV7En05yWmPcAl/FJH6n+NEZmJ0Om8VX0yh4nj FNHN82dvH/vag6nt681oNP/vqx5miT/KokFEcaOmQEVXDuYezs9x3hupyteiBlj7II 9qCSjYxbm/1ww== From: Mark Brown To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Subject: [PATCH v3 3/7] kselftest/alsa: pcm - Always run the default set of tests Date: Fri, 2 Dec 2022 00:17:45 +0000 Message-Id: <20221202001749.3321187-4-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202001749.3321187-1-broonie@kernel.org> References: <20221202001749.3321187-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5457; i=broonie@kernel.org; h=from:subject; bh=VjJcFh/HJTKeoERtrWYk8wR4SBvW6e/w/fSZ2fzzO9g=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjiUQomFHuneC4OAE/C8y+DXPHDcAVGpoOXSRz4+hL Omb4IEmJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY4lEKAAKCRAk1otyXVSH0OQgB/ wPNvQK8q2z/XmM++1/kWVLS5UiodZim0MuxTbIBQJfrBPPTXi9X6MGkx22FJ70yPUFln8D3zS1JR0Y H2AgBhzzOHQfXAQ4yPZXf3LqYztBVVkOgjkgQnSkbBsD2LH+61F3GqzSreYFnh3Jrj2f+NT7q4jtmK sUGa0Jj3mWJoDZdM9nLmmFM5UxULx/Ud2P9TjQr/R2QFawu69QXZtZTSQhyqCyanh81BJiu3e6FqFB XpxWmOIUw56tUwo0dXmpsqHojMcWMbMG56aDmA7/pJTb5I3HQaccfxcgW5YzvjBqp/ttBbZqTIJNAQ o0dZdttXK9Psd3LSmPq47BSXS1WiRA X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Rather than allowing the system specific tests to replace the default set of tests instead run them in addition to the standard set of tests. In order to avoid name collisions in the reported tests we add an additional test class element to the reported tests. Doing this means we always get a consistent baseline of coverage no matter what card we run on but retain the ability to specify specific coverage for a given system. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/pcm-test.c | 83 +++++++++++++++++-------- 1 file changed, 58 insertions(+), 25 deletions(-) diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c index e973b03ae1fd..afc616ddc820 100644 --- a/tools/testing/selftests/alsa/pcm-test.c +++ b/tools/testing/selftests/alsa/pcm-test.c @@ -36,6 +36,11 @@ struct pcm_data *pcm_list = NULL; int num_missing = 0; struct pcm_data *pcm_missing = NULL; +enum test_class { + TEST_CLASS_DEFAULT, + TEST_CLASS_SYSTEM, +}; + void timestamp_now(timestamp_t *tstamp) { if (clock_gettime(CLOCK_MONOTONIC_RAW, tstamp)) @@ -217,7 +222,8 @@ static void find_pcms(void) snd_config_delete(config); } -static void test_pcm_time(struct pcm_data *data, const char *test_name, snd_config_t *pcm_cfg) +static void test_pcm_time(struct pcm_data *data, enum test_class class, + const char *test_name, snd_config_t *pcm_cfg) { char name[64], key[128], msg[256]; const char *cs; @@ -236,6 +242,19 @@ static void test_pcm_time(struct pcm_data *data, const char *test_name, snd_conf bool pass = false; snd_pcm_hw_params_t *hw_params; snd_pcm_sw_params_t *sw_params; + const char *test_class_name; + + switch (class) { + case TEST_CLASS_DEFAULT: + test_class_name = "default"; + break; + case TEST_CLASS_SYSTEM: + test_class_name = "system"; + break; + default: + ksft_exit_fail_msg("Unknown test class %d\n", class); + break; + } snd_pcm_hw_params_alloca(&hw_params); snd_pcm_sw_params_alloca(&sw_params); @@ -366,8 +385,8 @@ static void test_pcm_time(struct pcm_data *data, const char *test_name, snd_conf goto __close; } - ksft_print_msg("%s.%d.%d.%d.%s hw_params.%s.%s.%ld.%ld.%ld.%ld sw_params.%ld\n", - test_name, + ksft_print_msg("%s.%s.%d.%d.%d.%s hw_params.%s.%s.%ld.%ld.%ld.%ld sw_params.%ld\n", + test_class_name, test_name, data->card, data->device, data->subdevice, snd_pcm_stream_name(data->stream), snd_pcm_access_name(access), @@ -415,8 +434,9 @@ static void test_pcm_time(struct pcm_data *data, const char *test_name, snd_conf msg[0] = '\0'; pass = true; __close: - ksft_test_result(pass, "%s.%d.%d.%d.%s%s%s\n", - test_name, + + 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); @@ -425,13 +445,37 @@ static void test_pcm_time(struct pcm_data *data, const char *test_name, snd_conf snd_pcm_close(handle); } +void run_time_tests(struct pcm_data *pcm, enum test_class class, + snd_config_t *cfg) +{ + const char *test_name, *test_type; + snd_config_t *pcm_cfg; + snd_config_iterator_t i, next; + + if (!cfg) + return; + + cfg = conf_get_subtree(cfg, "test", NULL); + if (cfg == NULL) + return; + + snd_config_for_each(i, next, cfg) { + pcm_cfg = snd_config_iterator_entry(i); + if (snd_config_get_id(pcm_cfg, &test_name) < 0) + ksft_exit_fail_msg("snd_config_get_id\n"); + test_type = conf_get_string(pcm_cfg, "type", NULL, "time"); + if (strcmp(test_type, "time") == 0) + test_pcm_time(pcm, class, test_name, pcm_cfg); + else + ksft_exit_fail_msg("unknown test type '%s'\n", test_type); + } +} + int main(void) { struct pcm_data *pcm; snd_config_t *global_config, *default_pcm_config, *cfg, *pcm_cfg; - snd_config_iterator_t i, next; - int num_pcm_tests = 0, num_tests; - const char *test_name, *test_type; + int num_pcm_tests = 0, num_tests, num_std_pcm_tests; ksft_print_header(); @@ -444,10 +488,13 @@ int main(void) find_pcms(); + num_std_pcm_tests = conf_get_count(default_pcm_config, "test", NULL); + for (pcm = pcm_list; pcm != NULL; pcm = pcm->next) { + num_pcm_tests += num_std_pcm_tests; cfg = pcm->pcm_config; if (cfg == NULL) - cfg = default_pcm_config; + continue; num_tests = conf_get_count(cfg, "test", NULL); if (num_tests > 0) num_pcm_tests += num_tests; @@ -462,22 +509,8 @@ int main(void) } for (pcm = pcm_list; pcm != NULL; pcm = pcm->next) { - cfg = pcm->pcm_config; - if (cfg == NULL) - cfg = default_pcm_config; - cfg = conf_get_subtree(cfg, "test", NULL); - if (cfg == NULL) - continue; - snd_config_for_each(i, next, cfg) { - pcm_cfg = snd_config_iterator_entry(i); - if (snd_config_get_id(pcm_cfg, &test_name) < 0) - ksft_exit_fail_msg("snd_config_get_id\n"); - test_type = conf_get_string(pcm_cfg, "type", NULL, "time"); - if (strcmp(test_type, "time") == 0) - test_pcm_time(pcm, test_name, pcm_cfg); - else - ksft_exit_fail_msg("unknown test type '%s'\n", test_type); - } + run_time_tests(pcm, TEST_CLASS_DEFAULT, default_pcm_config); + run_time_tests(pcm, TEST_CLASS_SYSTEM, pcm->pcm_config); } snd_config_delete(global_config); From patchwork Fri Dec 2 00:17:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 630266 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 037BFC4332F for ; Fri, 2 Dec 2022 00:23:29 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0907617D1; Fri, 2 Dec 2022 01:22:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0907617D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669940608; bh=xM72S9RCtumzTMDAzQRoqiJbjv0iOLzdTFKbCIv6+tk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=moPHsHU1eVYn2WHBn/llQeyAKGqpepjEeqDOZJhwG3qDzC4EytreuOQ/NmDaw75+G 4JkgZNi2S5AEJJfycBZiWz9f/d3fxNTiLO89YnfJNVdGp3ty5RrFvCkYA+ONgj02Wt Sb8D8CFHZEEbGT+6HtUvu0FZf5M0MSS6PnFMcUAA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8EE7EF80578; Fri, 2 Dec 2022 01:21:37 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 76CD9F80570; Fri, 2 Dec 2022 01:21:34 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D58C9F8055B for ; Fri, 2 Dec 2022 01:21:30 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D58C9F8055B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eRTMZNsl" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D8E60621BD; Fri, 2 Dec 2022 00:21:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE6FEC433D7; Fri, 2 Dec 2022 00:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669940488; bh=xM72S9RCtumzTMDAzQRoqiJbjv0iOLzdTFKbCIv6+tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eRTMZNslFYjgxOiyn43bu9kUJhAoELNHqlW/5G5t9mZZj+Oe209QnvG9nSG4jkpE2 A/41Y8aSlLichCadxL5MkGcnOHXAJ8hpG6QHK4pBnKNJJn4uXU3Nqp7ErBsIcmFF2a SHN0E7PlLuCLVRGg+kBH5b63rvFABYdjz17/24V+qkP+XZDa4YlVia03rN3B1H/khQ fQvMvc9APNBvSL8FoYoXWSkuGhpoJ8V5+68u9JxGONCqMZLRKpnR8W8Sa1sHQzeHDF Qhk6rr3g4Jhe9HLdxm1kzeEP0dAAcc2UtMgi4xOgTmabNftX4lQ0HH490b7xQRzpaZ HFWrOYylzOgbQ== From: Mark Brown To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Subject: [PATCH v3 4/7] kselftest/alsa: pcm - skip tests when we fail to set params Date: Fri, 2 Dec 2022 00:17:46 +0000 Message-Id: <20221202001749.3321187-5-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202001749.3321187-1-broonie@kernel.org> References: <20221202001749.3321187-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3156; i=broonie@kernel.org; h=from:subject; bh=xM72S9RCtumzTMDAzQRoqiJbjv0iOLzdTFKbCIv6+tk=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjiUQpMTnE2tYxkvT9IJiGFReql/viP2++U9qyvEl4 jkU4p+6JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY4lEKQAKCRAk1otyXVSH0BhmB/ 9p4SNkOb8QReTY9iSBl6XFTYCXxvoEK+g7u/IA7Xz2BpG77L9CEKb3rVjvUOksXFDn1okj83bEq3bD KjN3/HkV2hnvysUdPhrp8DWsaTzA+zcQ50iwNCafJQcCENBe5qIVG0Cq5AJE0Rg+FFq+P3oFsZGLkA ZkS8XkSipyq6VwU6hxEPy+KhfeudZMde+yAaNfJWUoEeDvRAWLXONyaRKyrN03wyDcUJZxrFtz+MDt zSqT8A3PkUchBtMkXPr89gjxan3FFn8Dm8gqwg5b/SrkOlNi+uWx8WdleE0YoWWttwX7N3tueoWwxw xM2wGjJZ0ae03mSLVZbZOce8WY9B1x X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/pcm-test.c | 39 +++++++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c index afc616ddc820..5fbb3ff517aa 100644 --- a/tools/testing/selftests/alsa/pcm-test.c +++ b/tools/testing/selftests/alsa/pcm-test.c @@ -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 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class, (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 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class, 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; } From patchwork Fri Dec 2 00:17:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 630664 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D808DC4332F for ; Fri, 2 Dec 2022 00:23:42 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EC4531820; Fri, 2 Dec 2022 01:22:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EC4531820 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669940621; bh=2TvBpW+4mBe//AkYGD/5GQvrFqDxmtFqkYgIiMm0bgA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SBFhV2AIbh8efA6wTLEZP2/but+KEzGMcm445BkGVhDC3GhMpPbT28nSzCvjrJ8QP +k2BOJ576UYz1Dr2Zs2ER1XzI9OVZZ4mF1mqvkdiF2iQi/SFK6AYlak3Az24xfzVOH NTgu6gmIkXQJGZExqZxVqgpKdSoH7VdnHKwq45QI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1A386F8057B; Fri, 2 Dec 2022 01:21:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 11DA3F80118; Fri, 2 Dec 2022 01:21:35 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id E4723F80118 for ; Fri, 2 Dec 2022 01:21:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E4723F80118 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KcFXp35N" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AAF79621DA; Fri, 2 Dec 2022 00:21:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4DCBC4347C; Fri, 2 Dec 2022 00:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669940490; bh=2TvBpW+4mBe//AkYGD/5GQvrFqDxmtFqkYgIiMm0bgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KcFXp35NRCmH6ZYPyy31n3LAu+jwq2kJCWgdVsvSztn9MMq3fN5lUinCJdZ1YvEkF xL4dZQRZhSzQ4HnmrrM8W96mwXdeFcWdNBgzcfpYZZ6d0fs2G/h2gfnE71GRNcKgVB OPdCbe8GRRkBJZM19WY0vEBK6bVn6t5s4lmGAH88H9goXOR08p+gBb4WbkamrzGCVc QoLCnO8NUQFK4YHOnW/xhVnLsW0lemZ41gg/UMz6x01iefSD22IYYFBkzVmliwREpA PJG9aAxqvFn7BtGoGzEMbzjIM6yyFZHxJCIMmJJOQTe/LalIEFXbZWNMbaILIB+XcB SCZurxV2CvlwQ== From: Mark Brown To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Subject: [PATCH v3 5/7] kselftest/alsa: pcm - Support optional description for tests Date: Fri, 2 Dec 2022 00:17:47 +0000 Message-Id: <20221202001749.3321187-6-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202001749.3321187-1-broonie@kernel.org> References: <20221202001749.3321187-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1131; i=broonie@kernel.org; h=from:subject; bh=2TvBpW+4mBe//AkYGD/5GQvrFqDxmtFqkYgIiMm0bgA=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjiUQq9PhIaf0O7Ezd65lBt/l7LVB7O8/W0d1//JGw IXs0OSGJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY4lEKgAKCRAk1otyXVSH0OyVB/ wLRcQW5P/g1qd8SZ5Zg9Fs9Jwc1mzWGb7otESMM0f0RMdhOW0Bge3A3SHfz+5BcIQH4lxdzgOb78Af B7HJdsZzP46f8w7uNybSWoqaYS4F9j0SF8GsxqOKytc0apmS315oCgTg0VE8jsB5aug0CO1HhzOSoG kSAcCs5KGqAHvckJm56UAILVKG/Udz6lqEYVudDuF1Eo2PxT7IuhQIEpZF7hKgQ9KmfTtbqlRkewZa JjQsUsZzz90F0V/TfbCNJrtpiRMeO+3ZEx8Nufw5KRpC9dS6jAPJOK/TDIcwWNXRBAmifSrau7X5nL Bw4t8oR5v+CZghefkEkgGID6hqR9uM X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" In order to help with the comprehensibility of tests it is useful for us to document what the test is attempting to cover. We could just do this through comments in the configuration files but in order to aid people looking at the output of the program in logs let's provide support for an optional 'description' directive which we log prior to running each of the tests. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/pcm-test.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c index 5fbb3ff517aa..57d3f6dcb46b 100644 --- a/tools/testing/selftests/alsa/pcm-test.c +++ b/tools/testing/selftests/alsa/pcm-test.c @@ -244,6 +244,11 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class, snd_pcm_sw_params_t *sw_params; const char *test_class_name; bool skip = true; + const char *desc; + + desc = conf_get_string(pcm_cfg, "description", NULL, NULL); + if (desc) + ksft_print_msg("%s\n", desc); switch (class) { case TEST_CLASS_DEFAULT: From patchwork Fri Dec 2 00:17:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 630265 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C8A6FC4332F for ; Fri, 2 Dec 2022 00:24:02 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B3E4517EB; Fri, 2 Dec 2022 01:23:10 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B3E4517EB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669940640; bh=dBD1V0ORWBj1gViOrTy7ZqLawnuQQJYymah38QyRU4M=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jH5qcxUJ4jDCKMUdu2VtrLRq9SY5qd4BW/eCVItJ9Oo8fl/IIq6jIkKYgU1wXESma YPylFjDWhGfZc9pryd4GOeamV0cL/JLxrxyTEcjnahlaYUsYUsvmEDsXHr7SBiCvjp 3IM01AwB+qsiBp3pZJi8Rgtskz8qMc1nM6qafx0U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 990C5F8057F; Fri, 2 Dec 2022 01:21:38 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id AC014F80568; Fri, 2 Dec 2022 01:21:35 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CACCBF80564 for ; Fri, 2 Dec 2022 01:21:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CACCBF80564 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JEEjVcEo" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 835A8621D7; Fri, 2 Dec 2022 00:21:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A315C433C1; Fri, 2 Dec 2022 00:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669940491; bh=dBD1V0ORWBj1gViOrTy7ZqLawnuQQJYymah38QyRU4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JEEjVcEoCdDe2vydJgo6Fds44sBe4nGYVFs5kwlOOgY83hP0iaUWBGDlCA1+kjnRR 2WDdmVsnGlz8Mo7C6Zv4CaB51etgn7ku9gHIlMI/PsxqrrlCFKZ1M/yvmuOjkZdFop 20Sd6tfdBLXMjF9vhVNCxPiRC+ANdTVR8J9/as7ZI8UQGtMNGkRiFxVTCeyyCMXfD3 PslMnWKxud72BUGBaM2esWXY/MKGAEp2bf053D3cOf17KmKAQ0NYhIjLpa4fbcQwRN dP4vihSqKnl/NdbIxxCuqyADDrDw870puxZ9SbzDaCETpzP9iHuc7V/f9bv6yXMd0a n2YH6/YV5qTWw== From: Mark Brown To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Subject: [PATCH v3 6/7] kselftest/alsa: pcm - Provide descriptions for the default tests Date: Fri, 2 Dec 2022 00:17:48 +0000 Message-Id: <20221202001749.3321187-7-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202001749.3321187-1-broonie@kernel.org> References: <20221202001749.3321187-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=893; i=broonie@kernel.org; h=from:subject; bh=dBD1V0ORWBj1gViOrTy7ZqLawnuQQJYymah38QyRU4M=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjiUQrsTUC11H3brnOPFclzE/I346UGT29tb6iInrE QC+kHEGJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY4lEKwAKCRAk1otyXVSH0IyhB/ 9hUsUOCb9wqCoPiH7AgPo3TXcnBHp9zypli7WnEc/yqw2ZtuO96CZbFDFz72DqFIqDqiHZDzjYeKn+ SRKMGmc+ttgXbm8dMJlkSDfMr+35fzOH7AKVV7hzQsHIYAbvpr/8oxWucxvONDuDJTim+Ol3xCrOxs CTWI1zv05zYvqq5PCRvjaeo2GxinTGCfXQ94J/sb6o24SOVjqZNtQ7b0XJUeDwJHgrJmv4piKNLy73 saRRuYwjX65h6IE+ECKM4lZiajYbxLu+bk1i2loBoFG1BYVVvn0FTGZqknw6OK63PkQfTt6Cr48DKr w+oYe/TAjIHrD+4dHxi5WWhbrwBx5Z X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Help people understand what the standard tests are trying to cover by providing descriptions which both serve as comments in the file and log messages in the program's output. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/pcm-test.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/alsa/pcm-test.conf b/tools/testing/selftests/alsa/pcm-test.conf index 473a19251b49..1662a8c7073e 100644 --- a/tools/testing/selftests/alsa/pcm-test.conf +++ b/tools/testing/selftests/alsa/pcm-test.conf @@ -1,4 +1,5 @@ pcm.test.time1 { + description "48kHz stereo small periods" format S16_LE alt_formats [ S32_LE ] rate 48000 @@ -7,6 +8,7 @@ pcm.test.time1 { buffer_size 4096 } pcm.test.time2 { + description "48kHz stereo large periods" format S16_LE alt_formats [ S32_LE ] rate 48000 From patchwork Fri Dec 2 00:17:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 630663 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70DEBC4332F for ; Fri, 2 Dec 2022 00:24:23 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 7A2EF17F2; Fri, 2 Dec 2022 01:23:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7A2EF17F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1669940661; bh=IS7rd7rcz6gVpwRJ0tJXC7rhdgZaY2/fgyU9ObJPI5Q=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=krdY36aC7Kg6I80CI8gwPA+uaobYG9ldAf+W8Zfw6+MAt61+qBaK2BADj4S+tnkxr ffGbIEKoYigHnVkm4VfFxmh+OtuwiEknMYRhb9BUwCpg2+yceWRmANqnF1ggiPw79I ScQB1E1UuoU93MsoJi9WtXUb3yT6FJFIkN47SWPY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6B358F805A8; Fri, 2 Dec 2022 01:21:39 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 593BAF80118; Fri, 2 Dec 2022 01:21:38 +0100 (CET) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A73FCF80118 for ; Fri, 2 Dec 2022 01:21:35 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A73FCF80118 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KWdLTbyZ" Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5706B621DF; Fri, 2 Dec 2022 00:21:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6066EC433B5; Fri, 2 Dec 2022 00:21:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669940493; bh=IS7rd7rcz6gVpwRJ0tJXC7rhdgZaY2/fgyU9ObJPI5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KWdLTbyZw6FD2y1dEc0h4hUfAw8464ePoanpcVIdyrak4PprQq8PxsPn1UUcrc8Sc Q9f7PApwg5oS/44kZo9xNhUVZoDfig2BV4mrEPgycamJTz/5j4w/LYT4qzv1pva5T4 XuWyJZ53ebqkEQxhV2nN57oezbGJuNAQFjjZlMQorXzZJQ/52TLOuW+869yh+6m3dT gRYBUu5WpdXEzcK+1/2MtjQXNypRcirjhPZwpSfL1Ut+oIC8M5mrDla9oS49UAjVvG 7XXEnhr88ICj6O8Gdxle+wE7l9Vh/8J6B30mAwPDYrVLZqdepUGHEDyzfHFVfwUz6S dFo7TwUUqXJgg== From: Mark Brown To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Subject: [PATCH v3 7/7] kselftest/alsa: pcm - Add more coverage by default Date: Fri, 2 Dec 2022 00:17:49 +0000 Message-Id: <20221202001749.3321187-8-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221202001749.3321187-1-broonie@kernel.org> References: <20221202001749.3321187-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2103; i=broonie@kernel.org; h=from:subject; bh=IS7rd7rcz6gVpwRJ0tJXC7rhdgZaY2/fgyU9ObJPI5Q=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjiUQsmgfNGHKOyR2nQQ0g8wGVV9lgyN9d+BfKhoRB DB3xuZaJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY4lELAAKCRAk1otyXVSH0PtDB/ 4gY8OkdnwpR37jPZrDF0R/dLp0g3ttzwQz0tuLDVznS8yA3Mo4Mf82os5jYW27sKRp6h0m6Ok25Q4R z4EV0mSsg9TVhikFfGZ46cDGtIY255Lx5sTxymEBPxXWn8NqoGpNrCkKVf7ek2dAnPnHuor8wJsm3S r8kRHRgnxoiypLVvapPXg20t8WoO93oFixEC/wTiX6wnhyVmjp6zdSaWYMGLA9oVVDNh4Q68rwlgwA KpigtY/fdow0SZOsJ06ZTrehq6XH5yzHSFhPnk/r9/R508sEZKYU9vllaswIrQLPf3wcM5OgXFGBtP RcNDRE8WHC4H9dvJdtUJ5VvQFe1VcZ X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Cc: alsa-devel@alsa-project.org, Mark Brown , linux-kselftest@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Add more coverage to our standard test cases: - 8kHz mono and stereo to verify that the most common mono format is clocked correctly. - 44.1kHz stereo to verify that this different clock base is generated accurately. - 48kHz 6 channel to verify that 6 channel is clocked correctly. - 96kHz stereo since that is a common audiophile rate. Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/pcm-test.conf | 47 +++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/alsa/pcm-test.conf b/tools/testing/selftests/alsa/pcm-test.conf index 1662a8c7073e..71bd3f78a6f2 100644 --- a/tools/testing/selftests/alsa/pcm-test.conf +++ b/tools/testing/selftests/alsa/pcm-test.conf @@ -1,4 +1,31 @@ pcm.test.time1 { + description "8kHz mono large periods" + format S16_LE + alt_formats [ S32_LE ] + rate 8000 + channels 1 + period_size 8000 + buffer_size 32000 +} +pcm.test.time2 { + description "8kHz stereo large periods" + format S16_LE + alt_formats [ S32_LE ] + rate 8000 + channels 2 + period_size 8000 + buffer_size 32000 +} +pcm.test.time3 { + description "44.1kHz stereo large periods" + format S16_LE + alt_formats [ S32_LE ] + rate 44100 + channels 2 + period_size 22500 + buffer_size 192000 +} +pcm.test.time4 { description "48kHz stereo small periods" format S16_LE alt_formats [ S32_LE ] @@ -7,7 +34,7 @@ pcm.test.time1 { period_size 512 buffer_size 4096 } -pcm.test.time2 { +pcm.test.time5 { description "48kHz stereo large periods" format S16_LE alt_formats [ S32_LE ] @@ -16,3 +43,21 @@ pcm.test.time2 { period_size 24000 buffer_size 192000 } +pcm.test.time6 { + description "48kHz 6 channel large periods" + format S16_LE + alt_formats [ S32_LE ] + rate 48000 + channels 2 + period_size 48000 + buffer_size 576000 +} +pcm.test.time7 { + description "96kHz stereo large periods" + format S16_LE + alt_formats [ S32_LE ] + rate 96000 + channels 2 + period_size 48000 + buffer_size 192000 +}