From 29955b5d9658b02d3a678d1f785db3d1e63184ca Mon Sep 17 00:00:00 2001 From: Arjun Shankar Date: Wed, 5 Nov 2014 15:24:08 +0530 Subject: Modify several tests to use test-skeleton.c This patch modifies several test cases to use test-skeleton.c. It was generated by a bash script written for this purpose and thus excludes several other tests which I deemed worth a visual inspection before making the change. I intend to follow up with individual patches to the tests skipped by the script. The script itself resides at http://git.io/WODAmg and should reproduce this very patch when run against master. ChangeLog: 2014-10-30 Arjun Shankar * catgets/test-gencat.c: Use test-skeleton.c. * catgets/tst-catgets.c: Likewise. * csu/tst-empty.c: Likewise. * elf/tst-audit2.c: Likewise. * elf/tst-global1.c: Likewise. * elf/tst-pathopt.c: Likewise. * elf/tst-piemod1.c: Likewise. * elf/tst-tls10.c: Likewise. * elf/tst-tls11.c: Likewise. * elf/tst-tls12.c: Likewise. * gnulib/tst-gcc.c: Likewise. * iconvdata/tst-e2big.c: Likewise. * iconvdata/tst-loading.c: Likewise. * iconv/tst-iconv1.c: Likewise. * iconv/tst-iconv2.c: Likewise. * inet/test-inet6_opt.c: Likewise. * inet/tst-gethnm.c: Likewise. * inet/tst-network.c: Likewise. * inet/tst-ntoa.c: Likewise. * intl/tst-codeset.c: Likewise. * intl/tst-gettext2.c: Likewise. * intl/tst-gettext3.c: Likewise. * intl/tst-ngettext.c: Likewise. * intl/tst-translit.c: Likewise. * io/test-stat.c: Likewise. * libio/test-fmemopen.c: Likewise. * libio/tst-freopen.c: Likewise. * libio/tst-sscanf.c: Likewise. * libio/tst-ungetwc1.c: Likewise. * libio/tst-ungetwc2.c: Likewise. * libio/tst-widetext.c: Likewise. * localedata/tst-ctype.c: Likewise. * localedata/tst-digits.c: Likewise. * localedata/tst-leaks.c: Likewise. * localedata/tst-mbswcs1.c: Likewise. * localedata/tst-mbswcs2.c: Likewise. * localedata/tst-mbswcs3.c: Likewise. * localedata/tst-mbswcs4.c: Likewise. * localedata/tst-mbswcs5.c: Likewise. * localedata/tst-setlocale.c: Likewise. * localedata/tst-trans.c: Likewise. * localedata/tst-wctype.c: Likewise. * localedata/tst-xlocale1.c: Likewise. * login/tst-grantpt.c: Likewise. * malloc/tst-calloc.c: Likewise. * malloc/tst-malloc.c: Likewise. * malloc/tst-mallocstate.c: Likewise. * malloc/tst-mcheck.c: Likewise. * malloc/tst-mtrace.c: Likewise. * malloc/tst-obstack.c: Likewise. * math/atest-exp2.c: Likewise. * math/atest-exp.c: Likewise. * math/atest-sincos.c: Likewise. * math/test-matherr.c: Likewise. * math/test-misc.c: Likewise. * math/test-powl.c: Likewise. * math/tst-definitions.c: Likewise. * misc/tst-dirname.c: Likewise. * misc/tst-efgcvt.c: Likewise. * misc/tst-fdset.c: Likewise. * misc/tst-hsearch.c: Likewise. * misc/tst-mntent2.c: Likewise. * nptl/tst-sem7.c: Likewise. * nptl/tst-sem8.c: Likewise. * nptl/tst-sem9.c: Likewise. * nss/test-netdb.c: Likewise. * posix/tst-fnmatch.c: Likewise. * posix/tst-getlogin.c: Likewise. * posix/tst-gnuglob.c: Likewise. * posix/tst-mmap.c: Likewise. * pwd/tst-getpw.c: Likewise. * resolv/tst-inet_ntop.c: Likewise. * rt/tst-timer.c: Likewise. * stdio-common/test-fseek.c: Likewise. * stdio-common/test-popen.c: Likewise. * stdio-common/test-vfprintf.c: Likewise. * stdio-common/tst-cookie.c: Likewise. * stdio-common/tst-fileno.c: Likewise. * stdio-common/tst-gets.c: Likewise. * stdio-common/tst-obprintf.c: Likewise. * stdio-common/tst-perror.c: Likewise. * stdio-common/tst-sprintf2.c: Likewise. * stdio-common/tst-sprintf3.c: Likewise. * stdio-common/tst-sprintf.c: Likewise. * stdio-common/tst-swprintf.c: Likewise. * stdio-common/tst-tmpnam.c: Likewise. * stdio-common/tst-unbputc.c: Likewise. * stdio-common/tst-wc-printf.c: Likewise. * stdlib/tst-environ.c: Likewise. * stdlib/tst-fmtmsg.c: Likewise. * stdlib/tst-limits.c: Likewise. * stdlib/tst-rand48-2.c: Likewise. * stdlib/tst-rand48.c: Likewise. * stdlib/tst-random2.c: Likewise. * stdlib/tst-random.c: Likewise. * stdlib/tst-strtol.c: Likewise. * stdlib/tst-strtoll.c: Likewise. * stdlib/tst-tls-atexit.c: Likewise. * stdlib/tst-xpg-basename.c: Likewise. * string/test-ffs.c: Likewise. * string/tst-bswap.c: Likewise. * string/tst-inlcall.c: Likewise. * string/tst-strtok.c: Likewise. * string/tst-strxfrm.c: Likewise. * sysdeps/x86_64/tst-audit10.c: Likewise. * sysdeps/x86_64/tst-audit3.c: Likewise. * sysdeps/x86_64/tst-audit4.c: Likewise. * sysdeps/x86_64/tst-audit5.c: Likewise. * time/tst-ftime_l.c: Likewise. * time/tst-getdate.c: Likewise. * time/tst-mktime3.c: Likewise. * time/tst-mktime.c: Likewise. * time/tst-posixtz.c: Likewise. * time/tst-strptime2.c: Likewise. * time/tst-strptime3.c: Likewise. * wcsmbs/tst-btowc.c: Likewise. * wcsmbs/tst-mbrtowc.c: Likewise. * wcsmbs/tst-mbsrtowcs.c: Likewise. * wcsmbs/tst-wchar-h.c: Likewise. * wcsmbs/tst-wcpncpy.c: Likewise. * wcsmbs/tst-wcrtomb.c: Likewise. * wcsmbs/tst-wcsnlen.c: Likewise. * wcsmbs/tst-wcstof.c: Likewise. --- stdio-common/test-fseek.c | 7 +++++-- stdio-common/test-popen.c | 7 +++++-- stdio-common/test-vfprintf.c | 7 +++++-- stdio-common/tst-cookie.c | 7 +++++-- stdio-common/tst-fileno.c | 7 +++++-- stdio-common/tst-gets.c | 7 +++++-- stdio-common/tst-obprintf.c | 7 +++++-- stdio-common/tst-perror.c | 7 +++++-- stdio-common/tst-sprintf.c | 7 +++++-- stdio-common/tst-sprintf2.c | 7 +++++-- stdio-common/tst-sprintf3.c | 7 +++++-- stdio-common/tst-swprintf.c | 7 +++++-- stdio-common/tst-tmpnam.c | 7 +++++-- stdio-common/tst-unbputc.c | 7 +++++-- stdio-common/tst-wc-printf.c | 7 +++++-- 15 files changed, 75 insertions(+), 30 deletions(-) (limited to 'stdio-common') diff --git a/stdio-common/test-fseek.c b/stdio-common/test-fseek.c index fe57df6ac7..8a7f1ae722 100644 --- a/stdio-common/test-fseek.c +++ b/stdio-common/test-fseek.c @@ -19,8 +19,8 @@ #define TESTFILE "/tmp/test.dat" -int -main (void) +static int +do_test (void) { FILE *fp; int i, j; @@ -82,3 +82,6 @@ main (void) puts ((i > 255) ? "Test succeeded." : "Test FAILED!"); return (i > 255) ? 0 : 1; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/test-popen.c b/stdio-common/test-popen.c index d36cd61b4c..1f1c88acc6 100644 --- a/stdio-common/test-popen.c +++ b/stdio-common/test-popen.c @@ -49,8 +49,8 @@ read_data (FILE *stream) } } -int -main (void) +static int +do_test (void) { FILE *output, *input; int wstatus, rstatus; @@ -100,3 +100,6 @@ main (void) puts (wstatus | rstatus ? "Test FAILED!" : "Test succeeded."); return (wstatus | rstatus); } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/test-vfprintf.c b/stdio-common/test-vfprintf.c index a936c2804d..9cc56d7dcb 100644 --- a/stdio-common/test-vfprintf.c +++ b/stdio-common/test-vfprintf.c @@ -36,8 +36,8 @@ const char *locs[] = char large[50000]; -int -main (void) +static int +do_test (void) { char buf[25]; size_t i; @@ -124,3 +124,6 @@ main (void) return res; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-cookie.c b/stdio-common/tst-cookie.c index dcdabf3230..030e684562 100644 --- a/stdio-common/tst-cookie.c +++ b/stdio-common/tst-cookie.c @@ -63,8 +63,8 @@ cookieclose (void *cookie) } -int -main (void) +static int +do_test (void) { cookie_io_functions_t fcts; char buf[1]; @@ -90,3 +90,6 @@ main (void) return errors != 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-fileno.c b/stdio-common/tst-fileno.c index a0c8853b85..753df9f68b 100644 --- a/stdio-common/tst-fileno.c +++ b/stdio-common/tst-fileno.c @@ -28,10 +28,13 @@ check (const char *name, FILE *stream, int fd) return sfd != fd; } -int -main (void) +static int +do_test (void) { return (check ("stdin", stdin, STDIN_FILENO) || check ("stdout", stdout, STDOUT_FILENO) || check ("stderr", stderr, STDERR_FILENO)); } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-gets.c b/stdio-common/tst-gets.c index 7f78fc1283..052f1f926a 100644 --- a/stdio-common/tst-gets.c +++ b/stdio-common/tst-gets.c @@ -21,8 +21,8 @@ #include -int -main (void) +static int +do_test (void) { char buf[100]; int result = 0; @@ -61,3 +61,6 @@ main (void) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-obprintf.c b/stdio-common/tst-obprintf.c index 39e8fdab6f..51515932ad 100644 --- a/stdio-common/tst-obprintf.c +++ b/stdio-common/tst-obprintf.c @@ -4,8 +4,8 @@ #include -int -main (void) +static int +do_test (void) { struct obstack ob; int n; @@ -40,3 +40,6 @@ main (void) return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-perror.c b/stdio-common/tst-perror.c index b809c2fc40..416b120b8d 100644 --- a/stdio-common/tst-perror.c +++ b/stdio-common/tst-perror.c @@ -24,8 +24,8 @@ #define WC_EXP_LEN (sizeof (WC_EXP) - 1) -int -main (void) +static int +do_test (void) { int fd; char fname[] = "/tmp/tst-perror.XXXXXX"; @@ -152,3 +152,6 @@ main (void) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c index c4e911fe94..2fe373f350 100644 --- a/stdio-common/tst-sprintf.c +++ b/stdio-common/tst-sprintf.c @@ -4,8 +4,8 @@ #include -int -main (void) +static int +do_test (void) { char buf[100]; int result = 0; @@ -73,3 +73,6 @@ main (void) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-sprintf2.c b/stdio-common/tst-sprintf2.c index 422278dd6a..0ddf15ba33 100644 --- a/stdio-common/tst-sprintf2.c +++ b/stdio-common/tst-sprintf2.c @@ -3,8 +3,8 @@ #include #include -int -main (void) +static int +do_test (void) { #if LDBL_MANT_DIG >= 106 volatile union { long double l; long long x[2]; } u, v; @@ -82,3 +82,6 @@ main (void) #endif return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-sprintf3.c b/stdio-common/tst-sprintf3.c index e54b23b167..e927761091 100644 --- a/stdio-common/tst-sprintf3.c +++ b/stdio-common/tst-sprintf3.c @@ -22,8 +22,8 @@ #include #include -int -main (void) +static int +do_test (void) { #if LDBL_MANT_DIG >= 106 volatile union { long double l; long long x[2]; } u, v; @@ -88,3 +88,6 @@ main (void) #endif return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-swprintf.c b/stdio-common/tst-swprintf.c index e65234b1c2..ce62c6bf68 100644 --- a/stdio-common/tst-swprintf.c +++ b/stdio-common/tst-swprintf.c @@ -12,8 +12,8 @@ const char input[] = "\x8e\xa1g\x8e\xa2h\x8e\xa3i\x8e\xa4j"; -int -main (void) +static int +do_test (void) { wchar_t buf[1000]; #define nbuf (sizeof (buf) / sizeof (buf[0])) @@ -54,3 +54,6 @@ swprintf (.., .., L\"%ls\", \"%ls\") produced \"%ls\", not \"%ls\"\n", \ return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-tmpnam.c b/stdio-common/tst-tmpnam.c index a3bd9fb90c..3b97064182 100644 --- a/stdio-common/tst-tmpnam.c +++ b/stdio-common/tst-tmpnam.c @@ -19,8 +19,8 @@ #include #include -int -main (void) +static int +do_test (void) { const char *name; int retval = 0; @@ -48,3 +48,6 @@ main (void) return retval; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-unbputc.c b/stdio-common/tst-unbputc.c index bbd8622b03..7200a82a2a 100644 --- a/stdio-common/tst-unbputc.c +++ b/stdio-common/tst-unbputc.c @@ -1,11 +1,14 @@ #include -int -main (void) +static int +do_test (void) { putc ('1', stderr); putc ('2', stderr); return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-wc-printf.c b/stdio-common/tst-wc-printf.c index abbeeb5330..2a2acb5059 100644 --- a/stdio-common/tst-wc-printf.c +++ b/stdio-common/tst-wc-printf.c @@ -4,8 +4,8 @@ #include #include -int -main (void) +static int +do_test (void) { wchar_t tmp[3]; tmp[0] = '8'; @@ -20,3 +20,6 @@ main (void) return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" -- cgit v1.2.3