From patchwork Tue Jun 20 22:08:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 13286472 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 CF6D1EB64D8 for ; Tue, 20 Jun 2023 22:10:58 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AF32184B; Wed, 21 Jun 2023 00:10:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AF32184B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687299051; bh=oc8eRilh+UL0gC7vlGxWO3QMKLhgfG0/Q1DqxC6qW1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=gP577KmpVxPLJO4pQA8nK8A05KUqK5s1Yy7gqEN+WTCLb5IP8jytcHWt/r+qbthgO ao/YH2dXcJKAdmDlMxwfpOhhnFQhho+sAHFMC39N5XLSAslCEKYEUbAt9fTY2vNMXB w/uG2mN98ONObUdNNNFxRWA9hxD6qlhSOYCSdpJA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 22AEAF80564; Wed, 21 Jun 2023 00:09:07 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 8BB10F8055C; Wed, 21 Jun 2023 00:09:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9428CF80141; Wed, 21 Jun 2023 00:08:59 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A0497F80124 for ; Wed, 21 Jun 2023 00:08:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A0497F80124 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=AgGTpQXD Received: from notapiano.myfiosgateway.com (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madras.collabora.co.uk (Postfix) with ESMTPSA id 19D056606F70; Tue, 20 Jun 2023 23:08:47 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687298929; bh=oc8eRilh+UL0gC7vlGxWO3QMKLhgfG0/Q1DqxC6qW1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AgGTpQXDGsH0OD9JD+Nzxs0bnMhhciLwkp5WIGj2hR1zoh0/1+YRYjc587FRHxGjq V+fgot0OR4R+WL8FMkWEZU0NRDcTBNe79beD8IKJGFyD5jrsLcWhnTlgZETmu/0gyw FbePyK0jXkQrdD2oqpAD0A/yofnyqUhZSCUPtiIwKonnusW8tPn9esgU8KK0XcfF3L t33x3DByTCf+UclqDEGYM+5BcHCcDczAw06p3sbF/T7wT34jD60cRPO8Tn6oOdlc/z KA7YJVXA3DdGO4syUyOB8ZwaFx+ZQR7BJL5Y3zSOJgEOuIYr1fVz4OgsAnxeSbRA7m 1o+1hTSpcIIdw== From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Mark Brown Cc: kernel@collabora.com, AngeloGioacchino Del Regno , =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Jaroslav Kysela , Shuah Khan , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH 1/2] kselftest/alsa: pcm-test: Move stream duration and margin to variables Date: Tue, 20 Jun 2023 18:08:25 -0400 Message-ID: <20230620220839.2215057-2-nfraprado@collabora.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620220839.2215057-1-nfraprado@collabora.com> References: <20230620220839.2215057-1-nfraprado@collabora.com> MIME-Version: 1.0 Message-ID-Hash: IMKF2XZANIKHURKLUAXMD3ZQPBUSHLPY X-Message-ID-Hash: IMKF2XZANIKHURKLUAXMD3ZQPBUSHLPY X-MailFrom: nfraprado@collabora.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: <> List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: The duration to stream for and time margin to consider the stream failed are currently hardcoded values. Move them to variables so they can be reused and more easily changed. Signed-off-by: NĂ­colas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno --- tools/testing/selftests/alsa/pcm-test.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c index 3e390fe67eb9..a2b6db33b513 100644 --- a/tools/testing/selftests/alsa/pcm-test.c +++ b/tools/testing/selftests/alsa/pcm-test.c @@ -258,6 +258,8 @@ 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 int duration_s = 4, margin_ms = 100; + const int duration_ms = duration_s * 1000; const char *cs; int i, err; snd_pcm_t *handle = NULL; @@ -442,7 +444,7 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class, skip = false; timestamp_now(&tstamp); - for (i = 0; i < 4; i++) { + for (i = 0; i < duration_s; i++) { if (data->stream == SND_PCM_STREAM_PLAYBACK) { frames = snd_pcm_writei(handle, samples, rate); if (frames < 0) { @@ -472,8 +474,8 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class, snd_pcm_drain(handle); ms = timestamp_diff_ms(&tstamp); - if (ms < 3900 || ms > 4100) { - snprintf(msg, sizeof(msg), "time mismatch: expected 4000ms got %lld", ms); + if (ms < duration_ms - margin_ms || ms > duration_ms + margin_ms) { + snprintf(msg, sizeof(msg), "time mismatch: expected %dms got %lld", duration_ms, ms); goto __close; } From patchwork Tue Jun 20 22:08:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 13286471 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 B4ECEEB64D7 for ; Tue, 20 Jun 2023 22:10:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 45EAD844; Wed, 21 Jun 2023 00:09:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 45EAD844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1687299047; bh=g1Ge7OS0fr37jsbP/Xrz0cMOpZ9QFiuqkEuRXr45wpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=fnUNNfmoZGdRcMmDza7hd9I6UwW0WmFhGPysHc/AobLUYEwPGa4We1kGWeF4eqSTd KK8LQ8E3C5QzZsGG4zUJH33Rw/5TPdwoxH6u+K5pnuSmUdSyGi+1Y+z/XKKsvNsrUR E+CCxc5318FrdhAh06Rxzxxq5Tna7MyFnhGdtfTI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 563DEF80558; Wed, 21 Jun 2023 00:09:03 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 22762F801F5; Wed, 21 Jun 2023 00:09:03 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BA8FCF80163; Wed, 21 Jun 2023 00:08:57 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id CFBAEF80132 for ; Wed, 21 Jun 2023 00:08:53 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz CFBAEF80132 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=keBZDB/q Received: from notapiano.myfiosgateway.com (zone.collabora.co.uk [167.235.23.81]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: nfraprado) by madras.collabora.co.uk (Postfix) with ESMTPSA id 274586606F8A; Tue, 20 Jun 2023 23:08:50 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687298932; bh=g1Ge7OS0fr37jsbP/Xrz0cMOpZ9QFiuqkEuRXr45wpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=keBZDB/qPPd4GgrMzo8SeAUd+1s5SQOLo/TyAovssps9kWDPo9TVSne5g5X/uY1QK wWAPE4tW9UVGnYJCPu/Fb9LATyCXwIqhAZ+gFUza0WZ5TnmP1RoNiFesbl8iZ3+4Q7 sLRk7KPxDV4hhxPMcyXxHzUFM6z6HHc/vNx05dEMvUh1PjWuK3tqillU2CLebZ4xIK 2gDQMMERY8VDHZEnVg8RlHEbytH5hbGoLltCuIzD4sIjfFDw8XC+6mDFB5/YC3sIon UNplbzV0veEY/S+bytao02xVIS7gQyV8JATXT90lfovZn9mMWx2ev1JSB2zYxopbQ9 Ooi4YfeZYPl8A== From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= To: Mark Brown Cc: kernel@collabora.com, AngeloGioacchino Del Regno , =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= , Jaroslav Kysela , Shuah Khan , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH 2/2] kselftest/alsa: pcm-test: Decrease stream duration from 4 to 2 seconds Date: Tue, 20 Jun 2023 18:08:26 -0400 Message-ID: <20230620220839.2215057-3-nfraprado@collabora.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230620220839.2215057-1-nfraprado@collabora.com> References: <20230620220839.2215057-1-nfraprado@collabora.com> MIME-Version: 1.0 Message-ID-Hash: MMVVZ5YO3VPLEL3GOCKBY6LPIGNTWGC7 X-Message-ID-Hash: MMVVZ5YO3VPLEL3GOCKBY6LPIGNTWGC7 X-MailFrom: nfraprado@collabora.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Currently test_pcm_time() streams audio on each PCM with each configuration for 4 seconds. This time can add up, and with the current 45 second kselftest timeout, some machines like mt8192-asurada-spherion can't even run to completion. Lower the duration to 2 seconds to cut the test duration in half, without reducing the test coverage. Signed-off-by: NĂ­colas F. R. A. Prado --- tools/testing/selftests/alsa/pcm-test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c index a2b6db33b513..de42fc7e9b53 100644 --- a/tools/testing/selftests/alsa/pcm-test.c +++ b/tools/testing/selftests/alsa/pcm-test.c @@ -258,7 +258,7 @@ 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 int duration_s = 4, margin_ms = 100; + const int duration_s = 2, margin_ms = 100; const int duration_ms = duration_s * 1000; const char *cs; int i, err;