This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[RFC] Add math tests for libieee
- From: "Tulio Magno Quites Machado Filho" <tuliom at linux dot vnet dot ibm dot com>
- To: libc-alpha at sourceware dot org, joseph at codesourcery dot com
- Cc: gftg at linux dot vnet dot ibm dot com
- Date: Mon, 13 Feb 2017 15:12:47 -0200
- Subject: [RFC] Add math tests for libieee
- Authentication-results: sourceware.org; auth=none
- References: <alpine.DEB.2.20.1702081830240.20627@digraph.polyomino.org.uk>
Joseph Myers <joseph@codesourcery.com> writes:
> On Wed, 8 Feb 2017, Gabriel F. T. Gomes wrote:
>
>> The code that this patch changes is not executed, because the wrappers
>> (in math/w_j0_compat.c and math/w_j1_compat.c) call __kernel_standard
>> and return.
>
> It's executed with -lieee (meaning this is user-visible and should have a
> bug filed in Bugzilla accordingly).
In this case, should we be testing libieee too?
--- 8< ---
Reuse the math tests to test IEEE error handling rules.
Integrating this patch will cause 148 errors on each math type test for
the following ppc64, ppc64le and x86_64.
2017-02-13 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* math/Makefile (libm-tests): Add ieee tests.
(LDLIBS-test-float-ieee): New.
(LDLIBS-test-double-ieee): Likewise.
(LDLIBS-test-ldouble-ieee): Likewise.
* math/libm-test-support.c (check_float_internal): Avoid testing
errno under IEEE error handling rules.
* math/test-double-ieee.c: New file.
* math/test-float-ieee.c: Likewise.
* math/test-ldouble-ieee.c: Likewise.
---
math/Makefile | 7 ++++++-
math/libm-test-support.c | 4 +++-
math/test-double-ieee.c | 18 ++++++++++++++++++
math/test-float-ieee.c | 18 ++++++++++++++++++
math/test-ldouble-ieee.c | 18 ++++++++++++++++++
5 files changed, 63 insertions(+), 2 deletions(-)
create mode 100644 math/test-double-ieee.c
create mode 100644 math/test-float-ieee.c
create mode 100644 math/test-ldouble-ieee.c
diff --git a/math/Makefile b/math/Makefile
index 2735212..c1d7676 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -193,7 +193,8 @@ endif
ifneq (no,$(PERL))
libm-vec-tests = $(addprefix test-,$(libmvec-tests))
-libm-tests = $(foreach t,$(types),test-$(t) test-$(t)-finite test-i$(t)) \
+libm-tests = $(foreach t,$(types),test-$(t) test-$(t)-finite test-i$(t) \
+ test-$(t)-ieee) \
$(libm-vec-tests)
libm-tests.o = $(addsuffix .o,$(libm-tests))
@@ -334,6 +335,10 @@ CFLAGS-test-flt-eval-method.c = -fexcess-precision=standard
CFLAGS-test-fe-snans-always-signal.c = -fsignaling-nans
+LDLIBS-test-float-ieee = -lieee
+LDLIBS-test-double-ieee = -lieee
+LDLIBS-test-ldouble-ieee = -lieee
+
# The -lieee module sets the _LIB_VERSION_ switch to IEEE mode
# for error handling in the -lm functions.
install-lib += libieee.a
diff --git a/math/libm-test-support.c b/math/libm-test-support.c
index d387f81..dabf6bc 100644
--- a/math/libm-test-support.c
+++ b/math/libm-test-support.c
@@ -619,7 +619,9 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
int errno_value = errno;
test_exceptions (test_name, exceptions);
- test_errno (test_name, errno_value, exceptions);
+ /* IEEE error handling (via libieee) doesn't support errno. */
+ if (_LIB_VERSION != _IEEE_)
+ test_errno (test_name, errno_value, exceptions);
if (exceptions & IGNORE_RESULT)
goto out;
if (issignaling (computed) && issignaling (expected))
diff --git a/math/test-double-ieee.c b/math/test-double-ieee.c
new file mode 100644
index 0000000..f638c45
--- /dev/null
+++ b/math/test-double-ieee.c
@@ -0,0 +1,18 @@
+/* Copyright (C) 2017 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/>. */
+
+#include "test-double.c"
diff --git a/math/test-float-ieee.c b/math/test-float-ieee.c
new file mode 100644
index 0000000..88b68e1
--- /dev/null
+++ b/math/test-float-ieee.c
@@ -0,0 +1,18 @@
+/* Copyright (C) 2017 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/>. */
+
+#include "test-float.c"
diff --git a/math/test-ldouble-ieee.c b/math/test-ldouble-ieee.c
new file mode 100644
index 0000000..e8c3cc6
--- /dev/null
+++ b/math/test-ldouble-ieee.c
@@ -0,0 +1,18 @@
+/* Copyright (C) 2017 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/>. */
+
+#include "test-ldouble.c"
--
2.1.0