mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-08 06:10:06 +00:00
Update string tests to use the support test driver.
Replaced all imports of test-skeleton.c with support/test-driver.c. In some cases it was needed to adjust do_test to return int instead of static int since that is the method's signature expected by test-driver.c. Checked on x86_64. * string/test-string.h (TEST_FUNCTION): Use test_main instead of test_main (). (CMDLINE_PROCESS): Use function instead of defined macro. * debug/test-strcpy_chk.c: Import support/test-driver.c and also <suppport/support.h> to use set_fortify_handler(). * string/bug-envz1.c: Import support/test-driver.c instead of test-skeleton.c. * string/bug-strcoll2.c: Likewise. * string/bug-strtok1.c: Likewise. * string/stratcliff.c: Likewise. * string/test-ffs.c: Likewise. * string/test-memccpy.c: Likewise. * string/test-memchr.c: Likewise. * string/test-memcmp.c: Likewise. * string/test-memcpy.c: Likewise. * string/test-memmem.c: Likewise. * string/test-memmove.c: Likewise. * string/test-memrchr.c: Likewise. * string/test-memset.c: Likewise. * string/test-rawmemchr.c: Likewise. * string/test-strcasecmp.c: Likewise. * string/test-strcasestr.c: Likewise. * string/test-strcat.c: Likewise. * string/test-strchr.c: Likewise. * string/test-strcmp.c: Likewise. * string/test-strcpy.c: Likewise. * string/test-string.h: Likewise. * string/test-strlen.c: Likewise. * string/test-strncasecmp.c: Likewise. * string/test-strncat.c: Likewise. * string/test-strncmp.c: Likewise. * string/test-strncpy.c: Likewise. * string/test-strnlen.c: Likewise. * string/test-strpbrk.c: Likewise. * string/test-strrchr.c: Likewise. * string/test-strspn.c: Likewise. * string/test-strstr.c: Likewise. * string/tst-bswap.c: Likewise. * string/tst-cmp.c: Likewise. * string/tst-endian.c: Likewise. * string/tst-inlcall.c: Likewise. * string/tst-strcoll-overflow.c: Likewise. * string/tst-strfry.c: Likewise. * string/tst-strlen.c: Likewise. * string/tst-strtok.c: Likewise. * string/tst-strtok_r.c: Likewise. * string/tst-strxfrm.c: Likewise. * string/tst-strxfrm2.c: Likewise. * string/tst-svc.c: Likewise. * string/tst-svc2.c: Likewise.
This commit is contained in:
parent
b9e8c90875
commit
fb82116f24
53
ChangeLog
53
ChangeLog
@ -1,3 +1,56 @@
|
||||
2017-03-23 Wainer dos Santos Moschetta <wainersm@linux.vnet.ibm.com>
|
||||
|
||||
* string/test-string.h (TEST_FUNCTION): Use test_main instead of
|
||||
test_main ().
|
||||
(CMDLINE_PROCESS): Use function instead of defined macro.
|
||||
* debug/test-strcpy_chk.c: Import support/test-driver.c and also
|
||||
<suppport/support.h> to use set_fortify_handler().
|
||||
* string/bug-envz1.c: Import support/test-driver.c instead of
|
||||
test-skeleton.c.
|
||||
* string/bug-strcoll2.c: Likewise.
|
||||
* string/bug-strtok1.c: Likewise.
|
||||
* string/stratcliff.c: Likewise.
|
||||
* string/test-ffs.c: Likewise.
|
||||
* string/test-memccpy.c: Likewise.
|
||||
* string/test-memchr.c: Likewise.
|
||||
* string/test-memcmp.c: Likewise.
|
||||
* string/test-memcpy.c: Likewise.
|
||||
* string/test-memmem.c: Likewise.
|
||||
* string/test-memmove.c: Likewise.
|
||||
* string/test-memrchr.c: Likewise.
|
||||
* string/test-memset.c: Likewise.
|
||||
* string/test-rawmemchr.c: Likewise.
|
||||
* string/test-strcasecmp.c: Likewise.
|
||||
* string/test-strcasestr.c: Likewise.
|
||||
* string/test-strcat.c: Likewise.
|
||||
* string/test-strchr.c: Likewise.
|
||||
* string/test-strcmp.c: Likewise.
|
||||
* string/test-strcpy.c: Likewise.
|
||||
* string/test-string.h: Likewise.
|
||||
* string/test-strlen.c: Likewise.
|
||||
* string/test-strncasecmp.c: Likewise.
|
||||
* string/test-strncat.c: Likewise.
|
||||
* string/test-strncmp.c: Likewise.
|
||||
* string/test-strncpy.c: Likewise.
|
||||
* string/test-strnlen.c: Likewise.
|
||||
* string/test-strpbrk.c: Likewise.
|
||||
* string/test-strrchr.c: Likewise.
|
||||
* string/test-strspn.c: Likewise.
|
||||
* string/test-strstr.c: Likewise.
|
||||
* string/tst-bswap.c: Likewise.
|
||||
* string/tst-cmp.c: Likewise.
|
||||
* string/tst-endian.c: Likewise.
|
||||
* string/tst-inlcall.c: Likewise.
|
||||
* string/tst-strcoll-overflow.c: Likewise.
|
||||
* string/tst-strfry.c: Likewise.
|
||||
* string/tst-strlen.c: Likewise.
|
||||
* string/tst-strtok.c: Likewise.
|
||||
* string/tst-strtok_r.c: Likewise.
|
||||
* string/tst-strxfrm.c: Likewise.
|
||||
* string/tst-strxfrm2.c: Likewise.
|
||||
* string/tst-svc.c: Likewise.
|
||||
* string/tst-svc2.c: Likewise.
|
||||
|
||||
2017-03-22 Zack Weinberg <zackw@panix.com>
|
||||
|
||||
* stdio-common/bug25.c: Include stdlib.h.
|
||||
|
@ -55,8 +55,9 @@ simple_strcpy_chk (char *dst, const char *src, size_t len)
|
||||
#include <signal.h>
|
||||
|
||||
static int test_main (void);
|
||||
#define TEST_FUNCTION test_main ()
|
||||
#include "../test-skeleton.c"
|
||||
#define TEST_FUNCTION test_main
|
||||
#include <support/test-driver.c>
|
||||
#include <support/support.h>
|
||||
|
||||
volatile int chk_fail_ok;
|
||||
jmp_buf chk_fail_buf;
|
||||
|
@ -25,7 +25,7 @@ static const struct
|
||||
#define nstrs (sizeof (strs) / sizeof (strs[0]))
|
||||
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
|
||||
@ -72,5 +72,4 @@ do_test (void)
|
||||
return result;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -79,7 +79,7 @@ test_da_DK (void)
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
int err = 0;
|
||||
@ -88,5 +88,4 @@ do_test (void)
|
||||
return err;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
const char str[] = "axaaba";
|
||||
@ -41,5 +41,4 @@ do_test (void)
|
||||
return result;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -55,7 +55,7 @@
|
||||
#define STRINGIFY2(s) #s
|
||||
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
int size = sysconf (_SC_PAGESIZE);
|
||||
@ -558,5 +558,4 @@ memccpy copied too much for outer = %d, middle = %d, inner = %d\n",
|
||||
return result;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
int failures = 0;
|
||||
@ -62,5 +62,4 @@ do_test (void)
|
||||
return failures;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -266,4 +266,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -214,4 +214,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -521,4 +521,5 @@ test_main (void)
|
||||
do_random_tests ();
|
||||
return ret;
|
||||
}
|
||||
#include "../test-skeleton.c"
|
||||
|
||||
#include <support/test-driver.c>
|
||||
|
@ -256,4 +256,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -181,4 +181,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -287,4 +287,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -166,4 +166,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -264,4 +264,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -162,4 +162,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -267,4 +267,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -191,4 +191,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -269,4 +269,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -293,4 +293,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -406,4 +406,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -242,4 +242,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -40,6 +40,7 @@ extern impl_t __start_impls[], __stop_impls[];
|
||||
|
||||
#undef __USE_STRING_INLINES
|
||||
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -55,7 +56,7 @@ extern impl_t __start_impls[], __stop_impls[];
|
||||
#define GLRO(x) _##x
|
||||
|
||||
|
||||
# define TEST_FUNCTION test_main ()
|
||||
# define TEST_FUNCTION test_main
|
||||
# define TIMEOUT (4 * 60)
|
||||
# define OPT_ITERATIONS 10000
|
||||
# define OPT_RANDOM 10001
|
||||
@ -83,23 +84,31 @@ size_t iterations = 100000;
|
||||
# define CMDLINE_OPTIONS ITERATIONS_OPTIONS \
|
||||
{ "random", no_argument, NULL, OPT_RANDOM }, \
|
||||
{ "seed", required_argument, NULL, OPT_SEED },
|
||||
# define CMDLINE_PROCESS ITERATIONS_PROCESS \
|
||||
case OPT_RANDOM: \
|
||||
{ \
|
||||
int fdr = open ("/dev/urandom", O_RDONLY); \
|
||||
\
|
||||
if (fdr < 0 || read (fdr, &seed, sizeof(seed)) != sizeof (seed)) \
|
||||
seed = time (NULL); \
|
||||
if (fdr >= 0) \
|
||||
close (fdr); \
|
||||
do_srandom = 1; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
case OPT_SEED: \
|
||||
seed = strtoul (optarg, NULL, 0); \
|
||||
do_srandom = 1; \
|
||||
break;
|
||||
|
||||
static void __attribute__ ((used))
|
||||
cmdline_process_function (int c)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
ITERATIONS_PROCESS
|
||||
case OPT_RANDOM:
|
||||
{
|
||||
int fdr = open ("/dev/urandom", O_RDONLY);
|
||||
if (fdr < 0 || read (fdr, &seed, sizeof (seed)) != sizeof (seed))
|
||||
seed = time (NULL);
|
||||
if (fdr >= 0)
|
||||
close (fdr);
|
||||
do_srandom = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
case OPT_SEED:
|
||||
seed = strtoul (optarg, NULL, 0);
|
||||
do_srandom = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
# define CMDLINE_PROCESS cmdline_process_function
|
||||
|
||||
#define CALL(impl, ...) \
|
||||
(* (proto_t) (impl)->fn) (__VA_ARGS__)
|
||||
|
@ -164,4 +164,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -350,4 +350,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -319,4 +319,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -476,4 +476,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -320,4 +320,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -191,4 +191,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -264,4 +264,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -244,4 +244,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -242,4 +242,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -208,4 +208,4 @@ test_main (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
extern unsigned long long int wash (unsigned long long int a);
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
int result = 0;
|
||||
@ -72,5 +72,4 @@ wash (unsigned long long int a)
|
||||
return a + 0;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -107,7 +107,7 @@ strncasecmp_max (const char *left, const char *right)
|
||||
return strncasecmp (left, right, SIZE_MAX);
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
enum {
|
||||
@ -209,5 +209,4 @@ do_test (void)
|
||||
machines. */
|
||||
#define TIMEOUT 300
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -18,7 +18,7 @@
|
||||
# define DIAG_IGNORE_NEEDS_COMMENT_TAUTOLOGICAL_COMPARE()
|
||||
#endif
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
int result = 0;
|
||||
@ -131,5 +131,4 @@ do_test (void)
|
||||
return result;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
int status;
|
||||
@ -81,5 +81,4 @@ do_test (void)
|
||||
return status;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -30,7 +30,7 @@
|
||||
64-bit. */
|
||||
#define SIZE 0x40000000ul
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
TEST_VERIFY_EXIT (setlocale (LC_COLLATE, "en_GB.UTF-8") != NULL);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
char str[] = "this is a test";
|
||||
@ -11,5 +11,4 @@ do_test (void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
static const size_t lens[] = { 0, 1, 0, 2, 0, 1, 0, 3,
|
||||
@ -54,5 +54,4 @@ strnlen failed for base=%Zu, words=%Zu, and last=%Zu (is %zd, expected %zd)\n",
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
char buf[1] = { 0 };
|
||||
@ -22,5 +22,4 @@ do_test (void)
|
||||
return result;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -35,4 +35,4 @@ test_main (void)
|
||||
return strcmp (tok, "udf") != 0;
|
||||
}
|
||||
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -58,7 +58,7 @@ test (const char *locale)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
int result = 0;
|
||||
@ -70,5 +70,4 @@ do_test (void)
|
||||
return result;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
static const char test_locale[] = "de_DE.UTF-8";
|
||||
@ -81,5 +81,4 @@ do_test (void)
|
||||
return res;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -13,7 +13,7 @@ compare (const void *p1, const void *p2)
|
||||
return strverscmp (*((char **) p1), *((char **) p2));
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
char line[MAX_LINE_SIZE + 1];
|
||||
@ -44,5 +44,4 @@ do_test (void)
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
@ -26,7 +26,7 @@ compare (const char *str1, const char *str2, int exp)
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
int
|
||||
do_test (void)
|
||||
{
|
||||
int res = 0;
|
||||
@ -58,5 +58,4 @@ do_test (void)
|
||||
return res;
|
||||
}
|
||||
|
||||
#define TEST_FUNCTION do_test ()
|
||||
#include "../test-skeleton.c"
|
||||
#include <support/test-driver.c>
|
||||
|
Loading…
Reference in New Issue
Block a user