diff options
author | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2018-08-07 18:06:58 -0300 |
---|---|---|
committer | Gabriel F. T. Gomes <gabriel@inconstante.eti.br> | 2019-03-01 15:32:49 -0300 |
commit | f0eaf86276547f4f1984469b651b3e9968858b85 (patch) | |
tree | 72b2a3ac48eecb7650440a0d64c05ab4e4d7327f /misc/tst-ldbl-error.c | |
parent | d11086a9391b6066458947b80c0d0059b6b461d8 (diff) | |
download | glibc-f0eaf86276547f4f1984469b651b3e9968858b85.tar.gz glibc-f0eaf86276547f4f1984469b651b3e9968858b85.tar.xz glibc-f0eaf86276547f4f1984469b651b3e9968858b85.zip |
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-error.c')
-rw-r--r-- | misc/tst-ldbl-error.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/misc/tst-ldbl-error.c b/misc/tst-ldbl-error.c index d6609f7fe9..0f13fee9f3 100644 --- a/misc/tst-ldbl-error.c +++ b/misc/tst-ldbl-error.c @@ -85,14 +85,15 @@ do_one_test (void *callback, const char *expected, ...) /* Call 'callback', which fills in the output and error buffers. */ result = support_capture_subprocess (callback, NULL); - /* The functions err, errx, verr, and verrx print just the program - name followed by a colon, whereas error and error_at_line print the - whole path to the program. Since the whole path depends on the - working directory used to build and test glibc, remove it from the - comparison against the expected result. */ - const char *needle = "tst-ldbl-error:"; + /* Filter out the name of the program (which should always end with + -error), so that the test case can be reused by ldbl-opt and + ldbl-128ibm-compat. */ + const char *needle = "-error:"; char *message; message = strstr (result.err.buffer, needle); + if (message == NULL) + FAIL_EXIT1 ("test case error"); + message += strlen (needle); /* Verify that the output message is as expected. */ TEST_COMPARE_STRING (message, expected); @@ -104,12 +105,12 @@ static int do_test (void) { struct tests tests[] = { - { &callback_err, "tst-ldbl-error: -1.000000: Success\n" }, - { &callback_errx, "tst-ldbl-error: -1.000000\n" }, - { &callback_verr, "tst-ldbl-error: -1.000000: Success\n" }, - { &callback_verrx, "tst-ldbl-error: -1.000000\n" }, - { &callback_error, "tst-ldbl-error: -1.000000\n" }, - { &callback_error_at_line, "tst-ldbl-error::0: -1.000000\n" } + { &callback_err, " -1.000000: Success\n" }, + { &callback_errx, " -1.000000\n" }, + { &callback_verr, " -1.000000: Success\n" }, + { &callback_verrx, " -1.000000\n" }, + { &callback_error, " -1.000000\n" }, + { &callback_error_at_line, ":0: -1.000000\n" } }; for (int i = 0; i < sizeof (tests) / sizeof (tests[0]); i++) |