aboutsummaryrefslogtreecommitdiff
path: root/misc/tst-ldbl-warn.c
diff options
context:
space:
mode:
authorGabriel F. T. Gomes <gabriel@inconstante.eti.br>2018-08-07 18:06:58 -0300
committerGabriel F. T. Gomes <gabriel@inconstante.eti.br>2019-03-01 15:32:49 -0300
commitf0eaf86276547f4f1984469b651b3e9968858b85 (patch)
tree72b2a3ac48eecb7650440a0d64c05ab4e4d7327f /misc/tst-ldbl-warn.c
parentd11086a9391b6066458947b80c0d0059b6b461d8 (diff)
downloadglibc-f0eaf86276547f4f1984469b651b3e9968858b85.zip
glibc-f0eaf86276547f4f1984469b651b3e9968858b85.tar.gz
glibc-f0eaf86276547f4f1984469b651b3e9968858b85.tar.bz2
ldbl-opt: Reuse test cases from misc/ that check long double
This patch adds test cases for the compatibility versions of the functions: err, errx, verr, verrx, warn, warnx, vwarn, vwarnx (from err.h), error, and error_at_line (from error.h), when long double has the same format as double (-mlong-double-64). Tested for powerpc, powerpc64 and powerpc64le.
Diffstat (limited to 'misc/tst-ldbl-warn.c')
-rw-r--r--misc/tst-ldbl-warn.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/misc/tst-ldbl-warn.c b/misc/tst-ldbl-warn.c
index 7d15b55..90375a9 100644
--- a/misc/tst-ldbl-warn.c
+++ b/misc/tst-ldbl-warn.c
@@ -59,9 +59,21 @@ do_one_test (int select, const char *format, va_list args,
stderr = old_stderr;
- /* Close the in-memory stream and check the output buffer. */
+ /* Close the in-memory stream. */
xfclose_memstream (&stream);
- TEST_COMPARE_STRING (stream.buffer, expected);
+
+ /* Filter out the name of the program (which should always end with
+ warn), so that the test case can be reused by ldbl-opt and
+ ldbl-128ibm-compat. */
+ const char *needle = "warn: ";
+ char *message;
+ message = strstr (stream.buffer, needle);
+ if (message == NULL)
+ FAIL_EXIT1 ("test case error");
+ message += strlen (needle);
+
+ /* Check that the rest of the output is as expected. */
+ TEST_COMPARE_STRING (message, expected);
if (stream.buffer != NULL)
free (stream.buffer);
@@ -74,13 +86,11 @@ do_test_call_varg (const char *format, ...)
va_start (args, format);
do_one_test (VWARN, format, args, 0, 0, 0, 0,
- "tst-ldbl-warn: "
"-1.000000 - -2.000000 - -3.000000 - -4.000000: Success\n");
va_end (args);
va_start (args, format);
do_one_test (VWARNX, format, args, 0, 0, 0, 0,
- "tst-ldbl-warn: "
"-1.000000 - -2.000000 - -3.000000 - -4.000000\n");
va_end (args);
}
@@ -92,10 +102,8 @@ do_test_call_rarg (const char *format, long double arg1, double arg2,
va_list args;
memset (&args, 0, sizeof (args));
do_one_test (WARN, format, args, arg1, arg2, arg3, arg4,
- "tst-ldbl-warn: "
"-1.000000 - -2.000000 - -3.000000 - -4.000000: Success\n");
do_one_test (WARNX, format, args, arg1, arg2, arg3, arg4,
- "tst-ldbl-warn: "
"-1.000000 - -2.000000 - -3.000000 - -4.000000\n");
}