svn commit: r315118 - stable/11/lib/msun/tests
Ngie Cooper
ngie at FreeBSD.org
Sun Mar 12 04:40:03 UTC 2017
Author: ngie
Date: Sun Mar 12 04:40:01 2017
New Revision: 315118
URL: https://svnweb.freebsd.org/changeset/base/315118
Log:
MFC r305283,r314649:
r305283:
Skip :test_large on i386
More assertions are failing on ^/head now.
PR: 205446
r314649:
Convert lib/msun/ctrig_test from TAP to ATF
This is being done as a precursor for work needed to annontate failing
testcases with clang 4.0+.
PR: 217528
Modified:
stable/11/lib/msun/tests/Makefile
stable/11/lib/msun/tests/ctrig_test.c
Directory Properties:
stable/11/ (props changed)
Modified: stable/11/lib/msun/tests/Makefile
==============================================================================
--- stable/11/lib/msun/tests/Makefile Sun Mar 12 04:33:44 2017 (r315117)
+++ stable/11/lib/msun/tests/Makefile Sun Mar 12 04:40:01 2017 (r315118)
@@ -51,7 +51,7 @@ TAP_TESTS_C+= conj_test
# https://llvm.org/bugs/show_bug.cgi?id=26081
TAP_TESTS_C+= csqrt_test
.endif
-TAP_TESTS_C+= ctrig_test
+ATF_TESTS_C+= ctrig_test
TAP_TESTS_C+= exponential_test
TAP_TESTS_C+= fenv_test
TAP_TESTS_C+= fma_test
Modified: stable/11/lib/msun/tests/ctrig_test.c
==============================================================================
--- stable/11/lib/msun/tests/ctrig_test.c Sun Mar 12 04:33:44 2017 (r315117)
+++ stable/11/lib/msun/tests/ctrig_test.c Sun Mar 12 04:40:01 2017 (r315118)
@@ -31,13 +31,14 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include <assert.h>
#include <complex.h>
#include <fenv.h>
#include <float.h>
#include <math.h>
#include <stdio.h>
+#include <atf-c.h>
+
#include "test-utils.h"
#pragma STDC FENV_ACCESS ON
@@ -60,9 +61,9 @@ __FBSDID("$FreeBSD$");
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)); \
- assert(feclearexcept(FE_ALL_EXCEPT) == 0); \
- assert(cfpequal_cs((func)(_d), (result), (checksign))); \
- assert(((void)(func), fetestexcept(exceptmask) == (excepts))); \
+ ATF_CHECK(feclearexcept(FE_ALL_EXCEPT) == 0); \
+ ATF_CHECK(cfpequal_cs((func)(_d), (result), (checksign))); \
+ ATF_CHECK(((void)(func), fetestexcept(exceptmask) == (excepts))); \
} while (0)
/*
@@ -74,7 +75,7 @@ __FBSDID("$FreeBSD$");
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)); \
- assert(cfpequal_tol((func)(_d), (result), (tol), FPE_ABS_ZERO)); \
+ ATF_CHECK(cfpequal_tol((func)(_d), (result), (tol), FPE_ABS_ZERO)); \
} while (0)
/* These wrappers apply the identities f(conj(z)) = conj(f(z)). */
@@ -127,9 +128,12 @@ __FBSDID("$FreeBSD$");
} while (0)
-/* Tests for 0 */
-void
-test_zero(void)
+ATF_TC(test_zero_input);
+ATF_TC_HEAD(test_zero_input, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test 0 input");
+}
+ATF_TC_BODY(test_zero_input, tc)
{
long double complex zero = CMPLXL(0.0, 0.0);
@@ -142,11 +146,12 @@ test_zero(void)
testall_odd(ctan, zero, zero, ALL_STD_EXCEPT, 0, CS_BOTH);
}
-/*
- * Tests for NaN inputs.
- */
-void
-test_nan()
+ATF_TC(test_nan_inputs);
+ATF_TC_HEAD(test_nan_inputs, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test NaN inputs");
+}
+ATF_TC_BODY(test_nan_inputs, tc)
{
long double complex nan_nan = CMPLXL(NAN, NAN);
long double complex z;
@@ -222,8 +227,12 @@ test_nan()
testall_odd(ctan, z, nan_nan, OPT_INVALID, 0, 0);
}
-void
-test_inf(void)
+ATF_TC(test_inf_inputs);
+ATF_TC_HEAD(test_inf_inputs, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test infinity inputs");
+}
+ATF_TC_BODY(test_inf_inputs, tc)
{
static const long double finites[] = {
0, M_PI / 4, 3 * M_PI / 4, 5 * M_PI / 4,
@@ -287,9 +296,12 @@ test_inf(void)
testall_odd(ctan, z, CMPLXL(NAN, NAN), OPT_INEXACT, FE_INVALID, 0);
}
-/* Tests along the real and imaginary axes. */
-void
-test_axes(void)
+ATF_TC(test_axes);
+ATF_TC_HEAD(test_axes, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test along the real/imaginary axes");
+}
+ATF_TC_BODY(test_axes, tc)
{
static const long double nums[] = {
M_PI / 4, M_PI / 2, 3 * M_PI / 4,
@@ -347,8 +359,12 @@ test_axes(void)
}
}
-void
-test_small(void)
+ATF_TC(test_small_inputs);
+ATF_TC_HEAD(test_small_inputs, tc)
+{
+ atf_tc_set_md_var(tc, "descr", "test underflow inputs");
+}
+ATF_TC_BODY(test_small_inputs, tc)
{
/*
* z = 0.5 + i Pi/4
@@ -409,12 +425,20 @@ test_small(void)
}
}
-/* Test inputs that might cause overflow in a sloppy implementation. */
-void
-test_large(void)
+ATF_TC(test_large_inputs);
+ATF_TC_HEAD(test_large_inputs, tc)
+{
+ atf_tc_set_md_var(tc, "descr",
+ "Test inputs that might cause overflow in a sloppy implementation");
+}
+ATF_TC_BODY(test_large_inputs, tc)
{
long double complex z;
+#ifdef __i386__
+ atf_tc_expect_fail("test fails on i386 - bug 205446");
+#endif
+
/* tanh() uses a threshold around x=22, so check both sides. */
z = CMPLXL(21, 0.78539816339744830961566084581987572L);
testall_odd_tol(ctanh, z,
@@ -427,7 +451,6 @@ test_large(void)
test_odd_tol(ctanh, z,
CMPLXL(1.0, 8.95257245135025991216632140458264468e-309L),
DBL_ULP());
-#if !defined(__i386__)
z = CMPLXL(30, 0x1p1023L);
test_odd_tol(ctanh, z,
CMPLXL(1.0, -1.62994325413993477997492170229268382e-26L),
@@ -437,7 +460,6 @@ test_large(void)
CMPLXL(0.878606311888306869546254022621986509L,
-0.225462792499754505792678258169527424L),
DBL_ULP());
-#endif
z = CMPLXL(710.6, 0.78539816339744830961566084581987572L);
test_odd_tol(csinh, z,
@@ -454,29 +476,15 @@ test_large(void)
FE_OVERFLOW, CS_BOTH);
}
-int
-main(int argc, char *argv[])
+ATF_TP_ADD_TCS(tp)
{
- printf("1..6\n");
-
- test_zero();
- printf("ok 1 - ctrig zero\n");
-
- test_nan();
- printf("ok 2 - ctrig nan\n");
-
- test_inf();
- printf("ok 3 - ctrig inf\n");
-
- test_axes();
- printf("ok 4 - ctrig axes\n");
-
- test_small();
- printf("ok 5 - ctrig small\n");
-
- test_large();
- printf("ok 6 - ctrig large\n");
+ ATF_TP_ADD_TC(tp, test_zero_input);
+ ATF_TP_ADD_TC(tp, test_nan_inputs);
+ ATF_TP_ADD_TC(tp, test_inf_inputs);
+ ATF_TP_ADD_TC(tp, test_axes);
+ ATF_TP_ADD_TC(tp, test_small_inputs);
+ ATF_TP_ADD_TC(tp, test_large_inputs);
- return (0);
+ return (atf_no_error());
}
More information about the svn-src-stable
mailing list