From c1f4108352e446285e99f046e3929ed13d5e9851 Mon Sep 17 00:00:00 2001 From: Arjun Shankar Date: Mon, 3 Aug 2015 16:14:21 +0000 Subject: [PATCH] Modify several tests to use test-skeleton.c These tests were skipped by the use-test-skeleton conversion done in commit 29955b5d because they did not have an `int main (void)' declaration. Instead their `main' functions were declared with arguments (i.e. argc, argv) even though they didn't use them. Remove these arguments and include the test skeleton in these tests. --- ChangeLog | 75 +++++++++++++++++++++++++++++++++++++ dirent/tst-seekdir.c | 7 +++- elf/tst-dlmodcount.c | 7 +++- elf/tst-order-main.c | 7 +++- elf/tst-pie2.c | 7 +++- inet/tst-ether_aton.c | 7 +++- misc/tst-mntent.c | 7 +++- misc/tst-tsearch.c | 7 +++- posix/tst-regexloc.c | 7 +++- resolv/tst-aton.c | 7 +++- stdio-common/test-fwrite.c | 7 +++- stdio-common/tst-ferror.c | 7 +++- stdio-common/tst-printf.c | 7 +++- stdio-common/tst-printfsz.c | 7 +++- stdlib/tst-strtod.c | 7 +++- string/tst-strlen.c | 7 +++- string/tst-svc.c | 7 +++- time/tst-strptime.c | 7 +++- timezone/tst-timezone.c | 7 +++- 19 files changed, 165 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index a13ddd04ce..d37ae1a8b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,78 @@ +2015-08-06 Arjun Shankar + + * dirent/tst-seekdir.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * elf/tst-dlmodcount.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * elf/tst-order-main.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * elf/tst-pie2.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * inet/tst-ether_aton.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * misc/tst-mntent.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * misc/tst-tsearch.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * posix/tst-regexloc.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * resolv/tst-aton.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * stdio-common/test-fwrite.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * stdio-common/tst-ferror.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * stdio-common/tst-printf.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * stdio-common/tst-printfsz.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * stdlib/tst-strtod.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * string/tst-strlen.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * string/tst-svc.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * time/tst-strptime.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + * timezone/tst-timezone.c (main): Converted to ... + (do_test): ... this. + (TEST_FUNCTION): New macro. + Include test-skeleton.c. + 2015-08-05 Zack Weinberg * misc/regexp.h: Update comments. diff --git a/dirent/tst-seekdir.c b/dirent/tst-seekdir.c index 43808fecb5..dcdd699b09 100644 --- a/dirent/tst-seekdir.c +++ b/dirent/tst-seekdir.c @@ -2,8 +2,8 @@ #include #include -int -main (int argc, char *argv[]) +static int +do_test (void) { DIR * dirp; long int save3 = 0; @@ -76,3 +76,6 @@ main (int argc, char *argv[]) closedir (dirp); return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/elf/tst-dlmodcount.c b/elf/tst-dlmodcount.c index 64df2fa18a..6cfa366836 100644 --- a/elf/tst-dlmodcount.c +++ b/elf/tst-dlmodcount.c @@ -92,8 +92,8 @@ unload (const char *path, void *handle) dl_iterate_phdr (callback, (void *)(intptr_t) REMOVE); } -int -main (int argc, char **argv) +static int +do_test (void) { void *handle1, *handle2; @@ -104,3 +104,6 @@ main (int argc, char **argv) unload ("globalmod1.so", handle2); return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/elf/tst-order-main.c b/elf/tst-order-main.c index 80f4f6be18..339778a93a 100644 --- a/elf/tst-order-main.c +++ b/elf/tst-order-main.c @@ -2,9 +2,12 @@ #include #include -int -main( int argc, char *argv[] ) +static int +do_test (void) { printf( "main\n" ); exit(EXIT_SUCCESS); } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/elf/tst-pie2.c b/elf/tst-pie2.c index b76b3236e4..a22fc521bc 100644 --- a/elf/tst-pie2.c +++ b/elf/tst-pie2.c @@ -31,8 +31,11 @@ init_g (void) g += 1; } -int -main (int argc, char *argv[]) +static int +do_test (void) { return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/inet/tst-ether_aton.c b/inet/tst-ether_aton.c index 94ceec80ff..eba350ed3a 100644 --- a/inet/tst-ether_aton.c +++ b/inet/tst-ether_aton.c @@ -2,8 +2,8 @@ #include #include -int -main (int argc, char *argv[]) +static int +do_test (void) { struct ether_addr *valp, val; int result, r; @@ -55,3 +55,6 @@ main (int argc, char *argv[]) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/misc/tst-mntent.c b/misc/tst-mntent.c index 876c89f8ed..932fd3f522 100644 --- a/misc/tst-mntent.c +++ b/misc/tst-mntent.c @@ -5,8 +5,8 @@ #include -int -main (int argc, char *argv[]) +static int +do_test (void) { int result = 0; struct mntent mef; @@ -97,3 +97,6 @@ main (int argc, char *argv[]) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/misc/tst-tsearch.c b/misc/tst-tsearch.c index 70b6c339fc..dca22820c3 100644 --- a/misc/tst-tsearch.c +++ b/misc/tst-tsearch.c @@ -248,8 +248,8 @@ mangle_tree (enum order how, enum action what, void **root, int lag) } -int -main (int argc, char **argv) +static int +do_test (void) { int total_error = 0; static char state[8] = { 1, 2, 3, 4, 5, 6, 7, 8 }; @@ -350,3 +350,6 @@ main (int argc, char **argv) return total_error; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/posix/tst-regexloc.c b/posix/tst-regexloc.c index 38bf87abbf..62b739e4e2 100644 --- a/posix/tst-regexloc.c +++ b/posix/tst-regexloc.c @@ -23,8 +23,8 @@ #include #include -int -main (int argc, char *argv[]) +static int +do_test (void) { regex_t re; regmatch_t mat[1]; @@ -44,3 +44,6 @@ main (int argc, char *argv[]) return res; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/resolv/tst-aton.c b/resolv/tst-aton.c index 4e9caf96f4..08110a007a 100644 --- a/resolv/tst-aton.c +++ b/resolv/tst-aton.c @@ -44,8 +44,8 @@ static struct tests }; -int -main (int argc, char *argv[]) +static int +do_test (void) { int result = 0; size_t cnt; @@ -72,3 +72,6 @@ main (int argc, char *argv[]) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/test-fwrite.c b/stdio-common/test-fwrite.c index ce54169931..5677c6da80 100644 --- a/stdio-common/test-fwrite.c +++ b/stdio-common/test-fwrite.c @@ -1,8 +1,8 @@ #include #include -int -main (int argc, char *argv[]) +static int +do_test (void) { FILE *f = tmpfile (); char obuf[99999], ibuf[sizeof obuf]; @@ -66,3 +66,6 @@ There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\ puts ("Test succeeded."); return 0; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-ferror.c b/stdio-common/tst-ferror.c index 5f23002c7a..69592df048 100644 --- a/stdio-common/tst-ferror.c +++ b/stdio-common/tst-ferror.c @@ -1,7 +1,7 @@ #include -int -main (int argc, char *argv[]) +static int +do_test (void) { char buf[100]; int result = 0; @@ -39,3 +39,6 @@ main (int argc, char *argv[]) } return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-printf.c b/stdio-common/tst-printf.c index 8011033d73..88525084e8 100644 --- a/stdio-common/tst-printf.c +++ b/stdio-common/tst-printf.c @@ -132,8 +132,8 @@ fp_test (void) printf("%-10s\n", (char *) NULL); } -int -main (int argc, char *argv[]) +static int +do_test (void) { static char shortstr[] = "Hi, Z."; static char longstr[] = "Good morning, Doctor Chandra. This is Hal. \ @@ -393,3 +393,6 @@ rfg3 (void) printf ("got: '%s', expected: '%s'\n", buf, " 12345 1234 11145401322 321.765432 3.217654e+02 5 test-string"); } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdio-common/tst-printfsz.c b/stdio-common/tst-printfsz.c index 902b2ac27b..8a3385f94d 100644 --- a/stdio-common/tst-printfsz.c +++ b/stdio-common/tst-printfsz.c @@ -7,8 +7,8 @@ #define V 12345678.12345678 -int -main (int argc, char *argv[]) +static int +do_test (void) { char buf[1024]; int result = 0; @@ -76,3 +76,6 @@ main (int argc, char *argv[]) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c index a469208a49..b985990822 100644 --- a/stdlib/tst-strtod.c +++ b/stdlib/tst-strtod.c @@ -81,8 +81,8 @@ static void expand (char *dst, int c); static int long_dbl (void); static int locale_test (void); -int -main (int argc, char ** argv) +static int +do_test (void) { char buf[100]; const struct ltest *lt; @@ -276,3 +276,6 @@ locale_test (void) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/string/tst-strlen.c b/string/tst-strlen.c index 8cbe441975..8376831de5 100644 --- a/string/tst-strlen.c +++ b/string/tst-strlen.c @@ -5,8 +5,8 @@ #include #include -int -main(int argc, char *argv[]) +static int +do_test (void) { static const size_t lens[] = { 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4 }; @@ -53,3 +53,6 @@ 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" diff --git a/string/tst-svc.c b/string/tst-svc.c index 1ee5342aa9..1b0da3efe5 100644 --- a/string/tst-svc.c +++ b/string/tst-svc.c @@ -13,8 +13,8 @@ compare (const void *p1, const void *p2) return strverscmp (*((char **) p1), *((char **) p2)); } -int -main (int argc, char *argv[]) +static int +do_test (void) { char line[MAX_LINE_SIZE + 1]; char *str[MAX_STRINGS]; @@ -43,3 +43,6 @@ main (int argc, char *argv[]) return EXIT_SUCCESS; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/time/tst-strptime.c b/time/tst-strptime.c index 8c0a947ad9..9a2199f875 100644 --- a/time/tst-strptime.c +++ b/time/tst-strptime.c @@ -124,8 +124,8 @@ test_tm (void) } -int -main (int argc, char *argv[]) +static int +do_test (void) { struct tm tm; size_t i; @@ -194,3 +194,6 @@ main (int argc, char *argv[]) return result; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/timezone/tst-timezone.c b/timezone/tst-timezone.c index 7152809d6c..0223a801ef 100644 --- a/timezone/tst-timezone.c +++ b/timezone/tst-timezone.c @@ -87,8 +87,8 @@ check_tzvars (const char *name, int dayl, int timez, const char *const tznam[]) } -int -main (int argc, char ** argv) +static int +do_test (void) { time_t t; const struct test_times *pt; @@ -166,3 +166,6 @@ main (int argc, char ** argv) return failed ? EXIT_FAILURE : EXIT_SUCCESS; } + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c"