diff options
46 files changed, 143 insertions, 95 deletions
@@ -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. diff --git a/debug/test-strcpy_chk.c b/debug/test-strcpy_chk.c index 6bb0fc0..8b729bd 100644 --- a/debug/test-strcpy_chk.c +++ b/debug/test-strcpy_chk.c @@ -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; diff --git a/string/bug-envz1.c b/string/bug-envz1.c index e8a6097..931a055 100644 --- a/string/bug-envz1.c +++ b/string/bug-envz1.c @@ -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> diff --git a/string/bug-strcoll2.c b/string/bug-strcoll2.c index 8d4fed5..ff33007 100644 --- a/string/bug-strcoll2.c +++ b/string/bug-strcoll2.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> diff --git a/string/bug-strtok1.c b/string/bug-strtok1.c index da30acf..a47b2f3 100644 --- a/string/bug-strtok1.c +++ b/string/bug-strtok1.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> diff --git a/string/stratcliff.c b/string/stratcliff.c index e672644..e28b0c5 100644 --- a/string/stratcliff.c +++ b/string/stratcliff.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> diff --git a/string/test-ffs.c b/string/test-ffs.c index 8c8ce2a..11b6ea8 100644 --- a/string/test-ffs.c +++ b/string/test-ffs.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> diff --git a/string/test-memccpy.c b/string/test-memccpy.c index 1b7e177..7bd67a6 100644 --- a/string/test-memccpy.c +++ b/string/test-memccpy.c @@ -266,4 +266,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-memchr.c b/string/test-memchr.c index d64d10c..2403c92 100644 --- a/string/test-memchr.c +++ b/string/test-memchr.c @@ -214,4 +214,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-memcmp.c b/string/test-memcmp.c index 0e3cc9f..a7969ed 100644 --- a/string/test-memcmp.c +++ b/string/test-memcmp.c @@ -521,4 +521,5 @@ test_main (void) do_random_tests (); return ret; } -#include "../test-skeleton.c" + +#include <support/test-driver.c> diff --git a/string/test-memcpy.c b/string/test-memcpy.c index 882c603..49f0a76 100644 --- a/string/test-memcpy.c +++ b/string/test-memcpy.c @@ -256,4 +256,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-memmem.c b/string/test-memmem.c index f49f6e2..82fd93c 100644 --- a/string/test-memmem.c +++ b/string/test-memmem.c @@ -181,4 +181,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-memmove.c b/string/test-memmove.c index d9f332f..51f79f6 100644 --- a/string/test-memmove.c +++ b/string/test-memmove.c @@ -287,4 +287,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-memrchr.c b/string/test-memrchr.c index b313175..bfc9920 100644 --- a/string/test-memrchr.c +++ b/string/test-memrchr.c @@ -166,4 +166,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-memset.c b/string/test-memset.c index cf73651..ca1bfe1 100644 --- a/string/test-memset.c +++ b/string/test-memset.c @@ -264,4 +264,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-rawmemchr.c b/string/test-rawmemchr.c index 15cdedd..2a53e71 100644 --- a/string/test-rawmemchr.c +++ b/string/test-rawmemchr.c @@ -162,4 +162,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strcasecmp.c b/string/test-strcasecmp.c index 28b32e2..9c333f0 100644 --- a/string/test-strcasecmp.c +++ b/string/test-strcasecmp.c @@ -267,4 +267,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strcasestr.c b/string/test-strcasestr.c index bf4fc5e..abb3916 100644 --- a/string/test-strcasestr.c +++ b/string/test-strcasestr.c @@ -191,4 +191,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strcat.c b/string/test-strcat.c index 26e37fa..01d180e 100644 --- a/string/test-strcat.c +++ b/string/test-strcat.c @@ -269,4 +269,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strchr.c b/string/test-strchr.c index dba149e..de9a274 100644 --- a/string/test-strchr.c +++ b/string/test-strchr.c @@ -293,4 +293,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strcmp.c b/string/test-strcmp.c index 7b546d2..f7af219 100644 --- a/string/test-strcmp.c +++ b/string/test-strcmp.c @@ -406,4 +406,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strcpy.c b/string/test-strcpy.c index 77b6e8c..d4de65a 100644 --- a/string/test-strcpy.c +++ b/string/test-strcpy.c @@ -242,4 +242,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-string.h b/string/test-string.h index 2c36b44..3f72876 100644 --- a/string/test-string.h +++ b/string/test-string.h @@ -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__) diff --git a/string/test-strlen.c b/string/test-strlen.c index 5d30e10..99be380 100644 --- a/string/test-strlen.c +++ b/string/test-strlen.c @@ -164,4 +164,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strncasecmp.c b/string/test-strncasecmp.c index 1e05f02..bf501cf 100644 --- a/string/test-strncasecmp.c +++ b/string/test-strncasecmp.c @@ -350,4 +350,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strncat.c b/string/test-strncat.c index 26a6b5b..66d58e5 100644 --- a/string/test-strncat.c +++ b/string/test-strncat.c @@ -319,4 +319,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strncmp.c b/string/test-strncmp.c index a245d0b..fe3c4e3 100644 --- a/string/test-strncmp.c +++ b/string/test-strncmp.c @@ -476,4 +476,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strncpy.c b/string/test-strncpy.c index 88d1d44..43f9c23 100644 --- a/string/test-strncpy.c +++ b/string/test-strncpy.c @@ -320,4 +320,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strnlen.c b/string/test-strnlen.c index 7059669..277146f 100644 --- a/string/test-strnlen.c +++ b/string/test-strnlen.c @@ -191,4 +191,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strpbrk.c b/string/test-strpbrk.c index f7a0a4f..4d680ab 100644 --- a/string/test-strpbrk.c +++ b/string/test-strpbrk.c @@ -264,4 +264,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strrchr.c b/string/test-strrchr.c index 8908dda..10c070a 100644 --- a/string/test-strrchr.c +++ b/string/test-strrchr.c @@ -244,4 +244,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strspn.c b/string/test-strspn.c index c32a695..d26331f 100644 --- a/string/test-strspn.c +++ b/string/test-strspn.c @@ -242,4 +242,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/test-strstr.c b/string/test-strstr.c index c29d374..21944f4 100644 --- a/string/test-strstr.c +++ b/string/test-strstr.c @@ -208,4 +208,4 @@ test_main (void) return ret; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/tst-bswap.c b/string/tst-bswap.c index d3e432d..def6e2f 100644 --- a/string/tst-bswap.c +++ b/string/tst-bswap.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> diff --git a/string/tst-cmp.c b/string/tst-cmp.c index ae63228..d772019 100644 --- a/string/tst-cmp.c +++ b/string/tst-cmp.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> diff --git a/string/tst-endian.c b/string/tst-endian.c index d3c7c2c..b156ede 100644 --- a/string/tst-endian.c +++ b/string/tst-endian.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> diff --git a/string/tst-inlcall.c b/string/tst-inlcall.c index 54a0f37..f39f2c3 100644 --- a/string/tst-inlcall.c +++ b/string/tst-inlcall.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> diff --git a/string/tst-strcoll-overflow.c b/string/tst-strcoll-overflow.c index ee694b6..826af4f 100644 --- a/string/tst-strcoll-overflow.c +++ b/string/tst-strcoll-overflow.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); diff --git a/string/tst-strfry.c b/string/tst-strfry.c index 2b40a39..e4e9018 100644 --- a/string/tst-strfry.c +++ b/string/tst-strfry.c @@ -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> diff --git a/string/tst-strlen.c b/string/tst-strlen.c index 8376831..15fbc8b 100644 --- a/string/tst-strlen.c +++ b/string/tst-strlen.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> diff --git a/string/tst-strtok.c b/string/tst-strtok.c index 6fbef9f..628e106 100644 --- a/string/tst-strtok.c +++ b/string/tst-strtok.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> diff --git a/string/tst-strtok_r.c b/string/tst-strtok_r.c index 96749b6..fc3ed60 100644 --- a/string/tst-strtok_r.c +++ b/string/tst-strtok_r.c @@ -35,4 +35,4 @@ test_main (void) return strcmp (tok, "udf") != 0; } -#include "../test-skeleton.c" +#include <support/test-driver.c> diff --git a/string/tst-strxfrm.c b/string/tst-strxfrm.c index f48cfc0..ffe191c 100644 --- a/string/tst-strxfrm.c +++ b/string/tst-strxfrm.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> diff --git a/string/tst-strxfrm2.c b/string/tst-strxfrm2.c index bea5aa2..12117e8 100644 --- a/string/tst-strxfrm2.c +++ b/string/tst-strxfrm2.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> diff --git a/string/tst-svc.c b/string/tst-svc.c index 1b0da3e..d5cf2c1 100644 --- a/string/tst-svc.c +++ b/string/tst-svc.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> diff --git a/string/tst-svc2.c b/string/tst-svc2.c index 12c88aa..c0aa03d 100644 --- a/string/tst-svc2.c +++ b/string/tst-svc2.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> |