Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Feb 2021 09:46:27 GMT
From:      Alex Richardson <arichardson@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: f3f7b0dc065c - main - lib/msun/ctrig_test: Print the mismatched values on failure
Message-ID:  <202102230946.11N9kRKX088151@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=f3f7b0dc065ce30f29b221788c58079d78931a77

commit f3f7b0dc065ce30f29b221788c58079d78931a77
Author:     Alex Richardson <arichardson@FreeBSD.org>
AuthorDate: 2021-02-23 09:38:57 +0000
Commit:     Alex Richardson <arichardson@FreeBSD.org>
CommitDate: 2021-02-23 09:39:40 +0000

    lib/msun/ctrig_test: Print the mismatched values on failure
    
    This test fails on aarch64 but debugging it is difficult without the
    results being printed.
    
    Now the failing AArch64 test prints:
    root@freebsd-aarch64:/nfsroot/usr/tests/lib/msun # kyua debug ctrig_test:test_nan_inputs
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: (ctan)(_d) (0 + -1 I) != expected (-0 + -1 I)
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: ctan fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: (ctan)(_d) (0 + 1 I) != expected (-0 + 1 I)
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: ctan fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: (ctanf)(_d) (0 + -1 I) != expected (-0 + -1 I)
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: ctanf fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: (ctanf)(_d) (0 + 1 I) != expected (-0 + 1 I)
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:211: ctanf fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: (ctanh)(_d) (1 + 0 I) != expected (1 + -0 I)
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: ctanh fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: (ctanhf)(_d) (1 + 0 I) != expected (1 + -0 I)
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: ctanhf fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: (ctanh)(_d) (-1 + 0 I) != expected (-1 + -0 I)
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: ctanh fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: (ctanhf)(_d) (-1 + 0 I) != expected (-1 + -0 I)
    *** Check failed: /local/scratch/alr48/cheri/freebsd/lib/msun/tests/ctrig_test.c:217: ctanhf fetestexcept((0x00000002 | 0x00000010 | 0x00000001 | 0x00000004 | 0x00000008)) (0x10) != 0
    ctrig_test:test_nan_inputs  ->  failed: 16 checks failed; see output for more details
    
    Reviewed By:    ngie
    Differential Revision: https://reviews.freebsd.org/D28788
---
 lib/msun/tests/ctrig_test.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/lib/msun/tests/ctrig_test.c b/lib/msun/tests/ctrig_test.c
index b40373fed29b..2499e53ab4d5 100644
--- a/lib/msun/tests/ctrig_test.c
+++ b/lib/msun/tests/ctrig_test.c
@@ -58,14 +58,22 @@ __FBSDID("$FreeBSD$");
  * XXX The volatile here is to avoid gcc's bogus constant folding and work
  *     around the lack of support for the FENV_ACCESS pragma.
  */
-#define	test_p(func, z, result, exceptmask, excepts, checksign)	do {	\
-	volatile long double complex _d = z;				\
-	debug("  testing %s(%Lg + %Lg I) == %Lg + %Lg I\n", #func,	\
-	    creall(_d), cimagl(_d), creall(result), cimagl(result));	\
-	ATF_CHECK(feclearexcept(FE_ALL_EXCEPT) == 0);			\
-	ATF_CHECK(cfpequal_cs((func)(_d), (result), (checksign)));		\
-	ATF_CHECK(((void)(func), fetestexcept(exceptmask) == (excepts)));	\
-} while (0)
+#define test_p(func, z, result, exceptmask, excepts, checksign)			\
+	do {									\
+		volatile long double complex _d = z;				\
+		debug("  testing %s(%Lg + %Lg I) == %Lg + %Lg I\n", #func,	\
+		    creall(_d), cimagl(_d), creall(result), cimagl(result));	\
+		ATF_CHECK(feclearexcept(FE_ALL_EXCEPT) == 0);			\
+		volatile long double complex _r = (func)(_d);			\
+		ATF_CHECK_MSG(cfpequal_cs(_r, (result), (checksign)),		\
+		    "%s (%Lg + %Lg I) != expected (%Lg + %Lg I)",		\
+		    __XSTRING((func)(_d)), creall(_r), cimagl(_r),		\
+		    creall(result), cimagl(result));				\
+		volatile int _e = fetestexcept(exceptmask);			\
+		ATF_CHECK_MSG(_e == (excepts),					\
+		    "%s fetestexcept(%s) (%#x) != %#x",	__XSTRING(func),	\
+		    __XSTRING(exceptmask), _e, (excepts));			\
+	} while (0)
 
 /*
  * Test within a given tolerance.  The tolerance indicates relative error



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102230946.11N9kRKX088151>