summary refs log tree commit diff
path: root/math
diff options
context:
space:
mode:
Diffstat (limited to 'math')
-rw-r--r--math/libm-test.inc28
-rw-r--r--math/test-double.c1
-rw-r--r--math/test-float.c1
-rw-r--r--math/test-ldouble.c1
-rw-r--r--math/test-math-errno.h19
-rw-r--r--math/test-math-inline.h4
-rw-r--r--math/test-math-no-inline.h3
-rw-r--r--math/test-math-vector.h1
8 files changed, 41 insertions, 17 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index e18785f74b..2f0d6d95f0 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -608,7 +608,6 @@ test_single_exception (const char *test_name,
 		       int fe_flag,
 		       const char *flag_name)
 {
-# ifndef TEST_INLINE
   int ok = 1;
   if (exception & exc_flag)
     {
@@ -643,8 +642,6 @@ test_single_exception (const char *test_name,
     }
   if (!ok)
     ++noErrors;
-
-# endif
 }
 #endif
 
@@ -654,7 +651,7 @@ test_single_exception (const char *test_name,
 static void
 test_exceptions (const char *test_name, int exception)
 {
-  if (EXCEPTION_TESTS (FLOAT))
+  if (TEST_EXCEPTIONS && EXCEPTION_TESTS (FLOAT))
     {
       ++noExcTests;
 #ifdef FE_DIVBYZERO
@@ -694,7 +691,6 @@ static void
 test_single_errno (const char *test_name, int errno_value,
 		   int expected_value, const char *expected_name)
 {
-#if !defined TEST_INLINE && !TEST_MATHVEC
   if (errno_value == expected_value)
     {
       if (print_screen (1))
@@ -708,7 +704,6 @@ test_single_errno (const char *test_name, int errno_value,
 	printf ("Failure: %s: errno set to %d, expected %d (%s)\n",
 		test_name, errno_value, expected_value, expected_name);
     }
-#endif
 }
 
 /* Test whether errno (value ERRNO_VALUE) has been for TEST_NAME set
@@ -716,13 +711,16 @@ test_single_errno (const char *test_name, int errno_value,
 static void
 test_errno (const char *test_name, int errno_value, int exceptions)
 {
-  ++noErrnoTests;
-  if (exceptions & ERRNO_UNCHANGED)
-    test_single_errno (test_name, errno_value, 0, "unchanged");
-  if (exceptions & ERRNO_EDOM)
-    test_single_errno (test_name, errno_value, EDOM, "EDOM");
-  if (exceptions & ERRNO_ERANGE)
-    test_single_errno (test_name, errno_value, ERANGE, "ERANGE");
+  if (TEST_ERRNO)
+    {
+      ++noErrnoTests;
+      if (exceptions & ERRNO_UNCHANGED)
+	test_single_errno (test_name, errno_value, 0, "unchanged");
+      if (exceptions & ERRNO_EDOM)
+	test_single_errno (test_name, errno_value, EDOM, "EDOM");
+      if (exceptions & ERRNO_ERANGE)
+	test_single_errno (test_name, errno_value, ERANGE, "ERANGE");
+    }
 }
 
 /* Returns the number of ulps that GIVEN is away from EXPECTED.  */
@@ -1041,10 +1039,8 @@ enable_test (int exceptions)
 {
   if (exceptions & XFAIL_TEST)
     return 0;
-#ifdef TEST_INLINE
-  if (exceptions & NO_TEST_INLINE)
+  if (TEST_INLINE && (exceptions & NO_TEST_INLINE))
     return 0;
-#endif
   return 1;
 }
 
diff --git a/math/test-double.c b/math/test-double.c
index b62e433f17..caffe20b2c 100644
--- a/math/test-double.c
+++ b/math/test-double.c
@@ -18,6 +18,7 @@
 
 #include "test-double.h"
 #include "test-math-no-inline.h"
+#include "test-math-errno.h"
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing double (without inline functions)\n"
diff --git a/math/test-float.c b/math/test-float.c
index b6a41c0e93..cb6b22d05e 100644
--- a/math/test-float.c
+++ b/math/test-float.c
@@ -18,6 +18,7 @@
 
 #include "test-float.h"
 #include "test-math-no-inline.h"
+#include "test-math-errno.h"
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing float (without inline functions)\n"
diff --git a/math/test-ldouble.c b/math/test-ldouble.c
index 6820c5d1fe..4da4a4f9fc 100644
--- a/math/test-ldouble.c
+++ b/math/test-ldouble.c
@@ -18,6 +18,7 @@
 
 #include "test-ldouble.h"
 #include "test-math-no-inline.h"
+#include "test-math-errno.h"
 #include "test-math-scalar.h"
 
 #define TEST_MSG "testing long double (without inline functions)\n"
diff --git a/math/test-math-errno.h b/math/test-math-errno.h
new file mode 100644
index 0000000000..9be4a6ac66
--- /dev/null
+++ b/math/test-math-errno.h
@@ -0,0 +1,19 @@
+/* Common definitions for libm tests for functions setting errno.
+   Copyright (C) 2015 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#define TEST_ERRNO 1
diff --git a/math/test-math-inline.h b/math/test-math-inline.h
index d778cc74d9..4083f703e3 100644
--- a/math/test-math-inline.h
+++ b/math/test-math-inline.h
@@ -16,7 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define TEST_INLINE
+#define TEST_INLINE 1
+#define TEST_ERRNO 0
+#define TEST_EXCEPTIONS 0
 
 #ifdef __NO_MATH_INLINES
 # undef __NO_MATH_INLINES
diff --git a/math/test-math-no-inline.h b/math/test-math-no-inline.h
index ad765da0ae..87b7094d57 100644
--- a/math/test-math-no-inline.h
+++ b/math/test-math-no-inline.h
@@ -16,6 +16,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+#define TEST_INLINE 0
+#define TEST_EXCEPTIONS 1
+
 #ifndef __NO_MATH_INLINES
 # define __NO_MATH_INLINES
 #endif
diff --git a/math/test-math-vector.h b/math/test-math-vector.h
index 1b74841fe4..ec4c533fe6 100644
--- a/math/test-math-vector.h
+++ b/math/test-math-vector.h
@@ -17,6 +17,7 @@
    <http://www.gnu.org/licenses/>.  */
 
 #define TEST_MATHVEC 1
+#define TEST_ERRNO 0
 
 #define CNCT(x, y) x ## y
 #define CONCAT(a, b) CNCT (a, b)