From 17b4c12a95d762fc786754be9d663135e5d582d7 Mon Sep 17 00:00:00 2001 From: Denis Vlasenko Date: Wed, 24 Dec 2008 22:46:06 +0000 Subject: test/regex: make it faster to rebuild and run regex testcase --- test/regex/Makefile | 11 ----------- test/regex/testregex.c | 32 +++++++++++++++++++++++++++++--- test/regex/testregexc.c | 1 - test/regex/testregexf.c | 1 - test/regex/testregexi.c | 1 - test/regex/testregexl.c | 1 - test/regex/testregexn.c | 1 - test/regex/testregexp.c | 1 - test/regex/testregexr.c | 1 - 9 files changed, 29 insertions(+), 21 deletions(-) delete mode 100644 test/regex/testregexc.c delete mode 100644 test/regex/testregexf.c delete mode 100644 test/regex/testregexi.c delete mode 100644 test/regex/testregexl.c delete mode 100644 test/regex/testregexn.c delete mode 100644 test/regex/testregexp.c delete mode 100644 test/regex/testregexr.c diff --git a/test/regex/Makefile b/test/regex/Makefile index f443d72f2..afafc680f 100644 --- a/test/regex/Makefile +++ b/test/regex/Makefile @@ -1,15 +1,4 @@ # uClibc regex tests # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. -#TESTS_DISABLED := testregexi testregexn - include ../Test.mak - -OPTS_testregex := < basic.dat -OPTS_testregexc := < categorize.dat -OPTS_testregexf := < forcedassoc.dat -OPTS_testregexi := -c < interpretation.dat -OPTS_testregexl := < leftassoc.dat -OPTS_testregexn := -c < nullsubexpr.dat -OPTS_testregexp := < repetition.dat -OPTS_testregexr := < rightassoc.dat diff --git a/test/regex/testregex.c b/test/regex/testregex.c index 3992c2647..993ac2687 100644 --- a/test/regex/testregex.c +++ b/test/regex/testregex.c @@ -298,7 +298,7 @@ H("\n"); #define streq(a,b) (*(a)==*(b)&&!strcmp(a,b)) #endif -#define HUNG 2 +#define HUNG 5 #define NOTEST (~0) #ifndef REG_TEST_DEFAULT @@ -1111,7 +1111,7 @@ catchfree(regex_t* preg, int flags, int* tabs, char* spec, char* re, char* s, ch } int -main(int argc, char** argv) +old_main(int unused_param_argc, char** argv) { int flags; int cflags; @@ -2103,7 +2103,7 @@ main(int argc, char** argv) printf(" %-.*s", subunitlen, subunit); printf(", %d test%s", testno, testno == 1 ? "" : "s"); if (state.ignored) - printf(", %d ignored mismatche%s", state.ignored, state.ignored == 1 ? "" : "s"); + printf(", %d ignored mismatch%s", state.ignored, state.ignored == 1 ? "" : "es"); if (state.warnings) printf(", %d warning%s", state.warnings, state.warnings == 1 ? "" : "s"); if (state.unspecified) @@ -2117,3 +2117,29 @@ main(int argc, char** argv) } return 0; } + +int main(int argc, char **argv) +{ + static char *param[][4] = { + { NULL, "basic.dat" , NULL }, + { NULL, "categorize.dat" , NULL }, + { NULL, "forcedassoc.dat" , NULL }, + { NULL, "-c", "interpretation.dat", NULL }, + { NULL, "leftassoc.dat" , NULL }, + { NULL, "-c", "nullsubexpr.dat" , NULL }, + { NULL, "repetition.dat" , NULL }, + { NULL, "rightassoc.dat" , NULL }, + }; + int r, i; + + if (argv[1]) + return old_main(argc, argv); + + r = 0; + for (i = 0; i < sizeof(param) / sizeof(param[0]); i++) { + param[i][0] = argv[0]; + printf("Testing %s\n", param[i][1][0] != '-' ? param[i][1] : param[i][2]); + r |= old_main(3 /* not used */, param[i]); + } + return r; +} diff --git a/test/regex/testregexc.c b/test/regex/testregexc.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexc.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexf.c b/test/regex/testregexf.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexf.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexi.c b/test/regex/testregexi.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexi.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexl.c b/test/regex/testregexl.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexl.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexn.c b/test/regex/testregexn.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexn.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexp.c b/test/regex/testregexp.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexp.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" diff --git a/test/regex/testregexr.c b/test/regex/testregexr.c deleted file mode 100644 index 46b3ee848..000000000 --- a/test/regex/testregexr.c +++ /dev/null @@ -1 +0,0 @@ -#include "testregex.c" -- cgit v1.2.3