Page MenuHomeFreeBSD

D28798.id84282.diff
No OneTemporary

D28798.id84282.diff

Index: lib/msun/tests/Makefile
===================================================================
--- lib/msun/tests/Makefile
+++ lib/msun/tests/Makefile
@@ -63,7 +63,7 @@
TAP_TESTS_C+= ilogb2_test
TAP_TESTS_C+= invtrig_test
TAP_TESTS_C+= invctrig_test
-TAP_TESTS_C+= logarithm_test
+ATF_TESTS_C+= logarithm_test
TAP_TESTS_C+= lrint_test
# XXX: the testcase crashes on all platforms, but only on head
# (bug 205451)
Index: lib/msun/tests/logarithm_test.c
===================================================================
--- lib/msun/tests/logarithm_test.c
+++ lib/msun/tests/logarithm_test.c
@@ -42,6 +42,8 @@
#include <ieeefp.h>
#endif
+#include <atf-c.h>
+
#include "test-utils.h"
#pragma STDC FENV_ACCESS ON
@@ -59,24 +61,22 @@
* 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(func, x, result, exceptmask, excepts) do { \
- volatile long double _d = x; \
- assert(feclearexcept(FE_ALL_EXCEPT) == 0); \
- assert(fpequal((func)(_d), (result))); \
- assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \
-} while (0)
-
-#define test(func, x, result, exceptmask, excepts) do { \
- volatile long double _d = x; \
- assert(feclearexcept(FE_ALL_EXCEPT) == 0); \
- assert(fpequal((func)(_d), (result))); \
- assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \
+#define test(func, x, result, exceptmask, excepts) do { \
+ volatile long double _d = x; \
+ printf("%s:%d: intitial=%#x\n", __func__, __LINE__, fetestexcept(FE_INEXACT)); \
+ ATF_CHECK_EQ(0, feclearexcept(FE_ALL_EXCEPT)); \
+ printf("%s:%d: after clear inex=%#x\n", __func__, __LINE__, fetestexcept(FE_INEXACT)); \
+ ATF_CHECK(fpequal((func)(_d), (result))); \
+ printf("%s:%d: after func inex=%#x\n", __func__, __LINE__, fetestexcept(FE_INEXACT)); \
+ ATF_CHECK_EQ_MSG((excepts), fetestexcept(exceptmask), \
+ "unexpected exception flags for %s(%s): %#x not %#x", \
+ #func, #x, fetestexcept(exceptmask), (excepts)); \
} while (0)
#define test_tol(func, z, result, tol) do { \
volatile long double _d = z; \
debug(" testing %6s(%15La) ~= % .36Le\n", #func, _d, result); \
- assert(fpequal_tol((func)(_d), (result), (tol), CS_BOTH)); \
+ ATF_CHECK(fpequal_tol((func)(_d), (result), (tol), CS_BOTH)); \
} while (0)
/* Test all the functions that compute log(x). */
@@ -99,8 +99,8 @@
test(log1pl, x, result, exceptmask, excepts); \
} while (0)
-static void
-run_generic_tests(void)
+ATF_TC_WITHOUT_HEAD(generic_tests);
+ATF_TC_BODY(generic_tests, tc)
{
/* log(1) == 0, no exceptions raised */
@@ -128,8 +128,8 @@
testall1(-1.0, -INFINITY, ALL_STD_EXCEPT & ~FE_INEXACT, FE_DIVBYZERO);
}
-static void
-run_log2_tests(void)
+ATF_TC_WITHOUT_HEAD(log2_tests);
+ATF_TC_BODY(log2_tests, tc)
{
unsigned i;
@@ -155,8 +155,8 @@
}
}
-static void
-run_roundingmode_tests(void)
+ATF_TC_WITHOUT_HEAD(roundingmode_tests);
+ATF_TC_BODY(roundingmode_tests, tc)
{
/*
@@ -189,8 +189,8 @@
fesetround(FE_TONEAREST);
}
-static void
-run_accuracy_tests(void)
+ATF_TC_WITHOUT_HEAD(accuracy_tests);
+ATF_TC_BODY(accuracy_tests, tc)
{
static const struct {
float x;
@@ -243,10 +243,9 @@
}
}
-static void
-run_log1p_accuracy_tests(void)
+ATF_TC_WITHOUT_HEAD(log1p_accuracy_tests);
+ATF_TC_BODY(log1p_accuracy_tests, tc)
{
-
test_tol(log1pf, 0x0.333333p0F,
1.82321546859847114303367992804596800640e-1L, FLT_ULP());
test_tol(log1p, 0x0.3333333333333p0,
@@ -262,26 +261,14 @@
-2.23143551314209755752742563153765697950e-1L, LDBL_ULP());
}
-int
-main(void)
+ATF_TP_ADD_TCS(tp)
{
- printf("1..5\n");
-
- run_generic_tests();
- printf("ok 1 - logarithm\n");
-
- run_log2_tests();
- printf("ok 2 - logarithm\n");
-
- run_roundingmode_tests();
- printf("ok 3 - logarithm\n");
-
- run_accuracy_tests();
- printf("ok 4 - logarithm\n");
-
- run_log1p_accuracy_tests();
- printf("ok 5 - logarithm\n");
+ ATF_TP_ADD_TC(tp, generic_tests);
+ ATF_TP_ADD_TC(tp, log2_tests);
+ ATF_TP_ADD_TC(tp, roundingmode_tests);
+ ATF_TP_ADD_TC(tp, accuracy_tests);
+ ATF_TP_ADD_TC(tp, log1p_accuracy_tests);
- return (0);
+ return (atf_no_error());
}

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 20, 12:05 AM (4 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31810240
Default Alt Text
D28798.id84282.diff (4 KB)

Event Timeline