From: Joseph Myers Date: Mon, 6 Feb 2017 23:07:22 +0000 (+0000) Subject: Move libm-test TEST_MSG definitions to libm-test-driver.c. X-Git-Tag: glibc-2.26~809 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a622c2db5511e9633870e3ced9fb2406e4ebdb09;p=thirdparty%2Fglibc.git Move libm-test TEST_MSG definitions to libm-test-driver.c. Various files using the libm-test infrastructure define a TEST_MSG macro with an informal description of the tests being run. This patch moves this macro to libm-test-driver.c (the definition depending on other macros already defined), so files specific to (type, choice of whether to test inline functions or finite-math-only functions, vector length) no longer need to define it. This is in preparation for replacing files such as test-float.c with per-function test-float-.c etc. automatically generated in the build directory when tests are run. Tested for x86_64. * math/libm-test-driver.c (STRX): New macro. (STR): Likewise. (STR_FLOAT): Likewise. (STR_VEC_LEN): Likewise. (TEST_MSG): Likewise. Define here instead of expecting to be defined by including file. * math/test-double-finite.c (TEST_MSG): Remove macro. * math/test-double-vlen2.h (TEST_MSG): Likewise. * math/test-double-vlen4.h (TEST_MSG): Likewise. * math/test-double-vlen8.h (TEST_MSG): Likewise. * math/test-double.c (TEST_MSG): Likewise. * math/test-float-finite.c (TEST_MSG): Likewise. * math/test-float-vlen16.h (TEST_MSG): Likewise. * math/test-float-vlen4.h (TEST_MSG): Likewise. * math/test-float-vlen8.h (TEST_MSG): Likewise. * math/test-float.c (TEST_MSG): Likewise. * math/test-idouble.c (TEST_MSG): Likewise. * math/test-ifloat.c (TEST_MSG): Likewise. * math/test-ildouble.c (TEST_MSG): Likewise. * math/test-ldouble-finite.c (TEST_MSG): Likewise. * math/test-ldouble.c (TEST_MSG): Likewise. --- diff --git a/ChangeLog b/ChangeLog index 7fc0ad0b9f8..944e587ae69 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,27 @@ 2017-02-06 Joseph Myers + * math/libm-test-driver.c (STRX): New macro. + (STR): Likewise. + (STR_FLOAT): Likewise. + (STR_VEC_LEN): Likewise. + (TEST_MSG): Likewise. Define here instead of expecting to be + defined by including file. + * math/test-double-finite.c (TEST_MSG): Remove macro. + * math/test-double-vlen2.h (TEST_MSG): Likewise. + * math/test-double-vlen4.h (TEST_MSG): Likewise. + * math/test-double-vlen8.h (TEST_MSG): Likewise. + * math/test-double.c (TEST_MSG): Likewise. + * math/test-float-finite.c (TEST_MSG): Likewise. + * math/test-float-vlen16.h (TEST_MSG): Likewise. + * math/test-float-vlen4.h (TEST_MSG): Likewise. + * math/test-float-vlen8.h (TEST_MSG): Likewise. + * math/test-float.c (TEST_MSG): Likewise. + * math/test-idouble.c (TEST_MSG): Likewise. + * math/test-ifloat.c (TEST_MSG): Likewise. + * math/test-ildouble.c (TEST_MSG): Likewise. + * math/test-ldouble-finite.c (TEST_MSG): Likewise. + * math/test-ldouble.c (TEST_MSG): Likewise. + * math/libm-test.inc: Move all tests of individual functions to libm-test-*.inc and #include libm-test-*.c files. (acos_test_data): Remove. diff --git a/math/libm-test-driver.c b/math/libm-test-driver.c index 1227d52d06f..ea890bab224 100644 --- a/math/libm-test-driver.c +++ b/math/libm-test-driver.c @@ -25,7 +25,6 @@ FUNC(function): converts general function name (like cos) to name with correct suffix (e.g. cosl or cosf) FLOAT: floating point type to test - - TEST_MSG: informal message to be displayed chooses one of the parameters as delta for testing equality PREFIX A macro which defines the prefix for common macros for the @@ -108,6 +107,22 @@ arrays. */ #include "libm-test-ulps.h" +#define STRX(x) #x +#define STR(x) STRX (x) +#define STR_FLOAT STR (FLOAT) +#define STR_VEC_LEN STR (VEC_LEN) + +/* Informal description of the functions being tested. */ +#if TEST_MATHVEC +# define TEST_MSG "testing " STR_FLOAT " (vector length " STR_VEC_LEN ")\n" +#elif TEST_INLINE +# define TEST_MSG "testing " STR_FLOAT " (inline functions)\n" +#elif TEST_FINITE +# define TEST_MSG "testing " STR_FLOAT " (finite-math-only)\n" +#else +# define TEST_MSG "testing " STR_FLOAT " (without inline functions)\n" +#endif + /* Allow platforms without all rounding modes to test properly, assuming they provide an __FE_UNDEFINED in which causes fesetround() to return failure. */ diff --git a/math/test-double-finite.c b/math/test-double-finite.c index 6de894ac047..c181925ffb2 100644 --- a/math/test-double-finite.c +++ b/math/test-double-finite.c @@ -20,6 +20,4 @@ #include "test-math-no-inline.h" #include "test-math-scalar.h" -#define TEST_MSG "testing double (finite-math-only)\n" - #include "libm-test.c" diff --git a/math/test-double-vlen2.h b/math/test-double-vlen2.h index c913878f3e1..58d029ab2a0 100644 --- a/math/test-double-vlen2.h +++ b/math/test-double-vlen2.h @@ -20,8 +20,6 @@ #include "test-math-no-inline.h" #include "test-math-vector.h" -#define TEST_MSG "testing double vector math (without inline functions)\n" - #define EXCEPTION_TESTS_double 0 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST) diff --git a/math/test-double-vlen4.h b/math/test-double-vlen4.h index 5346613aede..5ebcd133b18 100644 --- a/math/test-double-vlen4.h +++ b/math/test-double-vlen4.h @@ -20,8 +20,6 @@ #include "test-math-no-inline.h" #include "test-math-vector.h" -#define TEST_MSG "testing double vector math (without inline functions)\n" - #define EXCEPTION_TESTS_double 0 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST) diff --git a/math/test-double-vlen8.h b/math/test-double-vlen8.h index e91c2561904..8d9049eb285 100644 --- a/math/test-double-vlen8.h +++ b/math/test-double-vlen8.h @@ -20,8 +20,6 @@ #include "test-math-no-inline.h" #include "test-math-vector.h" -#define TEST_MSG "testing double vector math (without inline functions)\n" - #define EXCEPTION_TESTS_double 0 #define ROUNDING_TESTS_double(MODE) ((MODE) == FE_TONEAREST) diff --git a/math/test-double.c b/math/test-double.c index d81632ec9f2..3672370bcbf 100644 --- a/math/test-double.c +++ b/math/test-double.c @@ -22,6 +22,4 @@ #include "test-math-errno.h" #include "test-math-scalar.h" -#define TEST_MSG "testing double (without inline functions)\n" - #include "libm-test.c" diff --git a/math/test-float-finite.c b/math/test-float-finite.c index 5a6092ce042..09ea1e948bb 100644 --- a/math/test-float-finite.c +++ b/math/test-float-finite.c @@ -20,6 +20,4 @@ #include "test-math-no-inline.h" #include "test-math-scalar.h" -#define TEST_MSG "testing float (finite-math-only)\n" - #include "libm-test.c" diff --git a/math/test-float-vlen16.h b/math/test-float-vlen16.h index 76aa4437ac6..9388d77a82f 100644 --- a/math/test-float-vlen16.h +++ b/math/test-float-vlen16.h @@ -20,8 +20,6 @@ #include "test-math-no-inline.h" #include "test-math-vector.h" -#define TEST_MSG "testing float vector math (without inline functions)\n" - #define EXCEPTION_TESTS_float 0 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST) diff --git a/math/test-float-vlen4.h b/math/test-float-vlen4.h index d3d69b79156..0a3a25463a9 100644 --- a/math/test-float-vlen4.h +++ b/math/test-float-vlen4.h @@ -20,8 +20,6 @@ #include "test-math-no-inline.h" #include "test-math-vector.h" -#define TEST_MSG "testing float vector math (without inline functions)\n" - #define EXCEPTION_TESTS_float 0 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST) diff --git a/math/test-float-vlen8.h b/math/test-float-vlen8.h index 42e60920ddf..f744dc5771e 100644 --- a/math/test-float-vlen8.h +++ b/math/test-float-vlen8.h @@ -20,8 +20,6 @@ #include "test-math-no-inline.h" #include "test-math-vector.h" -#define TEST_MSG "testing float vector math (without inline functions)\n" - #define EXCEPTION_TESTS_float 0 #define ROUNDING_TESTS_float(MODE) ((MODE) == FE_TONEAREST) diff --git a/math/test-float.c b/math/test-float.c index 1c0d40cf9d3..25ba35a9d12 100644 --- a/math/test-float.c +++ b/math/test-float.c @@ -22,6 +22,4 @@ #include "test-math-errno.h" #include "test-math-scalar.h" -#define TEST_MSG "testing float (without inline functions)\n" - #include "libm-test.c" diff --git a/math/test-idouble.c b/math/test-idouble.c index b1c59603c62..944d981cc26 100644 --- a/math/test-idouble.c +++ b/math/test-idouble.c @@ -20,6 +20,4 @@ #include "test-math-inline.h" #include "test-math-scalar.h" -#define TEST_MSG "testing double (inline functions)\n" - #include "libm-test.c" diff --git a/math/test-ifloat.c b/math/test-ifloat.c index aee108601ff..20c028e1a3b 100644 --- a/math/test-ifloat.c +++ b/math/test-ifloat.c @@ -20,6 +20,4 @@ #include "test-math-inline.h" #include "test-math-scalar.h" -#define TEST_MSG "testing float (inline functions)\n" - #include "libm-test.c" diff --git a/math/test-ildouble.c b/math/test-ildouble.c index fd5e2cbda0c..ddba3e4722c 100644 --- a/math/test-ildouble.c +++ b/math/test-ildouble.c @@ -20,6 +20,4 @@ #include "test-math-inline.h" #include "test-math-scalar.h" -#define TEST_MSG "testing long double (inline functions)\n" - #include "libm-test.c" diff --git a/math/test-ldouble-finite.c b/math/test-ldouble-finite.c index d07d618130b..47cac2c71ef 100644 --- a/math/test-ldouble-finite.c +++ b/math/test-ldouble-finite.c @@ -20,6 +20,4 @@ #include "test-math-no-inline.h" #include "test-math-scalar.h" -#define TEST_MSG "testing long double (finite-math-only)\n" - #include "libm-test.c" diff --git a/math/test-ldouble.c b/math/test-ldouble.c index 5a598f4ce54..209a81683f0 100644 --- a/math/test-ldouble.c +++ b/math/test-ldouble.c @@ -22,6 +22,4 @@ #include "test-math-errno.h" #include "test-math-scalar.h" -#define TEST_MSG "testing long double (without inline functions)\n" - #include "libm-test.c"