From nobody Thu Jan 23 12:39:08 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Yf0qx00Zjz5kt8m; Thu, 23 Jan 2025 12:39:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yf0qw6W5vz3THB; Thu, 23 Jan 2025 12:39:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737635948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fcFDUvsYdwL04dfvo+JPneBiLnLz/QNU5Whhyypa8GE=; b=YFEv0+/AZSQq8a8qAOrneARndfori8GfBUkoirKl2SHUSuATd/vZkpoVu8QyAY2inq1vsO R9v8Gua4XivgRxt2LnY6+Yu+3msYu1icvDmgQmbwSJVKFHHRMi9k1R2j2iWJ8zFqgT70v2 LfST62GMeSGyt8J2UuxaA2wlL3N44zWdrRsJDYrOQRyTxKg4it+i1XWaGmVAlfEwFrAyNt mz3A1ry/gJeVexEJKnWJC1QJI2ByN8tyPXUawgdOiA6hLGvutu95kx+bY2cd8TkX3L9Y1W xAWh86uThq/ogiD48gySBKE09A89F4NwiaEklNuSRUQXoLkguHFdYcg8uaJD5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1737635948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fcFDUvsYdwL04dfvo+JPneBiLnLz/QNU5Whhyypa8GE=; b=t0wD4kfG9Mke5z0P74wo61/p74X49F865iNXn96gHcuxwA3KksAiN0WCsBe9+fLIk+WsJV cBDgA3Ok8etwoqOluR31oWzRnEVFzFrBE4FTavW2EmejpfTjA5oU9fIWUY9po7ZL9aIDKR P/Sr677/2krmx4DfE34yRum1SEl8Ko7pvg+s2uVikJr88nJHdUL+r7do4o2TSg35uFSuUL BcoF+qSQabLwYvCeyR1iUq5bxQ6V72Ljii0jrtd2l4MwLB1vXAGZ0gWMIoix/RoSZV5MAB QbesSMWNuKi+KRBIDrosDpSG7NWnQAIQSJAxk45kZquUTH/NCHUmSEu98M8pCw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1737635948; a=rsa-sha256; cv=none; b=GssApfCfSrWiT9HSnqvc509sCqV8F+w9V7hKFTotbWzgRKBI4sovlqDkKYD0i5mTImD20K ruqmB9P0aiwe/AqpFidnKXjs4n0mStdDwGQGqdXZeOR/GBvt5hf/0Y+VQOAvJiv2IAeBr4 R507Z+tMxh/kQ8Fpy7POT49DDnf2jNE4dchEswODZBZU9H92GRjDKm3NoE1/cZC/5grFDm pluqy169wiCcPrwrVLLCrrFVvq5kBgKJDJ7M3aXEPBb8PpBJl376FN/Y/UYx3H2ai/W7TG KMElHwWBqVTOhboNiiXL2KETr883ML5EdyxBmVdCkT4l6IbnRIrDRij5aA7s9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Yf0qw62wdzflx; Thu, 23 Jan 2025 12:39:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50NCd8Qh076958; Thu, 23 Jan 2025 12:39:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50NCd8Qi076955; Thu, 23 Jan 2025 12:39:08 GMT (envelope-from git) Date: Thu, 23 Jan 2025 12:39:08 GMT Message-Id: <202501231239.50NCd8Qi076955@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: e02b579b5379 - main - sound tests: Fix 32bit calculation detection in pcm_read_write List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e02b579b537998495b06d02be6aa07f03db3a42a Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=e02b579b537998495b06d02be6aa07f03db3a42a commit e02b579b537998495b06d02be6aa07f03db3a42a Author: Florian Walpen AuthorDate: 2025-01-23 12:38:00 +0000 Commit: Christos Margiolis CommitDate: 2025-01-23 12:38:00 +0000 sound tests: Fix 32bit calculation detection in pcm_read_write Fix a mistake in the pcm_read_write test that would result in not properly detecting 32bit calculation on 32bit architectures like i386. As a consequence, the wrong values would be checked, thus failing the test. Reported by: CI Fixes: 27ef5d48c729 ("sound: Unit test the pcm sample read and write macros") MFC after: 1 week Reviewed by: christos Differential Revision: https://reviews.freebsd.org/D48617 --- tests/sys/sound/pcm_read_write.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/sys/sound/pcm_read_write.c b/tests/sys/sound/pcm_read_write.c index e40ce52b67cc..7ef310a35c25 100644 --- a/tests/sys/sound/pcm_read_write.c +++ b/tests/sys/sound/pcm_read_write.c @@ -95,8 +95,14 @@ local_normalize(intpcm_t value, int val_bits, int norm_bits) static intpcm_t local_calc_limit(intpcm_t value, int val_bits) { - /* Avoid implementation defined behavior. */ - if (sizeof(intpcm32_t) == 32 && val_bits == 32) + /* + * When intpcm32_t is defined to be 32bit, calculations for mixing and + * volume changes use 32bit integers instead of 64bit. To get some + * headroom for calculations, 32bit sample values are restricted to + * 24bit magnitude in that case. Also avoid implementation defined + * behavior here. + */ + if (sizeof(intpcm32_t) == (32 / 8) && val_bits == 32) /* Divide instead of right shift (value may be negative). */ return (value / (1 << 8)); return value; @@ -456,7 +462,7 @@ ATF_TC_BODY(pcm_write, tc) } local_pcm_write_calc(dst, value, test->format); ATF_CHECK_MSG(memcmp(dst, expected, sizeof(dst)) == 0, - "pcm_write[\"%s\"].value: " + "pcm_write[\"%s\"].calc: " "expected={0x%02x, 0x%02x, 0x%02x, 0x%02x}, " "result={0x%02x, 0x%02x, 0x%02x, 0x%02x}, ", test->label, expected[0], expected[1], expected[2], expected[3],