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
This commit is contained in:
Alex Richardson 2021-02-23 09:38:57 +00:00
parent a7ac518bff
commit f3f7b0dc06

View File

@ -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