From patchwork Tue Dec 27 17:06: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: 13082437 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4529C10F1B for ; Tue, 27 Dec 2022 17:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230326AbiL0RHY (ORCPT ); Tue, 27 Dec 2022 12:07:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbiL0RHX (ORCPT ); Tue, 27 Dec 2022 12:07:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABD68BD0; Tue, 27 Dec 2022 09:07:22 -0800 (PST) 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 3B9A8611B3; Tue, 27 Dec 2022 17:07:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E8D5C433F2; Tue, 27 Dec 2022 17:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672160841; bh=GT0ib72WyJtF+L2c/Gx69hmpwfVEAu1SUy6Sba1vebw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=armwAVD8T9mnAHhKri3M65L6kE3DC7P4+9S9GX2v5Uad6JYCmDmaDcfQqt/lHDlMo 0U7u8r7JydEhiBVKgQE6MiXgfLD1NmTkBEq3pRNlJ1v4j1e42cn/RE/uzihYlDNDYW fX5QgJqAf1WG6iPPpJFCQAz2G/DnkgWiorsbtmAOB6H0akio09KSpUY9F4uzCC/Lt+ Ar+z43jE31St23utVgVv8bUowLjhjWxXJcU/flt6IbGdefoayoWASJMDnvdLKKqzkR 3hpIvKNaQLQ7zki+4Sy3wa7O8lxkhNjROWefL5F9cNN9Q6M/qJSFcT6ch18tm82gTS DEoruS8nSxScQ== From: Mark Brown Date: Tue, 27 Dec 2022 17:06:46 +0000 Subject: [PATCH v4 1/7] kselftest/alsa: pcm - Drop recent coverage improvement changes MIME-Version: 1.0 Message-Id: <20221208-alsa-pcm-test-hacks-v4-1-5a152e65b1e1@kernel.org> References: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> In-Reply-To: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.12-dev-7ab1d X-Developer-Signature: v=1; a=openpgp-sha256; l=9518; i=broonie@kernel.org; h=from:subject:message-id; bh=GT0ib72WyJtF+L2c/Gx69hmpwfVEAu1SUy6Sba1vebw=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjqyZAbqPyo20g/crzqVyXwv4m9w1ElysCONNEpBgI bgiBg2CJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY6smQAAKCRAk1otyXVSH0C7rB/ 43TCyZavNZeBUCukQZ0aKXxemyrt9wIDijRAIMMLKWAPw+PmZCLnKwER/fYBIjqRoO/L27Xj2ynJQb 5Qh1u2jkqIDgj6597uylgyy0O9NRncJYUBCWm2C6Fvia7E9ZsPeIPvMsvgZsvmyESA30ccsAmp7Aio t6XC95XqZhUBzFL0DmQ4XF4MnNy8J08g+GlJ04P9YJVrU7pC+MfAqLliwXZ5tYZzgrc5pEgQAK6+Qw YLNyhN+/XwEjtnahY9w+3ohRMQl0dZX1sEGEYZlJcBr0szzUWcyfX74qkzfphzStoRcHp7vdJCmmin N/xb5kdCTsDRercTKaCBtauObfEh6w X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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" Reviewed-by: Jaroslav Kysela Signed-off-by: Mark Brown --- .../alsa/conf.d/Lenovo_ThinkPad_P1_Gen2.conf | 35 ++++----- tools/testing/selftests/alsa/pcm-test.c | 88 +++++++------------ --- .../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 Tue Dec 27 17:06: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: 13082439 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87899C3DA7D for ; Tue, 27 Dec 2022 17:07:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231820AbiL0RHh (ORCPT ); Tue, 27 Dec 2022 12:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231521AbiL0RH2 (ORCPT ); Tue, 27 Dec 2022 12:07:28 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 508D1103A; Tue, 27 Dec 2022 09:07:26 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id D4033B810A4; Tue, 27 Dec 2022 17:07:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F5A7C433F1; Tue, 27 Dec 2022 17:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672160843; bh=BxY7jZ87A26XLZ9o9fnxh2F44rprPf30Lt9YBO/M0k0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BRGL0OieVVXrZXoBWfwpunZA+CyKoUqOx531cOF3sJwQ6XToVuPnq3DxjEN+y1HOj N72Q77hdiGJ6GhP5Wk0pUHti26R5JQoZclgsTR+e1VPMDaoWJBSJz/zBe64Ws9SXl0 bPrJseejQYX4lT/j8UR4iDVq6Bfcdw3U2Awse9mDrJxWmGJS6Bfb+HXgk1w19HzdkT gSDPpZ4Nc6rupLDla3sxKAEuL80p646LmYNLneAtXReO96sqkD1gDIqisG5RjVs4t6 EM1Y9RMqRj0BIcGg4slQKFPXUEgf09EGayQXCBQoSThgiPuu66SYsrw8VApEy5lH7c M/n1rbKRQFUtg== From: Mark Brown Date: Tue, 27 Dec 2022 17:06:47 +0000 Subject: [PATCH v4 2/7] kselftest/alsa: pcm - move more configuration to configuration files MIME-Version: 1.0 Message-Id: <20221208-alsa-pcm-test-hacks-v4-2-5a152e65b1e1@kernel.org> References: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> In-Reply-To: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.12-dev-7ab1d X-Developer-Signature: v=1; a=openpgp-sha256; l=12918; i=broonie@kernel.org; h=from:subject:message-id; bh=RA/I/0wWmCkP8D9gYzC1FjEOLPnE/o/mg1aAVs2XjNo=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjqyZBf7IPwTnFvyPfETC2nVL6RnIlvBBrn8chdko5 UL9eJYCJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY6smQQAKCRAk1otyXVSH0IOLB/ 9qHWWuJ9To47RSY71WcxXJCoKAGSlXsTID6BelSCIL8TpqOqChhL+VrGlnCsGA1DlDgC7oUJI0uPql NfD60AGzTui17+yi0N4ggzKJvWeEPGjiD8WwPBCAdQU7BQtgZEFMQbpUR7G40H8C1qdZAIzV9T2Z0b +T9Hy3EgH02sl5sgM4hsQz4DzZ7F0kMP5aoH4+uj68me/DutdCpZUtRCJTWqzArnytNz1AofrjxZsz Pe4vtup8WA3yDDYOm1rWylnFEHCogS9jCluP5IRjEoSy20VaXX84knKSw0xgw6MD91P/KOUPxCMdo1 gOIwIxh4XeBXuV2L2+8GigJTlYy0Hp X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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/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(-) 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 Tue Dec 27 17:06: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: 13082438 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE9D1C4167B for ; Tue, 27 Dec 2022 17:07:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231695AbiL0RHh (ORCPT ); Tue, 27 Dec 2022 12:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231277AbiL0RH1 (ORCPT ); Tue, 27 Dec 2022 12:07:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69BECBD0; Tue, 27 Dec 2022 09:07:26 -0800 (PST) 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 0451D611D1; Tue, 27 Dec 2022 17:07:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00579C433F2; Tue, 27 Dec 2022 17:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672160845; bh=QBW059o+Ed0VQcvPcg58O63j+mTx7qedz0SY0dI1vzo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=A5byXN/ntpI1vgjF+Kfd1ySBVDD2qZvM7KYKT74sOLqCABCENrljS8UIxk66epY7t m9rS3rbk9BsVQU538sV9PknA4Dv882KQob1K+CVUThQ8qHywilsW7BFJdfTo5uMdEe I2V2U2x6HaRud5h2QLS4tBFvyoidfGrh32HR7FHXt0bofnTY3eslxwX5XCU/SS9Bj+ GWFqxgt8prS8fTkNzmYvOIxk4Vr0hVuzqVieQm4uLRvG73pnUJDLBcbLWzu8GtyEu2 dMIOguZCIM/qlBKf5rZI47SBFTQ55hMyx3wlpEgQxlsjSRzeiEgd4BhN0oLPLBpMuE XDstPtIX17BBA== From: Mark Brown Date: Tue, 27 Dec 2022 17:06:48 +0000 Subject: [PATCH v4 3/7] kselftest/alsa: pcm - Always run the default set of tests MIME-Version: 1.0 Message-Id: <20221208-alsa-pcm-test-hacks-v4-3-5a152e65b1e1@kernel.org> References: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> In-Reply-To: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.12-dev-7ab1d X-Developer-Signature: v=1; a=openpgp-sha256; l=5597; i=broonie@kernel.org; h=from:subject:message-id; bh=QBW059o+Ed0VQcvPcg58O63j+mTx7qedz0SY0dI1vzo=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjqyZCnMHDeoyUcsze2hzEMgQZUMXZpP4K9Pz4OQ4b 4ar59DGJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY6smQgAKCRAk1otyXVSH0HDIB/ 9GNHOyuP0udUI8ZDCOoxRXpE+9/0AO6+Zd9k/DULd5me2ciSidH4KukmGRkugBTOMyRpKC/5/A9USH dAyQSpwrfwBJphXoQ7cDugi0pbP6k2jADUrXcT/lDL8nU+bctx0qsmG3+hl6oI/u372B2J/UwocUO3 dVCw2PzXmnyvke1Sx5+vAVc5hVJEktDbvA5qnuJvFUF2Tl1PySKJAKVoPEyL5mKS/ivLwfrRnFaFiD qzwQ1YrFav6v/IsemGbyIJvdxQieChowRlNM1RYqQ5WIp+HXzBUSPMXCyqXyyUBbhHjFb8Z6hjFFyy uKPZPN4Pu8lMOp3kAmtozysAsuGCMx X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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. Reviewed-by: Jaroslav Kysela Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/pcm-test.c | 83 +++++++++++++++++++++++------- --- 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 Tue Dec 27 17:06: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: 13082440 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B604C3DA7D for ; Tue, 27 Dec 2022 17:08:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231865AbiL0RHi (ORCPT ); Tue, 27 Dec 2022 12:07:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbiL0RH3 (ORCPT ); Tue, 27 Dec 2022 12:07:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 548E9B483; Tue, 27 Dec 2022 09:07:28 -0800 (PST) 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 DB594611BC; Tue, 27 Dec 2022 17:07:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4671C43392; Tue, 27 Dec 2022 17:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672160847; bh=rLgMnEoCh4Po4vgPePrdSWrV7l9PvGVlzfYwGi2W6N8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=MdAqPm+d4i9GvZ9jYcEtnjrKfHQT+SHwkbVsSo6/txIZUZU+/koqXShl2czBWcwLY 1Gma+zgv7yUgHy9U1C0NZ2gSu5IujjVjJXMuieb9HkRORm1sM4GwSOKleqB2rxlgPs G/hvt9BNT3/Yux3WYU5dxysHIHyl52G5C+h1Nx81puVCtB12+d0XeiW/prs1LiskKN aF2tmv4ZZpD+s+26dpTfy1Hq4gpZkKaPtJSy8JUMkTbo0cRs0p6kKTNuZ2wokLRgAa RQRl93tM7RIhYj4vFgsWWybi1HaDNDr+zgSlLApyFdVHvezhue5P7MnyM24HTlHSBC alLQZcbVvkOQw== From: Mark Brown Date: Tue, 27 Dec 2022 17:06:49 +0000 Subject: [PATCH v4 4/7] kselftest/alsa: pcm - skip tests when we fail to set params MIME-Version: 1.0 Message-Id: <20221208-alsa-pcm-test-hacks-v4-4-5a152e65b1e1@kernel.org> References: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> In-Reply-To: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.12-dev-7ab1d X-Developer-Signature: v=1; a=openpgp-sha256; l=3296; i=broonie@kernel.org; h=from:subject:message-id; bh=rLgMnEoCh4Po4vgPePrdSWrV7l9PvGVlzfYwGi2W6N8=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjqyZCA6KmbKb+V4cZOVDCWU4CaQ4v0Yda63HYpsl5 FKmUTRCJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY6smQgAKCRAk1otyXVSH0BuaB/ 4tG5bK7jC3pNwSraJ8nHV7MboM/RcCC/WeIZNx3KG9H/LXvtTetSimPXggI0IAOaHxZ+JF0QgTSTpK zyzJDCFNpTs/Wo669/1U601o5lZE1glydpXhZAY5nP6Q2yDFlzHxtPT1JkthCLk2YvESnf0q3xBeFu Tmov+5DIEmbOqtJ7iNvABnYlO/su4ghpI/jFoP1L7CDdn8Wp2PAHOfT/ov2uH9HhE4yJ2P6w3tA9qm wC6r+TmFs6Ff6niDCa73j9r7lMgHbg1RHEJFL1GGyg6umrkiOX5u7NVxc0i1BXS64x8PhAPULU2GjX m/G7+VOw9Ya4fckJx0WfZvws68N/n1 X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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 Signed-off-by: Mark Brown --- tools/testing/selftests/alsa/pcm-test.c | 39 ++++++++++++++++++++++++++++-- --- 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 Tue Dec 27 17:06:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13082441 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24F40C4167B for ; Tue, 27 Dec 2022 17:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231652AbiL0RIL (ORCPT ); Tue, 27 Dec 2022 12:08:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231819AbiL0RHh (ORCPT ); Tue, 27 Dec 2022 12:07:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD913BF4F; Tue, 27 Dec 2022 09:07:31 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 70790B810A9; Tue, 27 Dec 2022 17:07:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B85A1C433EF; Tue, 27 Dec 2022 17:07:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672160849; bh=Qac4tRPVwm+vU5JwLiY8YoXwmuzFi3r8T7rPHIYOptY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=gJCEh+g2pV6+Gh7a9gs7qh3fiwSGW6rpOvzWwYM8MByFQNQdd4S5Tn3wnVfJJO3Iw DSkhlehz6Rs3dqcemfRGDzTrnu7+Dp9iHqETbJToTfTg420fYExUIPQqNzrrAsJUKU ku5wy3JMyxdHNbvv43v6NJcBwZL/ahDkp9V5FGkIEe2vXBa3TZNWgj5Gd1hWPFK0v1 w7+CRFFHA/U5CaPqeihqHOqYQhfUr7UGAUFPBZg0/IaMqJJEptcH03DxiXvXZ7VgfR fJo5KDhVfC/SCQgzyBJPRXylG1+ztqbm7FUB9EYFIvA96XZelEZl2/tsO/TMeJNRLt L8E48VJOgRRrg== From: Mark Brown Date: Tue, 27 Dec 2022 17:06:50 +0000 Subject: [PATCH v4 5/7] kselftest/alsa: pcm - Support optional description for tests MIME-Version: 1.0 Message-Id: <20221208-alsa-pcm-test-hacks-v4-5-5a152e65b1e1@kernel.org> References: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> In-Reply-To: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.12-dev-7ab1d X-Developer-Signature: v=1; a=openpgp-sha256; l=1180; i=broonie@kernel.org; h=from:subject:message-id; bh=Qac4tRPVwm+vU5JwLiY8YoXwmuzFi3r8T7rPHIYOptY=; b=owGbwMvMwMWocq27KDak/QLjabUkhuTVas4MzQHH97r+zPKZlfcq4tujG01du025FifvLdR32ao2 caN8J6MxCwMjF4OsmCLL2mcZq9LDJbbOfzT/FcwgViawKVycAjCRrEUcDC0uLOEvdUVSdR3evdbfE6 Adk7IpsjXsR//DtykbAmdtqxA7tHaRepginzdX1ocMg2ubGbce5dQqd6tq3bZGdOq9Fwv97lTWH42Z IiH7/PZa3qon/3t/XFp+wWzi7L1ba/YWG1bflF6y5HyG/+vs5q3NiY3M3xOMHj991JWoUsjfuHO3wp oE455t097EsFzWPd3CcsyjyoZZTIvn08u+vr1f2/o9ROsUoz82/JV0X6X8NLnlqtqlV9bWGjsDyrd1 Kqxr2ril3e9TQGCX8P9FSzLZ05ru9UbO0PQsOyvMkXFjCZ9alisz1+ryAwv3PfKIXn934tQqYZ34IO kYI6fUWNWWXxGfPsgcC+fVu3ATAA== X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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. Reviewed-by: Jaroslav Kysela 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 Tue Dec 27 17:06:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13082443 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 659A8C3DA7D for ; Tue, 27 Dec 2022 17:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbiL0RIO (ORCPT ); Tue, 27 Dec 2022 12:08:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231915AbiL0RHj (ORCPT ); Tue, 27 Dec 2022 12:07:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B634BE30; Tue, 27 Dec 2022 09:07:33 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 44801B810AB; Tue, 27 Dec 2022 17:07:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99D40C433F2; Tue, 27 Dec 2022 17:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672160851; bh=D42E5y8FdtxfQXs/2hUywnM+rHr45IO+HscRXS6eAM4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Z6L3rseOX3KHQkU1Nm/L3Dd8SZM0rWsj5EoTT6jP9nJo+4k81C6ZkBKhEx0YPd9rU 3biq7UZS7kmdMvQTj/+/ufxLEFAA9dQtbQ13sOjvaQryTz6ugmTarAvBrhnqc+knbk FU0cDWdir3VarbRObpzwHx/i4BZmig9EKG5I041Jn1RlyjoFVFaTQn8CxndttWPNpm WxthkWXyAqiOaor8CLFquGyIFb7NwNx/LCQlYaVYpiIVzXJXc+PgDjwCWJOeJSL3og iptpp4bxNhP+Drm36eNoqbiAmfs+5md3LaKrIoFcpIsfUHg/8DjxvpK1PYB9lSI4od Oukwfv4SqwSxw== From: Mark Brown Date: Tue, 27 Dec 2022 17:06:51 +0000 Subject: [PATCH v4 6/7] kselftest/alsa: pcm - Provide descriptions for the default tests MIME-Version: 1.0 Message-Id: <20221208-alsa-pcm-test-hacks-v4-6-5a152e65b1e1@kernel.org> References: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> In-Reply-To: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.12-dev-7ab1d X-Developer-Signature: v=1; a=openpgp-sha256; l=942; i=broonie@kernel.org; h=from:subject:message-id; bh=D42E5y8FdtxfQXs/2hUywnM+rHr45IO+HscRXS6eAM4=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjqyZEyfwXa5iZU6mVgxLzWh/Mj1JsaY3GxX6l7f1q ZmUBMS2JATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY6smRAAKCRAk1otyXVSH0HgWB/ 9a3SG6C4gW8prD/27zhse5YklxGE1xTvfyrbvpu3VvneVrE2T6oE3ytitNwiF0vJYF+9x0USrUcNcq EuKIp4KUVC5iCbchad17sKWL4s7kx8qpfrTUu/kA2DhTAztTAnX5CdbSgFHoeVLzE5RVb2P/QyBwyD MiSJTsuNbai9Rm3KNvzklhquDKbZk7OOKwhYS3nwt1G1WuxnpgRS4cqEIaJVfVN+RXcNT6TfmCNASW enHXned6BDDh8PR49/P7Hm5QdCrJg/faJ1nqyawSEPX6kWmBFGz6PHZg3y8/ML9bcYIxkjCPAnXlIQ 2HSyKqvZIGA7QiI3lttfsJy6wQ8OAo X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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. Reviewed-by: Jaroslav Kysela 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 Tue Dec 27 17:06:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 13082442 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56F92C46467 for ; Tue, 27 Dec 2022 17:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbiL0RIN (ORCPT ); Tue, 27 Dec 2022 12:08:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231931AbiL0RHk (ORCPT ); Tue, 27 Dec 2022 12:07:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C5CCBF6A; Tue, 27 Dec 2022 09:07:33 -0800 (PST) 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 7E202611D1; Tue, 27 Dec 2022 17:07:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78E40C433AF; Tue, 27 Dec 2022 17:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672160852; bh=uxaBKlEBdgL2vH6RIInA6fuLSoTpmrLUhjWBaHzLQMY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=B0vvlwYeBFVsH5dzWcS9zGctixO+BcVewUGdlEbOSaTLz6q4UGTMnJfw5wtWPC8Ki Z//pmIfDhIzmK9aBnkuh2SLvCJnSrzzjX+h/JxoW+h6XHL0aOecAWUC+te1OVgBEmU KkAlT0XTbuomePlmuHknbIuoG7N6GWr5hClA9oXnDOuzJQrXP7D+21w6h57Vea2BMM x4c9/BMJ0LyOWy6X+nvuR2HaonZKqwJPUKhlQ4b9aeU2vPJR4VokQ/5+kzLQEdEcgV /yRcqvwCYLrJFYPJseOWvfSqhtWTIZOQgfyLeybXhOo9khAAeF+1SDbFcQdmbwKt2X omC8FY3PycjcQ== From: Mark Brown Date: Tue, 27 Dec 2022 17:06:52 +0000 Subject: [PATCH v4 7/7] kselftest/alsa: pcm - Add more coverage by default MIME-Version: 1.0 Message-Id: <20221208-alsa-pcm-test-hacks-v4-7-5a152e65b1e1@kernel.org> References: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> In-Reply-To: <20221208-alsa-pcm-test-hacks-v4-0-5a152e65b1e1@kernel.org> To: Takashi Iwai , Jaroslav Kysela , Shuah Khan Cc: alsa-devel@alsa-project.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Brown X-Mailer: b4 0.12-dev-7ab1d X-Developer-Signature: v=1; a=openpgp-sha256; l=2160; i=broonie@kernel.org; h=from:subject:message-id; bh=uxaBKlEBdgL2vH6RIInA6fuLSoTpmrLUhjWBaHzLQMY=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBjqyZF4AynULWOON7IsKhfOyuMp8d1cKEzp28jmiLn bAKabXmJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCY6smRQAKCRAk1otyXVSH0L4CB/ 9Y/IcV/hbQxayzYQsUYnwl4bcP73J3w9Q8D4DLLlcycEy9+CT7NbYvB17FUeibbOMc4XoojPKLTSpV qcaYQ9DSDtHboeRb70V7brVMWPnWDKiDXL2U84cDKqt2TFa7PJu8LnutT2N5ko/3UAu3UtAgA8/akI wiOevp+bm+amAgoHMuqFVwh2XVDuVWRZr60Ib2HsLDYgImHhSgudVrxvzF4sgpyg5u2xKHqFPUcWc+ Y5Oi2RMVA0FwgMYR78oZeUYPqOwdHWzIuqCueNshnmMhCy+k11lLh8Y9rsuQq4eoW/lNRzohzQUIzE Co6Kr1lvBNNjZEbIhPZEOM8aaV1Elv X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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. Reviewed-by: Jaroslav Kysela 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 +}