Add tests for the functions from err.h and error.h that can take
positional long double parameters. Most of the functions tested by this
patch do not return, so each have an independent test.
Tested for powerpc64le.
* sysdeps/ieee754/ldbl-128ibm-compat/Makefile
(tests-internal): Add test-warn-ibm128, test-warn-ieee128,
test-err-ibm128, test-err-ieee128, test-errx-ibm128,
test-errx-ieee128, test-verr-ibm128, test-verr-ieee128,
test-verrx-ibm128, test-verrx-ieee128, test-error1-ibm128,
test-error1-ieee128, test-error2-ibm128, and test-error2-ieee128.
(CFLAGS-test-err-ieee128.c): New variable.
(CFLAGS-test-err-ibm128.c): Likewise.
(CFLAGS-test-errx-ieee128.c): Likewise.
(CFLAGS-test-errx-ibm128.c): Likewise.
(CFLAGS-test-verr-ieee128.c): Likewise.
(CFLAGS-test-verr-ibm128.c): Likewise.
(CFLAGS-test-verrx-ieee128.c): Likewise.
(CFLAGS-test-verrx-ibm128.c): Likewise.
(CFLAGS-test-error1-ieee128.c): Likewise.
(CFLAGS-test-error1-ibm128.c): Likewise.
(CFLAGS-test-error2-ieee128.c): Likewise.
(CFLAGS-test-error2-ibm128.c): Likewise.
[run-built-tests == yes] (tests-special): Add
$(objpfx)test-warn-ieee128.out, $(objpfx)test-warn-ibm128.out,
$(objpfx)test-err-ieee128.out, $(objpfx)test-err-ibm128.out,
$(objpfx)test-errx-ieee128.out, $(objpfx)test-errx-ibm128.out,
$(objpfx)test-verr-ieee128.out, $(objpfx)test-verr-ibm128.out,
$(objpfx)test-verrx-ieee128.out, $(objpfx)test-verrx-ibm128.out,
$(objpfx)test-error1-ieee128.out, $(objpfx)test-error1-ibm128.out,
$(objpfx)test-error2-ieee128.out, $(objpfx)test-error2-ibm128.out.
($(objpfx)test-warn-%.out, $(objpfx)test-err-%.out)
($(objpfx)test-errx-%.out, $(objpfx)test-verr-%.out)
($(objpfx)test-verrx-%.out, $(objpfx)test-error1-%.out)
($(objpfx)test-error2-%.out): New build and run rule.
* sysdeps/ieee754/ldbl-128ibm-compat/test-err-ibm128.c: New file.
* sysdeps/ieee754/ldbl-128ibm-compat/test-err-ieee128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.sh: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-error-ldbl-compat.c:
Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-error1-ibm128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-error1-ieee128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-error1-ldbl-compat.c:
Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-error2-ibm128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-error2-ieee128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-error2-ldbl-compat.c:
Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-errx-ibm128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-errx-ieee128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-errx-ldbl-compat.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-verr-ibm128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-verr-ieee128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-verr-ldbl-compat.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-verrx-ibm128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-verrx-ieee128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-verrx-ldbl-compat.c:
Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ibm128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ieee128.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ldbl-compat.c: Likewise.
* sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ldbl-compat.sh:
Likewise.
---
sysdeps/ieee754/ldbl-128ibm-compat/Makefile | 85 ++++++++++++++++++++++
.../ieee754/ldbl-128ibm-compat/test-err-ibm128.c | 1 +
.../ieee754/ldbl-128ibm-compat/test-err-ieee128.c | 1 +
.../ldbl-128ibm-compat/test-err-ldbl-compat.c | 3 +
.../ldbl-128ibm-compat/test-err-ldbl-compat.sh | 44 +++++++++++
.../ldbl-128ibm-compat/test-error-ldbl-compat.c | 45 ++++++++++++
.../ldbl-128ibm-compat/test-error1-ibm128.c | 1 +
.../ldbl-128ibm-compat/test-error1-ieee128.c | 1 +
.../ldbl-128ibm-compat/test-error1-ldbl-compat.c | 3 +
.../ldbl-128ibm-compat/test-error2-ibm128.c | 1 +
.../ldbl-128ibm-compat/test-error2-ieee128.c | 1 +
.../ldbl-128ibm-compat/test-error2-ldbl-compat.c | 3 +
.../ieee754/ldbl-128ibm-compat/test-errx-ibm128.c | 1 +
.../ieee754/ldbl-128ibm-compat/test-errx-ieee128.c | 1 +
.../ldbl-128ibm-compat/test-errx-ldbl-compat.c | 3 +
.../ieee754/ldbl-128ibm-compat/test-verr-ibm128.c | 1 +
.../ieee754/ldbl-128ibm-compat/test-verr-ieee128.c | 1 +
.../ldbl-128ibm-compat/test-verr-ldbl-compat.c | 3 +
.../ieee754/ldbl-128ibm-compat/test-verrx-ibm128.c | 1 +
.../ldbl-128ibm-compat/test-verrx-ieee128.c | 1 +
.../ldbl-128ibm-compat/test-verrx-ldbl-compat.c | 3 +
.../ieee754/ldbl-128ibm-compat/test-warn-ibm128.c | 1 +
.../ieee754/ldbl-128ibm-compat/test-warn-ieee128.c | 1 +
.../ldbl-128ibm-compat/test-warn-ldbl-compat.c | 61 ++++++++++++++++
.../ldbl-128ibm-compat/test-warn-ldbl-compat.sh | 50 +++++++++++++
25 files changed, 317 insertions(+)
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-err-ibm128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-err-ieee128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.sh
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-error-ldbl-compat.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-error1-ibm128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-error1-ieee128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-error1-ldbl-compat.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-error2-ibm128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-error2-ieee128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-error2-ldbl-compat.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-errx-ibm128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-errx-ieee128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-errx-ldbl-compat.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-verr-ibm128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-verr-ieee128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-verr-ldbl-compat.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-verrx-ibm128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-verrx-ieee128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-verrx-ldbl-compat.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ibm128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ieee128.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ldbl-compat.c
create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ldbl-compat.sh
@@ -245,4 +245,89 @@ ifeq ($(subdir),misc)
# IEEE binary128 format
routines += ieee128-err
routines += ieee128-error
+
+tests-internal += test-warn-ibm128 test-warn-ieee128
+CFLAGS-test-warn-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-warn-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
+tests-internal += test-err-ibm128 test-err-ieee128
+tests-internal += test-errx-ibm128 test-errx-ieee128
+tests-internal += test-verr-ibm128 test-verr-ieee128
+tests-internal += test-verrx-ibm128 test-verrx-ieee128
+CFLAGS-test-err-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-err-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-errx-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-errx-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-verr-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-verr-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-verrx-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-verrx-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
+tests-internal += test-error1-ibm128 test-error1-ieee128
+tests-internal += test-error2-ibm128 test-error2-ieee128
+CFLAGS-test-error1-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-error1-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+CFLAGS-test-error2-ieee128.c += -mfloat128 -mabi=ieeelongdouble -Wno-psabi
+CFLAGS-test-error2-ibm128.c += -mabi=ibmlongdouble -Wno-psabi
+
+ifeq ($(run-built-tests),yes)
+tests-special += $(objpfx)test-warn-ieee128.out
+tests-special += $(objpfx)test-warn-ibm128.out
+
+tests-special += $(objpfx)test-err-ieee128.out
+tests-special += $(objpfx)test-err-ibm128.out
+tests-special += $(objpfx)test-errx-ieee128.out
+tests-special += $(objpfx)test-errx-ibm128.out
+tests-special += $(objpfx)test-verr-ieee128.out
+tests-special += $(objpfx)test-verr-ibm128.out
+tests-special += $(objpfx)test-verrx-ieee128.out
+tests-special += $(objpfx)test-verrx-ibm128.out
+
+tests-special += $(objpfx)test-error1-ieee128.out
+tests-special += $(objpfx)test-error1-ibm128.out
+tests-special += $(objpfx)test-error2-ieee128.out
+tests-special += $(objpfx)test-error2-ibm128.out
+endif
+
+$(objpfx)test-warn-%.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-warn-ldbl-compat.sh \
+ $(objpfx)test-warn-%
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-err-%.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.sh \
+ $(objpfx)test-err-%
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-errx-%.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.sh \
+ $(objpfx)test-errx-%
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-verr-%.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.sh \
+ $(objpfx)test-verr-%
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-verrx-%.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.sh \
+ $(objpfx)test-verrx-%
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-error1-%.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.sh \
+ $(objpfx)test-error1-%
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
+
+$(objpfx)test-error2-%.out: \
+ ../sysdeps/ieee754/ldbl-128ibm-compat/test-err-ldbl-compat.sh \
+ $(objpfx)test-error2-%
+ $(SHELL) $^ '$(test-program-prefix)' $@; \
+ $(evaluate-test)
endif
new file mode 100644
@@ -0,0 +1 @@
+#include <test-err-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-err-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION err
+#define ERROR_FUNCTION_PARAMS (0, format, ld)
+#include <test-error-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,44 @@
+#!/bin/sh
+# Testing of *err*. IEEE binary128 for powerpc64le version.
+# Copyright (C) 2018 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/>.
+
+set -e
+
+test_program=$1; shift
+test_program_prefix=$1; shift
+test_program_output=$1; shift
+
+status=0
+
+${test_program_prefix} \
+ ${test_program} \
+ 2> ${test_program_output} || status=1
+
+sed -i ${test_program_output} -e "s/.*128: //"
+sed -i ${test_program_output} -e "s/: Success//"
+
+cat <<'EOF' |
+-1.000000000000000000000000000000000000000000000000000000000000
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+ status=1
+ echo "*** output comparison failed"
+}
+
+exit $status
new file mode 100644
@@ -0,0 +1,45 @@
+/* Test for the long double variants of *err* functions.
+ Copyright (C) 2018 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 <err.h>
+#include <error.h>
+#include <stdarg.h>
+
+#include <support/check.h>
+
+static void
+do_test_call (long double ld, const char *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ ERROR_FUNCTION ERROR_FUNCTION_PARAMS;
+ va_end (args);
+}
+
+static int
+do_test (void)
+{
+ long double ld = -1;
+
+ do_test_call (ld, "%.60Lf", ld);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-error1-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-error1-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION error
+#define ERROR_FUNCTION_PARAMS (0, 0, format, ld)
+#include <test-error-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-error2-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-error2-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION error_at_line
+#define ERROR_FUNCTION_PARAMS (0, 0, "", 128, format, ld)
+#include <test-error-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-errx-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-errx-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION errx
+#define ERROR_FUNCTION_PARAMS (0, format, ld)
+#include <test-error-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-verr-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-verr-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION verr
+#define ERROR_FUNCTION_PARAMS (0, format, args)
+#include <test-error-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-verrx-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-verrx-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,3 @@
+#define ERROR_FUNCTION verrx
+#define ERROR_FUNCTION_PARAMS (0, format, args)
+#include <test-error-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-warn-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1 @@
+#include <test-warn-ldbl-compat.c>
new file mode 100644
@@ -0,0 +1,61 @@
+/* Test for the long double variants of *warn* functions.
+ Copyright (C) 2018 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 <err.h>
+#include <stdarg.h>
+
+#include <support/check.h>
+
+static void
+do_test_call_varg (const char *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ vwarn (format, args);
+ va_end (args);
+
+ va_start (args, format);
+ vwarnx (format, args);
+ va_end (args);
+}
+
+static void
+do_test_call_rarg (const char *format, long double ld)
+{
+ warn (format, ld);
+ warnx (format, ld);
+}
+
+static int
+do_test (void)
+{
+ long double ld = -1;
+
+ /* Print in decimal notation. */
+ do_test_call_rarg ("%.60Lf", ld);
+ do_test_call_varg ("%.60Lf", ld);
+
+ /* Print in hexadecimal notation. */
+ do_test_call_rarg ("%.60La", ld);
+ do_test_call_varg ("%.60La", ld);
+
+ return 0;
+}
+
+#include <support/test-driver.c>
new file mode 100644
@@ -0,0 +1,50 @@
+#!/bin/sh
+# Testing of *warn*. IEEE binary128 for powerpc64le version.
+# Copyright (C) 2018 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/>.
+
+set -e
+
+test_program=$1; shift
+test_program_prefix=$1; shift
+test_program_output=$1; shift
+
+status=0
+
+${test_program_prefix} \
+ ${test_program} \
+ 2> ${test_program_output} || status=1
+
+sed -i "s/^test.*128: //" ${test_program_output}
+
+cat <<'EOF' |
+-1.000000000000000000000000000000000000000000000000000000000000: Success
+-1.000000000000000000000000000000000000000000000000000000000000
+-1.000000000000000000000000000000000000000000000000000000000000: Success
+-1.000000000000000000000000000000000000000000000000000000000000
+-0x1.000000000000000000000000000000000000000000000000000000000000p+0: Success
+-0x1.000000000000000000000000000000000000000000000000000000000000p+0
+-0x1.000000000000000000000000000000000000000000000000000000000000p+0: Success
+-0x1.000000000000000000000000000000000000000000000000000000000000p+0
+EOF
+cmp - ${test_program_output} > /dev/null 2>&1 ||
+{
+ status=1
+ echo "*** output comparison failed"
+}
+
+exit $status