2a30b8f4b2
Upstream commit: dcaf51b41e259387602774829c45222d0507f90a - elf: Change ldconfig auxcache magic number (bug 32231) - Make tst-strtod-underflow type-generic - Add crt1-2.0.o for glibc 2.0 compatibility tests - Add tests of more strtod special cases - Add more tests of strtod end pointer - Make tst-strtod2 and tst-strtod5 type-generic - powerpc64le: Build new strtod tests with long double ABI flags (bug 32145) - Do not set errno for overflowing NaN payload in strtod/nan (bug 32045) - Improve NaN payload testing - Make __strtod_internal tests type-generic - Fix strtod subnormal rounding (bug 30220) - More thoroughly test underflow / errno in tst-strtod-round - Test errno setting on strtod overflow in tst-strtod-round - Add tests of fread - stdio-common: Add new test for fdopen - libio: Attempt wide backup free only for non-legacy code - debug: Fix read error handling in pcprofiledump - elf: Fix tst-dlopen-tlsreinit1.out test dependency - elf: Avoid re-initializing already allocated TLS in dlopen (bug 31717) - elf: Clarify and invert second argument of _dl_allocate_tls_init - elf: Support recursive use of dynamic TLS in interposed malloc - nptl: Use <support/check.h> facilities in tst-setuid3 - posix: Use <support/check.h> facilities in tst-truncate and tst-truncate64 - ungetc: Fix backup buffer leak on program exit [BZ #27821] - ungetc: Fix uninitialized read when putting into unused streams [BZ #27821] - Make tst-ungetc use libsupport - stdio-common: Add test for vfscanf with matches longer than INT_MAX [BZ #27650] - support: Add FAIL test failure helper - string: strerror, strsignal cannot use buffer after dlmopen (bug 32026) - Define __libc_initial for the static libc - x86: Fix bug in strchrnul-evex512 [BZ #32078] - Adjust check-local-headers test for libaudit 4.0 - x32/cet: Support shadow stack during startup for Linux 6.10 - x86-64: Remove sysdeps/x86_64/x32/dl-machine.h - support: Add options list terminator to the test driver - manual/stdio: Further clarify putc, putwc, getc, and getwc - Fix name space violation in fortify wrappers (bug 32052) - resolv: Fix tst-resolv-short-response for older GCC (bug 32042) - Add mremap tests - mremap: Update manual entry - linux: Update the mremap C implementation [BZ #31968] - Enhanced test coverage for strncmp, wcsncmp - Enhance test coverage for strnlen, wcsnlen Resolves: RHEL-57776 Resolves: RHEL-57777 Resolves: RHEL-61392
227 lines
6.8 KiB
Diff
227 lines
6.8 KiB
Diff
commit 98de2f2baebeeac13748f064017b7bd2b94fafee
|
|
Author: Maciej W. Rozycki <macro@redhat.com>
|
|
Date: Fri Jul 26 13:21:34 2024 +0100
|
|
|
|
support: Add FAIL test failure helper
|
|
|
|
Add a FAIL test failure helper analogous to FAIL_RET, that does not
|
|
cause the current function to return, providing a standardized way to
|
|
report a test failure with a message supplied while permitting the
|
|
caller to continue executing, for further reporting, cleaning up, etc.
|
|
|
|
Update existing test cases that provide a conflicting definition of FAIL
|
|
by removing the local FAIL definition and then as follows:
|
|
|
|
- tst-fortify-syslog: provide a meaningful message in addition to the
|
|
file name already added by <support/check.h>; 'support_record_failure'
|
|
is already called by 'support_print_failure_impl' invoked by the new
|
|
FAIL test failure helper.
|
|
|
|
- tst-ctype: no update to FAIL calls required, with the name of the file
|
|
and the line number within of the failure site additionally included
|
|
by the new FAIL test failure helper, and error counting plus count
|
|
reporting upon test program termination also already provided by
|
|
'support_record_failure' and 'support_report_failure' respectively,
|
|
called by 'support_print_failure_impl' and 'adjust_exit_status' also
|
|
respectively. However in a number of places 'printf' is called and
|
|
the error count adjusted by hand, so update these places to make use
|
|
of FAIL instead. And last but not least adjust the final summary just
|
|
to report completion, with any error count following as reported by
|
|
the test driver.
|
|
|
|
- test-tgmath2: no update to FAIL calls required, with the name of the
|
|
file of the failure site additionally included by the new FAIL test
|
|
failure helper. Also there is no need to track the return status by
|
|
hand as any call to FAIL will eventually cause the test case to return
|
|
an unsuccesful exit status regardless of the return status from the
|
|
test function, via a call to 'adjust_exit_status' made by the test
|
|
driver.
|
|
|
|
Reviewed-by: DJ Delorie <dj@redhat.com>
|
|
(cherry picked from commit 1b97a9f23bf605ca608162089c94187573fb2a9e)
|
|
|
|
diff --git a/debug/tst-fortify-syslog.c b/debug/tst-fortify-syslog.c
|
|
index a7ddbf7c6b6d33c9..2712acf689ff5af2 100644
|
|
--- a/debug/tst-fortify-syslog.c
|
|
+++ b/debug/tst-fortify-syslog.c
|
|
@@ -22,7 +22,6 @@
|
|
#include <syslog.h>
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
-#include <stdio.h>
|
|
|
|
#include <support/check.h>
|
|
#include <support/support.h>
|
|
@@ -46,18 +45,13 @@ handler (int sig)
|
|
_exit (127);
|
|
}
|
|
|
|
-#define FAIL() \
|
|
- do { \
|
|
- printf ("Failure on line %d\n", __LINE__); \
|
|
- support_record_failure (); \
|
|
- } while (0)
|
|
#define CHK_FAIL_START \
|
|
chk_fail_ok = 1; \
|
|
if (! setjmp (chk_fail_buf)) \
|
|
{
|
|
#define CHK_FAIL_END \
|
|
chk_fail_ok = 0; \
|
|
- FAIL (); \
|
|
+ FAIL ("not supposed to reach here"); \
|
|
}
|
|
|
|
static void
|
|
diff --git a/localedata/tst-ctype.c b/localedata/tst-ctype.c
|
|
index 9de979a2d7592789..a23689719c173711 100644
|
|
--- a/localedata/tst-ctype.c
|
|
+++ b/localedata/tst-ctype.c
|
|
@@ -21,6 +21,8 @@
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
+#include <support/check.h>
|
|
+
|
|
|
|
static const char lower[] = "abcdefghijklmnopqrstuvwxyz";
|
|
static const char upper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
@@ -53,19 +55,11 @@ static struct classes
|
|
#define nclasses (sizeof (classes) / sizeof (classes[0]))
|
|
|
|
|
|
-#define FAIL(str, args...) \
|
|
- { \
|
|
- printf (" " str "\n", ##args); \
|
|
- ++errors; \
|
|
- }
|
|
-
|
|
-
|
|
static int
|
|
do_test (void)
|
|
{
|
|
const char *cp;
|
|
const char *cp2;
|
|
- int errors = 0;
|
|
char *inpline = NULL;
|
|
size_t inplinelen = 0;
|
|
char *resline = NULL;
|
|
@@ -394,11 +388,8 @@ punct = %04x alnum = %04x\n",
|
|
{
|
|
if (((__ctype_b[(unsigned int) *inp] & classes[n].mask) != 0)
|
|
!= (*resp != '0'))
|
|
- {
|
|
- printf (" is%s('%c' = '\\x%02x') %s true\n", inpline,
|
|
- *inp, *inp, *resp == '1' ? "not" : "is");
|
|
- ++errors;
|
|
- }
|
|
+ FAIL (" is%s('%c' = '\\x%02x') %s true\n", inpline,
|
|
+ *inp, *inp, *resp == '1' ? "not" : "is");
|
|
++inp;
|
|
++resp;
|
|
}
|
|
@@ -408,11 +399,8 @@ punct = %04x alnum = %04x\n",
|
|
while (*inp != '\0')
|
|
{
|
|
if (tolower (*inp) != *resp)
|
|
- {
|
|
- printf (" tolower('%c' = '\\x%02x') != '%c'\n",
|
|
- *inp, *inp, *resp);
|
|
- ++errors;
|
|
- }
|
|
+ FAIL (" tolower('%c' = '\\x%02x') != '%c'\n",
|
|
+ *inp, *inp, *resp);
|
|
++inp;
|
|
++resp;
|
|
}
|
|
@@ -422,11 +410,8 @@ punct = %04x alnum = %04x\n",
|
|
while (*inp != '\0')
|
|
{
|
|
if (toupper (*inp) != *resp)
|
|
- {
|
|
- printf (" toupper('%c' = '\\x%02x') != '%c'\n",
|
|
- *inp, *inp, *resp);
|
|
- ++errors;
|
|
- }
|
|
+ FAIL (" toupper('%c' = '\\x%02x') != '%c'\n",
|
|
+ *inp, *inp, *resp);
|
|
++inp;
|
|
++resp;
|
|
}
|
|
@@ -436,14 +421,7 @@ punct = %04x alnum = %04x\n",
|
|
}
|
|
|
|
|
|
- if (errors != 0)
|
|
- {
|
|
- printf (" %d error%s for `%s' locale\n\n\n", errors,
|
|
- errors == 1 ? "" : "s", setlocale (LC_ALL, NULL));
|
|
- return 1;
|
|
- }
|
|
-
|
|
- printf (" No errors for `%s' locale\n\n\n", setlocale (LC_ALL, NULL));
|
|
+ printf ("Completed testing for `%s' locale\n\n\n", setlocale (LC_ALL, NULL));
|
|
return 0;
|
|
}
|
|
|
|
diff --git a/math/test-tgmath2.c b/math/test-tgmath2.c
|
|
index 37afa8a08a5a4a9c..4aeb877b8e54c0a4 100644
|
|
--- a/math/test-tgmath2.c
|
|
+++ b/math/test-tgmath2.c
|
|
@@ -24,6 +24,8 @@
|
|
#include <string.h>
|
|
#include <tgmath.h>
|
|
|
|
+#include <support/check.h>
|
|
+
|
|
//#define DEBUG
|
|
|
|
typedef complex float cfloat;
|
|
@@ -87,13 +89,6 @@ enum
|
|
int count;
|
|
int counts[Tlast][C_last];
|
|
|
|
-#define FAIL(str) \
|
|
- do \
|
|
- { \
|
|
- printf ("%s failure on line %d\n", (str), __LINE__); \
|
|
- result = 1; \
|
|
- } \
|
|
- while (0)
|
|
#define TEST_TYPE_ONLY(expr, rettype) \
|
|
do \
|
|
{ \
|
|
@@ -133,8 +128,6 @@ int counts[Tlast][C_last];
|
|
int
|
|
test_cos (const int Vint4, const long long int Vllong4)
|
|
{
|
|
- int result = 0;
|
|
-
|
|
TEST (cos (vfloat1), float, cos);
|
|
TEST (cos (vdouble1), double, cos);
|
|
TEST (cos (vldouble1), ldouble, cos);
|
|
@@ -152,7 +145,7 @@ test_cos (const int Vint4, const long long int Vllong4)
|
|
TEST (cos (Vcdouble1), cdouble, cos);
|
|
TEST (cos (Vcldouble1), cldouble, cos);
|
|
|
|
- return result;
|
|
+ return 0;
|
|
}
|
|
|
|
int
|
|
diff --git a/support/check.h b/support/check.h
|
|
index 711f34b83b95b594..7ea22c7a2cba5cfd 100644
|
|
--- a/support/check.h
|
|
+++ b/support/check.h
|
|
@@ -24,6 +24,11 @@
|
|
|
|
__BEGIN_DECLS
|
|
|
|
+/* Record a test failure, print the failure message to standard output
|
|
+ and pass the result of 1 through. */
|
|
+#define FAIL(...) \
|
|
+ support_print_failure_impl (__FILE__, __LINE__, __VA_ARGS__)
|
|
+
|
|
/* Record a test failure, print the failure message to standard output
|
|
and return 1. */
|
|
#define FAIL_RET(...) \
|