diff --git a/contrib/netbsd-tests/lib/libm/t_fe_round.c b/contrib/netbsd-tests/lib/libm/t_fe_round.c index 33da289eb156b0..58d1dbfc0e3747 100644 --- a/contrib/netbsd-tests/lib/libm/t_fe_round.c +++ b/contrib/netbsd-tests/lib/libm/t_fe_round.c @@ -72,23 +72,26 @@ ATF_TC_HEAD(fe_round, tc) ATF_TC_BODY(fe_round, tc) { +#if defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif long int received; for (unsigned int i = 0; i < __arraycount(values); i++) { fesetround(values[i].round_mode); received = lrint(values[i].input); - ATF_CHECK_MSG( + ATF_REQUIRE_MSG( (labs(received - values[i].expected) < EPSILON), - "lrint rounding wrong, difference too large\n" - "input: %f (index %d): got %ld, expected %ld\n", + "lrint rounding wrong, difference too large. " + "input: %f (index %d): got %ld, expected %ld", values[i].input, i, received, values[i].expected); /* Do we get the same rounding mode out? */ - ATF_CHECK_MSG( + ATF_REQUIRE_MSG( (fegetround() == values[i].round_mode), - "Didn't get the same rounding mode out!\n" - "(index %d) fed in %d rounding mode, got %d out\n", + "Didn't get the same rounding mode out!. " + "(index %d) fed in %d rounding mode, got %d out", i, values[i].round_mode, fegetround()); } } @@ -109,15 +112,15 @@ ATF_TC_BODY(fe_nearbyint, tc) received = nearbyint(values[i].input); ATF_CHECK_MSG( (fabs(received - values[i].expected) < EPSILON), - "nearbyint rounding wrong, difference too large\n" - "input: %f (index %d): got %f, expected %ld\n", + "nearbyint rounding wrong, difference too large. " + "input: %f (index %d): got %f, expected %ld", values[i].input, i, received, values[i].expected); /* Do we get the same rounding mode out? */ ATF_CHECK_MSG( (fegetround() == values[i].round_mode), - "Didn't get the same rounding mode out!\n" - "(index %d) fed in %d rounding mode, got %d out\n", + "Didn't get the same rounding mode out! " + "(index %d) fed in %d rounding mode, got %d out", i, values[i].round_mode, fegetround()); } } @@ -151,8 +154,8 @@ ATF_TC_BODY(fe_nextafter, tc) } ATF_CHECK_MSG( res && (fabs(received - values2[i].expected) < EPSILON), - "nextafter() rounding wrong, difference too large\n" - "input: %f (index %d): got %f, expected %f, res %d\n", + "nextafter() rounding wrong, difference too large. " + "input: %f (index %d): got %f, expected %f, res %d", values2[i].input, i, received, values2[i].expected, res); } } @@ -177,8 +180,8 @@ ATF_TC_BODY(fe_nexttoward, tc) } ATF_CHECK_MSG( res && (fabs(received - values2[i].expected) < EPSILON), - "nexttoward() rounding wrong, difference too large\n" - "input: %f (index %d): got %f, expected %f, res %d\n", + "nexttoward() rounding wrong, difference too large. " + "input: %f (index %d): got %f, expected %f, res %d", values2[i].input, i, received, values2[i].expected, res); } } diff --git a/lib/msun/tests/cexp_test.c b/lib/msun/tests/cexp_test.c index 35b23990a3f365..a32872958c42b8 100644 --- a/lib/msun/tests/cexp_test.c +++ b/lib/msun/tests/cexp_test.c @@ -232,6 +232,9 @@ ATF_TC_BODY(imaginaries, tc) ATF_TC_WITHOUT_HEAD(small); ATF_TC_BODY(small, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif static const double tests[] = { /* csqrt(a + bI) = x + yI */ /* a b x y */ diff --git a/lib/msun/tests/ctrig_test.c b/lib/msun/tests/ctrig_test.c index ac1b79f2a1ce05..778612430c9352 100644 --- a/lib/msun/tests/ctrig_test.c +++ b/lib/msun/tests/ctrig_test.c @@ -302,6 +302,9 @@ ATF_TC_HEAD(test_axes, tc) } ATF_TC_BODY(test_axes, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif static const long double nums[] = { M_PI / 4, M_PI / 2, 3 * M_PI / 4, 5 * M_PI / 4, 3 * M_PI / 2, 7 * M_PI / 4, @@ -323,9 +326,9 @@ ATF_TC_BODY(test_axes, tc) test_odd_tol(csinhf, z, CMPLXL(sinhf(nums[i]), 0), FLT_ULP()); test_even_tol(ccoshf, z, CMPLXL(coshf(nums[i]), 0), FLT_ULP()); - printf("%a %a\n", creal(z), cimag(z)); - printf("%a %a\n", creal(ctanhf(z)), cimag(ctanhf(z))); - printf("%a\n", nextafterf(tanhf(nums[i]), INFINITY)); + debug("%a %a\n", creal(z), cimag(z)); + debug("%a %a\n", creal(ctanhf(z)), cimag(ctanhf(z))); + debug("%a\n", nextafterf(tanhf(nums[i]), INFINITY)); test_odd_tol(ctanhf, z, CMPLXL(tanhf(nums[i]), 0), 1.3 * FLT_ULP()); test_odd_tol(csinf, z, CMPLXL(sinf(nums[i]), @@ -365,6 +368,9 @@ ATF_TC_HEAD(test_small_inputs, tc) } ATF_TC_BODY(test_small_inputs, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif /* * z = 0.5 + i Pi/4 * sinh(z) = (sinh(0.5) + i cosh(0.5)) * sqrt(2)/2 @@ -432,6 +438,9 @@ ATF_TC_HEAD(test_large_inputs, tc) } ATF_TC_BODY(test_large_inputs, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif long double complex z; /* tanh() uses a threshold around x=22, so check both sides. */ diff --git a/lib/msun/tests/exponential_test.c b/lib/msun/tests/exponential_test.c index 9dc3b2698744a8..c3dcca869dcb4d 100644 --- a/lib/msun/tests/exponential_test.c +++ b/lib/msun/tests/exponential_test.c @@ -159,6 +159,9 @@ ATF_TC_BODY(exp2l, tc) ATF_TC_WITHOUT_HEAD(generic); ATF_TC_BODY(generic, tc) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif run_generic_tests(); } diff --git a/lib/msun/tests/fma_test.c b/lib/msun/tests/fma_test.c index f1aa855df6f2e0..ec57fc34c1b19c 100644 --- a/lib/msun/tests/fma_test.c +++ b/lib/msun/tests/fma_test.c @@ -121,6 +121,9 @@ test_zeroes(void) static void test_infinities(void) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif testall(INFINITY, 1.0, -1.0, INFINITY, ALL_STD_EXCEPT, 0); testall(-1.0, INFINITY, 0.0, -INFINITY, ALL_STD_EXCEPT, 0); testall(0.0, 0.0, INFINITY, INFINITY, ALL_STD_EXCEPT, 0); @@ -471,8 +474,11 @@ static const int rmodes[] = { ATF_TC_WITHOUT_HEAD(zeroes); ATF_TC_BODY(zeroes, tc) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif for (size_t i = 0; i < nitems(rmodes); i++) { - printf("rmode = %d\n", rmodes[i]); + debug("rmode = %d\n", rmodes[i]); fesetround(rmodes[i]); test_zeroes(); } @@ -481,8 +487,11 @@ ATF_TC_BODY(zeroes, tc) ATF_TC_WITHOUT_HEAD(infinities); ATF_TC_BODY(infinities, tc) { +#if defined(__powerpc64__) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif for (size_t i = 0; i < nitems(rmodes); i++) { - printf("rmode = %d\n", rmodes[i]); + debug("rmode = %d\n", rmodes[i]); fesetround(rmodes[i]); test_infinities(); } @@ -500,7 +509,7 @@ ATF_TC_WITHOUT_HEAD(small_z); ATF_TC_BODY(small_z, tc) { for (size_t i = 0; i < nitems(rmodes); i++) { - printf("rmode = %d\n", rmodes[i]); + debug("rmode = %d\n", rmodes[i]); fesetround(rmodes[i]); test_small_z(); } @@ -511,7 +520,7 @@ ATF_TC_WITHOUT_HEAD(big_z); ATF_TC_BODY(big_z, tc) { for (size_t i = 0; i < nitems(rmodes); i++) { - printf("rmode = %d\n", rmodes[i]); + debug("rmode = %d\n", rmodes[i]); fesetround(rmodes[i]); test_big_z(); } diff --git a/lib/msun/tests/fmaxmin_test.c b/lib/msun/tests/fmaxmin_test.c index 51956b1084afea..85a105a7f44fe1 100644 --- a/lib/msun/tests/fmaxmin_test.c +++ b/lib/msun/tests/fmaxmin_test.c @@ -50,7 +50,7 @@ CHECK_FP_EXCEPTIONS_MSG(0, ALL_STD_EXCEPT, \ #func "(%.20Lg, %.20Lg) rmode%d", (x), (y), rmode); \ ATF_CHECK_MSG(fpequal_cs(__result, (expected), true), \ - #func "(%.20Lg, %.20Lg) rmode%d = %.20Lg, expected %.20Lg\n", \ + #func "(%.20Lg, %.20Lg) rmode%d = %.20Lg, expected %.20Lg", \ (x), (y), rmode, __result, (expected)); \ } while (0) diff --git a/lib/msun/tests/invctrig_test.c b/lib/msun/tests/invctrig_test.c index 18d59e6f541654..8380557f02b63f 100644 --- a/lib/msun/tests/invctrig_test.c +++ b/lib/msun/tests/invctrig_test.c @@ -123,6 +123,9 @@ c3pi = 9.42477796076937971538793014983850839L; ATF_TC_WITHOUT_HEAD(zero); ATF_TC_BODY(zero, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif long double complex zero = CMPLXL(0.0, 0.0); testall_tol(cacosh, zero, CMPLXL(0.0, pi / 2), 1); @@ -143,6 +146,9 @@ ATF_TC_BODY(zero, tc) ATF_TC_WITHOUT_HEAD(nan); ATF_TC_BODY(nan, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif long double complex nan_nan = CMPLXL(NAN, NAN); long double complex z; @@ -222,6 +228,9 @@ ATF_TC_BODY(nan, tc) ATF_TC_WITHOUT_HEAD(inf); ATF_TC_BODY(inf, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif long double complex z; /* @@ -269,6 +278,9 @@ ATF_TC_BODY(inf, tc) ATF_TC_WITHOUT_HEAD(axes); ATF_TC_BODY(axes, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif static const long double nums[] = { -2, -1, -0.5, 0.5, 1, 2 }; @@ -306,6 +318,9 @@ ATF_TC_BODY(axes, tc) ATF_TC_WITHOUT_HEAD(small); ATF_TC_BODY(small, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif /* * z = 0.75 + i 0.25 * acos(z) = Pi/4 - i ln(2)/2 diff --git a/lib/msun/tests/invtrig_test.c b/lib/msun/tests/invtrig_test.c index 8c6fdb7c6e2fd7..76fbd33bf73edc 100644 --- a/lib/msun/tests/invtrig_test.c +++ b/lib/msun/tests/invtrig_test.c @@ -52,8 +52,8 @@ #define test_tol(func, x, result, tol, excepts) do { \ volatile long double _in = (x), _out = (result); \ ATF_REQUIRE_EQ(0, feclearexcept(FE_ALL_EXCEPT)); \ - CHECK_FPEQUAL_TOL(func(_in), _out, (tol), CS_BOTH); \ - CHECK_FP_EXCEPTIONS_MSG(excepts, ALL_STD_EXCEPT, "for %s(%s)", \ + REQUIRE_FPEQUAL_TOL(func(_in), _out, (tol), CS_BOTH); \ + REQUIRE_FP_EXCEPTIONS_MSG(excepts, ALL_STD_EXCEPT, "for %s(%s)", \ #func, #x); \ } while (0) #define test(func, x, result, excepts) \ @@ -82,8 +82,8 @@ #define test2_tol(func, y, x, result, tol, excepts) do { \ volatile long double _iny = (y), _inx = (x), _out = (result); \ ATF_REQUIRE_EQ(0, feclearexcept(FE_ALL_EXCEPT)); \ - CHECK_FPEQUAL_TOL(func(_iny, _inx), _out, (tol), CS_BOTH); \ - CHECK_FP_EXCEPTIONS_MSG(excepts, ALL_STD_EXCEPT, "for %s(%s)", \ + REQUIRE_FPEQUAL_TOL(func(_iny, _inx), _out, (tol), CS_BOTH); \ + REQUIRE_FP_EXCEPTIONS_MSG(excepts, ALL_STD_EXCEPT, "for %s(%s)", \ #func, #x); \ } while (0) #define test2(func, y, x, result, excepts) \ @@ -125,7 +125,9 @@ sqrt2m1 = 4.14213562373095048801688724209698081e-01L; ATF_TC_WITHOUT_HEAD(special); ATF_TC_BODY(special, tc) { - +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/283017"); +#endif testall(asin, 0.0, 0.0, 0); testall(acos, 0.0, pi / 2, FE_INEXACT); testall(atan, 0.0, 0.0, 0); @@ -238,7 +240,9 @@ ATF_TC_BODY(special_atan2, tc) ATF_TC_WITHOUT_HEAD(accuracy); ATF_TC_BODY(accuracy, tc) { - +#if defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif /* We expect correctly rounded results for these basic cases. */ testall(asin, 1.0, pi / 2, FE_INEXACT); testall(acos, 1.0, 0, 0); @@ -276,7 +280,9 @@ ATF_TC_BODY(accuracy, tc) ATF_TC_WITHOUT_HEAD(p2x_atan2); ATF_TC_BODY(p2x_atan2, tc) { - +#if defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif testall2(atan2, 1.0, 1.0, pi / 4, FE_INEXACT); testall2(atan2, 1.0, -1.0, c3pi / 4, FE_INEXACT); testall2(atan2, -1.0, 1.0, -pi / 4, FE_INEXACT); @@ -299,6 +305,9 @@ ATF_TC_BODY(p2x_atan2, tc) ATF_TC_WITHOUT_HEAD(tiny); ATF_TC_BODY(tiny, tc) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/283017"); +#endif float tiny = 0x1.23456p-120f; testall(asin, tiny, tiny, FE_INEXACT); @@ -436,6 +445,9 @@ tanatanl(long double x) ATF_TC_WITHOUT_HEAD(inverse); ATF_TC_BODY(inverse, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif float i; for (i = -1; i <= 1; i += 0x1.0p-12f) { diff --git a/lib/msun/tests/logarithm_test.c b/lib/msun/tests/logarithm_test.c index de80b5b4561578..df1fcdc8627d06 100644 --- a/lib/msun/tests/logarithm_test.c +++ b/lib/msun/tests/logarithm_test.c @@ -92,7 +92,9 @@ ATF_TC_WITHOUT_HEAD(generic_tests); ATF_TC_BODY(generic_tests, tc) { - +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif /* log(1) == 0, no exceptions raised */ testall0(1.0, 0.0, ALL_STD_EXCEPT, 0); testall1(0.0, 0.0, ALL_STD_EXCEPT, 0); @@ -179,6 +181,9 @@ ATF_TC_BODY(roundingmode_tests, tc) ATF_TC_WITHOUT_HEAD(accuracy_tests); ATF_TC_BODY(accuracy_tests, tc) { +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif static const struct { float x; long double log2x; @@ -248,7 +253,9 @@ ATF_TC_BODY(log1p_accuracy_tests, tc) if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) atf_tc_expect_fail("https://bugs.freebsd.org/253984"); #endif - +#if defined(__riscv) + atf_tc_expect_death("https://bugs.freebsd.org/290099"); +#endif test_tol(log1pf, 0x0.333333p0F, 1.82321546859847114303367992804596800640e-1L, FLT_ULP()); test_tol(log1p, 0x0.3333333333333p0, diff --git a/lib/msun/tests/lrint_test.c b/lib/msun/tests/lrint_test.c index 29ba822226421f..a3f4225dc56990 100644 --- a/lib/msun/tests/lrint_test.c +++ b/lib/msun/tests/lrint_test.c @@ -41,9 +41,9 @@ #include "test-utils.h" #define test(func, x, result, excepts) do { \ - ATF_CHECK(feclearexcept(FE_ALL_EXCEPT) == 0); \ + ATF_REQUIRE(feclearexcept(FE_ALL_EXCEPT) == 0); \ long long _r = (func)(x); \ - ATF_CHECK_MSG(_r == (result) || fetestexcept(FE_INVALID), \ + ATF_REQUIRE_MSG(_r == (result) || fetestexcept(FE_INVALID), \ #func "(%Lg) returned %lld, expected %lld", (long double)x, _r, \ (long long)(result)); \ CHECK_FP_EXCEPTIONS_MSG(excepts, FE_ALL_EXCEPT & ALL_STD_EXCEPT, \ @@ -131,6 +131,9 @@ run_tests(void) ATF_TC_WITHOUT_HEAD(lrint); ATF_TC_BODY(lrint, tc) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif run_tests(); #ifdef __i386__ fpsetprec(FP_PE); diff --git a/lib/msun/tests/lround_test.c b/lib/msun/tests/lround_test.c index a616726170814c..e22f59c323a2fe 100644 --- a/lib/msun/tests/lround_test.c +++ b/lib/msun/tests/lround_test.c @@ -65,6 +65,9 @@ ATF_TC_WITHOUT_HEAD(main); ATF_TC_BODY(main, tc) { +#if defined(__powerpc64__) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif testall(0.0, 0, 0); testall(0.25, 0, FE_INEXACT); testall(0.5, 1, FE_INEXACT); diff --git a/lib/msun/tests/nan_test.c b/lib/msun/tests/nan_test.c index 32c5c39af0c1ca..3dcea3f9e4024f 100644 --- a/lib/msun/tests/nan_test.c +++ b/lib/msun/tests/nan_test.c @@ -105,6 +105,9 @@ testnan(const char *nan_format) ATF_TC_WITHOUT_HEAD(nan); ATF_TC_BODY(nan, tc) { +#if defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif /* Die if a signalling NaN is returned */ feenableexcept(FE_INVALID); diff --git a/lib/msun/tests/nearbyint_test.c b/lib/msun/tests/nearbyint_test.c index 749c2bb23c99ff..fa1dc7d739bed4 100644 --- a/lib/msun/tests/nearbyint_test.c +++ b/lib/msun/tests/nearbyint_test.c @@ -152,6 +152,9 @@ test_modf(int testindex) ATF_TC_WITHOUT_HEAD(nearbyint); ATF_TC_BODY(nearbyint, tc) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif unsigned i; for (i = 0; i < nitems(tests); i++) { diff --git a/lib/msun/tests/next_test.c b/lib/msun/tests/next_test.c index 282e47d783a067..a14b1ba433d99e 100644 --- a/lib/msun/tests/next_test.c +++ b/lib/msun/tests/next_test.c @@ -79,6 +79,9 @@ static const long double ldbl_eps = LDBL_EPSILON; ATF_TC_WITHOUT_HEAD(zeros); ATF_TC_BODY(zeros, tc) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif long double ldbl_small; #ifdef __i386__ @@ -164,6 +167,9 @@ ATF_TC_BODY(ordinary, tc) ATF_TC_WITHOUT_HEAD(boundaries); ATF_TC_BODY(boundaries, tc) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif /* * Tests at word boundaries, normalization boundaries, etc. */ @@ -211,6 +217,9 @@ ATF_TC_BODY(boundaries, tc) ATF_TC_WITHOUT_HEAD(overflow); ATF_TC_BODY(overflow, tc) { +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif long double ldbl_max; /* * We can't use a compile-time constant here because gcc on diff --git a/lib/msun/tests/test-utils.h b/lib/msun/tests/test-utils.h index 0a926551639cd7..984833605fe8cd 100644 --- a/lib/msun/tests/test-utils.h +++ b/lib/msun/tests/test-utils.h @@ -144,21 +144,20 @@ fpequal_tol(long double x, long double y, long double tol, return (ret); } -#define CHECK_FPEQUAL(x, y) CHECK_FPEQUAL_CS(x, y, true) - -#define CHECK_FPEQUAL_CS(x, y, checksign) do { \ +#define _fpequal_cs(atf_variant, x, y, checksign) do { \ long double _x = x; \ long double _y = y; \ - ATF_CHECK_MSG(fpequal_cs(_x, _y, checksign), \ + ATF_##atf_variant##_MSG(fpequal_cs(_x, _y, checksign), \ "%s (%.25Lg) ~= %s (%.25Lg)", #x, _x, #y, _y); \ } while (0) -#define CHECK_FPEQUAL_TOL(x, y, tol, flags) do { \ +#define _fpequal_tol(atf_variant, x, y, tol, flags) do { \ long double _x = x; \ long double _y = y; \ bool eq = fpequal_tol(_x, _y, tol, flags); \ long double _diff = eq ? 0.0L : fabsl(_x - _y); \ - ATF_CHECK_MSG(eq, "%s (%.25Lg) ~= %s (%.25Lg), diff=%Lg, maxdiff=%Lg,", \ + ATF_##atf_variant##_MSG(eq, \ + "%s (%.25Lg) ~= %s (%.25Lg), diff=%Lg, maxdiff=%Lg,", \ #x, _x, #y, _y, _diff, fabsl(_y * tol)); \ } while (0) @@ -170,32 +169,48 @@ cfpequal(long double complex d1, long double complex d2) fpequal_cs(cimagl(d1), cimagl(d2), true)); } -#define CHECK_CFPEQUAL_CS(x, y, checksign) do { \ +#define _cfpequal_cs(atf_variant, x, y, checksign) do { \ long double _x = x; \ long double _y = y; \ bool equal_cs = \ fpequal_cs(creal(_x), creal(_y), (checksign & CS_REAL) != 0) && \ fpequal_cs(cimag(_x), cimag(_y), (checksign & CS_IMAG) != 0); \ - ATF_CHECK_MSG(equal_cs, "%s (%Lg + %Lg I) ~= %s (%Lg + %Lg I)", \ + ATF_##atf_variant##_MSG(equal_cs, \ + "%s (%Lg + %Lg I) ~= %s (%Lg + %Lg I)", \ #x, creall(_x), cimagl(_x), #y, creall(_y), cimagl(_y)); \ } while (0) -#define CHECK_CFPEQUAL_TOL(x, y, tol, flags) do { \ +#define _cfpequal_tol(atf_variant, x, y, tol, flags) do { \ long double _x = x; \ long double _y = y; \ bool equal_tol = (fpequal_tol(creal(_x), creal(_y), tol, flags) && \ fpequal_tol(cimag(_x), cimag(_y), tol, flags)); \ - ATF_CHECK_MSG(equal_tol, "%s (%Lg + %Lg I) ~= %s (%Lg + %Lg I)", \ + ATF_##atf_variant##_MSG(equal_tol, \ + "%s (%Lg + %Lg I) ~= %s (%Lg + %Lg I)", \ #x, creall(_x), cimagl(_x), #y, creall(_y), cimagl(_y)); \ } while (0) -#define CHECK_FP_EXCEPTIONS(excepts, exceptmask) \ - ATF_CHECK_EQ_MSG((excepts), fetestexcept(exceptmask), \ - "unexpected exception flags: got %#x not %#x", \ +#define _fp_exceptions(atf_variant, excepts, exceptmask) \ + ATF_##atf_variant##_EQ_MSG((excepts), fetestexcept(exceptmask), \ + "unexpected exception flags: got %#x not %#x", \ fetestexcept(exceptmask), (excepts)) -#define CHECK_FP_EXCEPTIONS_MSG(excepts, exceptmask, fmt, ...) \ - ATF_CHECK_EQ_MSG((excepts), fetestexcept(exceptmask), \ +#define _fp_exceptions_msg(atf_variant, excepts, exceptmask, fmt, ...) \ + ATF_##atf_variant##_EQ_MSG((excepts), fetestexcept(exceptmask), \ "unexpected exception flags: got %#x not %#x " fmt, \ fetestexcept(exceptmask), (excepts), __VA_ARGS__) +#define CHECK_FP_EXCEPTIONS(excepts, exceptmask) _fp_exceptions(CHECK, excepts, exceptmask) +#define CHECK_FP_EXCEPTIONS_MSG(excepts, exceptmask, fmt, ...) _fp_exceptions_msg(CHECK, excepts, exceptmask, fmt, __VA_ARGS__) +#define CHECK_CFPEQUAL_TOL(x, y, tol, flags) _cfpequal_tol(CHECK, x, y, tol, flags) +#define CHECK_CFPEQUAL_CS(x, y, checksign) _cfpequal_cs(CHECK, x, y, checksign) +#define CHECK_FPEQUAL(x, y) _fpequal_cs(CHECK, x, y, true) +#define CHECK_FPEQUAL_TOL(x, y, tol, flags) _fpequal_tol(CHECK, x, y, tol, flags) + +#define REQUIRE_FP_EXCEPTIONS(excepts, exceptmask) _fp_exceptions(REQUIRE, excepts, exceptmask) +#define REQUIRE_FP_EXCEPTIONS_MSG(excepts, exceptmask, fmt, ...) _fp_exceptions_msg(REQUIRE, excepts, exceptmask, fmt, __VA_ARGS__) +#define REQUIRE_CFPEQUAL_TOL(x, y, tol, flags) _cfpequal_tol(REQUIRE, x, y, tol, flags) +#define REQUIRE_CFPEQUAL_CS(x, y, checksign) _cfpequal_cs(REQUIRE, x, y, checksign) +#define REQUIRE_FPEQUAL(x, y) _fpequal_cs(REQUIRE, x, y, true) +#define REQUIRE_FPEQUAL_TOL(x, y, tol, flags) _fpequal_tol(REQUIRE, x, y, tol, flags) + #endif /* _TEST_UTILS_H_ */ diff --git a/lib/msun/tests/trig_test.c b/lib/msun/tests/trig_test.c index fe8c5298093a22..494b5b10b64ccc 100644 --- a/lib/msun/tests/trig_test.c +++ b/lib/msun/tests/trig_test.c @@ -85,7 +85,9 @@ ATF_TC_HEAD(special, tc) } ATF_TC_BODY(special, tc) { - +#if defined(__aarch64__) || defined(__riscv) + atf_tc_expect_fail("https://bugs.freebsd.org/290099"); +#endif /* Values at 0 should be exact. */ testall(tan, 0.0, 0.0, ALL_STD_EXCEPT, 0); testall(tan, -0.0, -0.0, ALL_STD_EXCEPT, 0);