From owner-dev-commits-src-branches@freebsd.org Thu Apr 22 11:08:31 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9267F5EBE1B; Thu, 22 Apr 2021 11:08:31 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FQvmb09vyz3kjr; Thu, 22 Apr 2021 11:08:30 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2C4A618AC6; Thu, 22 Apr 2021 11:08:30 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 13MB8Uov088641; Thu, 22 Apr 2021 11:08:30 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13MB8U5Q088640; Thu, 22 Apr 2021 11:08:30 GMT (envelope-from git) Date: Thu, 22 Apr 2021 11:08:30 GMT Message-Id: <202104221108.13MB8U5Q088640@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Alex Richardson Subject: git: 1f7e87f2d322 - stable/13 - lib/msun/tests: Skip fenv_test:masking if exceptions can't be trapped MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arichardson X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 1f7e87f2d322512a055ca95fdff2e15fc21d243e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Apr 2021 11:08:31 -0000 The branch stable/13 has been updated by arichardson: URL: https://cgit.FreeBSD.org/src/commit/?id=1f7e87f2d322512a055ca95fdff2e15fc21d243e commit 1f7e87f2d322512a055ca95fdff2e15fc21d243e Author: Alex Richardson AuthorDate: 2021-03-22 11:53:40 +0000 Commit: Alex Richardson CommitDate: 2021-04-22 09:44:50 +0000 lib/msun/tests: Skip fenv_test:masking if exceptions can't be trapped Some CPUs (e.g. AArch64 QEMU) cannot trap on floating point exceptions and therefore ignore the writes to the floating point control register inside feenableexcept(). If no exceptions are enabled after feenableexcept(FE_ALL_EXCEPT), we can assume that the CPU does not support exceptions and we can then skip the test. Reviewed By: dim Differential Revision: https://reviews.freebsd.org/D29095 (cherry picked from commit 2b9dbcd390dfbd573d3403360a36c5ade9815266) --- lib/msun/tests/fenv_test.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/msun/tests/fenv_test.c b/lib/msun/tests/fenv_test.c index 76998a7cb2d5..f275f0725504 100644 --- a/lib/msun/tests/fenv_test.c +++ b/lib/msun/tests/fenv_test.c @@ -392,7 +392,27 @@ ATF_TC_BODY(masking, tc) int except, pass, raise, status; unsigned i; - ATF_CHECK_EQ(0, (fegetexcept() & ALL_STD_EXCEPT)); + ATF_REQUIRE_EQ(0, (fegetexcept() & ALL_STD_EXCEPT)); + + /* + * Some CPUs, e.g. AArch64 QEMU does not support trapping on FP + * exceptions. In that case the trap enable bits are all RAZ/WI, so + * writing to those bits will be ignored and the the next read will + * return all zeroes for those bits. Skip the test if no floating + * point exceptions are supported and mark it XFAIL if some are missing. + */ + ATF_REQUIRE_EQ(0, (feenableexcept(FE_ALL_EXCEPT))); + except = fegetexcept(); + if (except == 0) { + atf_tc_skip("CPU does not support trapping on floating point " + "exceptions."); + } else if ((except & ALL_STD_EXCEPT) != ALL_STD_EXCEPT) { + atf_tc_expect_fail("Not all floating point exceptions can be " + "set to trap: %#x vs %#x", except, ALL_STD_EXCEPT); + } + fedisableexcept(FE_ALL_EXCEPT); + + ATF_CHECK_EQ(0, (feenableexcept(FE_INVALID|FE_OVERFLOW) & ALL_STD_EXCEPT)); ATF_CHECK_EQ((FE_INVALID | FE_OVERFLOW), (feenableexcept(FE_UNDERFLOW) & ALL_STD_EXCEPT)); ATF_CHECK_EQ((FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW), (fedisableexcept(FE_OVERFLOW) & ALL_STD_EXCEPT));