diff --git a/ChangeLog b/ChangeLog index f0f64d3..374ebfa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-11-03 Paolo Bonzini * lib/utils.c (utils_id_s): Renamed to open_files. diff --git a/NEWS b/NEWS index 68329bb..a4d271a 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,9 @@ Sed 4.1.3 * fixed `make check' in non-English locales. +* `make check' tests the regex library by default if the included regex + is used (regex tests had to be enabled separately up to now). + ---------------------------------------------------------------------------- Sed 4.1.2 diff --git a/configure.ac b/configure.ac index e08c9a3..2a866b8 100644 --- a/configure.ac +++ b/configure.ac @@ -43,7 +43,8 @@ int main() AC_HEADER_DIRENT AC_CHECK_HEADERS(io.h limits.h locale.h stdarg.h alloca.h stddef.h errno.h \ - wchar.h wctype.h sys/file.h, [], [], [AC_INCLUDES_DEFAULT]) + wchar.h wctype.h sys/file.h mcheck.h, [], [], + [AC_INCLUDES_DEFAULT]) AC_C_CONST AC_TYPE_SIZE_T AC_CHECK_TYPE(ssize_t, int) @@ -74,10 +75,6 @@ AC_ARG_WITH(included-regex, [ --with-included-regex use included regex matcher (default=yes)], , with_included_regex=yes) -AC_ARG_ENABLE(regex-tests, -[ --enable-regex-tests enable regex matcher regression tests (default=no)], , -enable_regex_tests=no) - if test "x$with_included_regex" = xno; then AC_CHECK_HEADERS(regex.h) AC_CHECK_LIB(regex, re_search) @@ -88,15 +85,22 @@ if test "x$with_included_regex" = xno; then fi fi -if test "x$with_included_regex" = xno; then +AC_ARG_ENABLE(regex-tests, +[ --enable-regex-tests enable regex matcher regression tests (default=no)], +[if test "x$with_included_regex" = xno; then enable_regex_tests=no -fi +fi], +enable_regex_tests=$with_included_regex) AM_CONDITIONAL(TEST_REGEX, test "x$enable_regex_tests" != xno) if test "x$with_included_regex" != xno; then AC_CONFIG_LINKS(lib/regex.h:lib/regex_.h) AC_LIBOBJ(regex) fi +if test "x$enable_regex_tests" = xyes; then + AC_DEFINE_UNQUOTED(_REGEX_RE_COMP, 1, + [Include BSD functions in regex, used by the testsuite]) +fi AC_ARG_ENABLE(html, [ --enable-html build HTML manual (default=no)], , diff --git a/testsuite/bug-regex11.c b/testsuite/bug-regex11.c index 29fa7de..0db7bdc 100644 --- a/testsuite/bug-regex11.c +++ b/testsuite/bug-regex11.c @@ -18,8 +18,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -94,7 +98,9 @@ main (void) size_t i; int n, ret = 0; +#ifdef HAVE_MCHECK_H mtrace (); +#endif for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) { @@ -103,14 +109,14 @@ main (void) { char buf[500]; regerror (n, &re, buf, sizeof (buf)); - printf ("%s: regcomp %zd failed: %s\n", tests[i].pattern, i, buf); + printf ("%s: regcomp %lu failed: %s\n", tests[i].pattern, i, buf); ret = 1; continue; } if (regexec (&re, tests[i].string, tests[i].nmatch, rm, 0)) { - printf ("%s: regexec %zd failed\n", tests[i].pattern, i); + printf ("%s: regexec %lu failed\n", tests[i].pattern, i); ret = 1; regfree (&re); continue; @@ -122,7 +128,7 @@ main (void) { if (tests[i].rm[n].rm_so == -1 && tests[i].rm[n].rm_eo == -1) break; - printf ("%s: regexec %zd match failure rm[%d] %d..%d\n", + printf ("%s: regexec %lu match failure rm[%d] %d..%d\n", tests[i].pattern, i, n, rm[n].rm_so, rm[n].rm_eo); ret = 1; break; diff --git a/testsuite/bug-regex12.c b/testsuite/bug-regex12.c index 0ad063e..77f33f0 100644 --- a/testsuite/bug-regex12.c +++ b/testsuite/bug-regex12.c @@ -18,8 +18,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -45,7 +49,9 @@ main (void) size_t i; int n, ret = 0; +#ifdef HAVE_MCHECK_H mtrace (); +#endif for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) { @@ -54,7 +60,7 @@ main (void) { char buf[500]; regerror (n, &re, buf, sizeof (buf)); - printf ("regcomp %zd failed: %s\n", i, buf); + printf ("regcomp %lu failed: %s\n", i, buf); ret = 1; continue; } @@ -62,7 +68,7 @@ main (void) if (! regexec (&re, tests[i].string, tests[i].nmatch, tests[i].nmatch ? rm : NULL, 0)) { - printf ("regexec %zd incorrectly matched\n", i); + printf ("regexec %lu incorrectly matched\n", i); ret = 1; } diff --git a/testsuite/bug-regex13.c b/testsuite/bug-regex13.c index df1c95d..1c8efd6 100644 --- a/testsuite/bug-regex13.c +++ b/testsuite/bug-regex13.c @@ -18,8 +18,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -71,7 +75,9 @@ main (void) size_t i; int ret = 0; +#ifdef HAVE_MCHECK_H mtrace (); +#endif for (i = 0; i < sizeof (tests) / sizeof (tests[0]); ++i) { diff --git a/testsuite/bug-regex14.c b/testsuite/bug-regex14.c index 91ff32a..0a3a41e 100644 --- a/testsuite/bug-regex14.c +++ b/testsuite/bug-regex14.c @@ -18,9 +18,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #define _REGEX_RE_COMP #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -32,7 +36,9 @@ main (void) size_t i; int ret = 0; +#ifdef HAVE_MCHECK_H mtrace (); +#endif for (i = 0; i < 100; ++i) { diff --git a/testsuite/bug-regex15.c b/testsuite/bug-regex15.c index 10526b1..c7eddf7 100644 --- a/testsuite/bug-regex15.c +++ b/testsuite/bug-regex15.c @@ -1,8 +1,8 @@ /* Test for memory/CPU leak in regcomp. */ -#include -#include #include +#include +#include #include #include #include diff --git a/testsuite/bug-regex21.c b/testsuite/bug-regex21.c index d67c4fe..1446410 100644 --- a/testsuite/bug-regex21.c +++ b/testsuite/bug-regex21.c @@ -18,7 +18,11 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + +#ifdef HAVE_MCHECK_H #include +#endif #include #include @@ -28,7 +32,9 @@ int main (void) int i; int ret = 0; +#ifdef HAVE_MCHECK_H mtrace (); +#endif for (i = 0; i < 32; ++i) { diff --git a/testsuite/bug-regex9.c b/testsuite/bug-regex9.c index 5a32668..4ddc0e1 100644 --- a/testsuite/bug-regex9.c +++ b/testsuite/bug-regex9.c @@ -18,8 +18,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -34,7 +38,9 @@ main (void) regmatch_t rm[2]; int n; +#ifdef HAVE_MCHECK_H mtrace (); +#endif n = regcomp (&re, "^#! */.*/(k|ba||pdk|z)sh", REG_EXTENDED); if (n != 0) diff --git a/testsuite/tst-boost.c b/testsuite/tst-boost.c index 8446a2e..5d41c12 100644 --- a/testsuite/tst-boost.c +++ b/testsuite/tst-boost.c @@ -18,8 +18,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -82,7 +86,9 @@ main (int argc, char **argv) regex_t re; regmatch_t rm[20]; +#ifdef HAVE_MCHECK_H mtrace (); +#endif if (argc < 2) { diff --git a/testsuite/tst-pcre.c b/testsuite/tst-pcre.c index 3780a09..777c99d 100644 --- a/testsuite/tst-pcre.c +++ b/testsuite/tst-pcre.c @@ -18,8 +18,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -40,7 +44,9 @@ main (int argc, char **argv) int pattern_valid = 0, rm_valid = 0; size_t linenum; +#ifdef HAVE_MCHECK_H mtrace (); +#endif if (argc < 2) { @@ -97,7 +103,7 @@ main (int argc, char **argv) rm_valid = 0; if (p == NULL) { - printf ("%zd: Invalid pattern line: %s\n", linenum, line); + printf ("%lu: Invalid pattern line: %s\n", linenum, line); ret = 1; continue; } @@ -106,7 +112,7 @@ main (int argc, char **argv) ignorecase = 1; else if (p[1] != '\0') { - printf ("%zd: Invalid pattern line: %s\n", linenum, line); + printf ("%lu: Invalid pattern line: %s\n", linenum, line); ret = 1; continue; } @@ -116,7 +122,7 @@ main (int argc, char **argv) pattern = realloc (pattern, p - line); if (pattern == NULL) { - printf ("%zd: Cannot record pattern: %m\n", linenum); + printf ("%lu: Cannot record pattern: %m\n", linenum); ret = 1; break; } @@ -136,7 +142,7 @@ main (int argc, char **argv) if (!pattern_valid) { - printf ("%zd: No previous valid pattern %s\n", linenum, line); + printf ("%lu: No previous valid pattern %s\n", linenum, line); continue; } @@ -145,7 +151,7 @@ main (int argc, char **argv) string = realloc (string, len - 3); if (string == NULL) { - printf ("%zd: Cannot record search string: %m\n", linenum); + printf ("%lu: Cannot record search string: %m\n", linenum); ret = 1; break; } @@ -160,7 +166,7 @@ main (int argc, char **argv) { char buf[500]; regerror (n, &re, buf, sizeof (buf)); - printf ("%zd: regcomp failed for %s: %s\n", + printf ("%lu: regcomp failed for %s: %s\n", linenum, pattern, buf); ret = 1; continue; @@ -179,7 +185,7 @@ main (int argc, char **argv) if (!rm_valid) { - printf ("%zd: No preceeding pattern or search string\n", linenum); + printf ("%lu: No preceeding pattern or search string\n", linenum); ret = 1; continue; } @@ -188,7 +194,7 @@ main (int argc, char **argv) { if (rm[0].rm_so != -1 || rm[0].rm_eo != -1) { - printf ("%zd: /%s/ on %s unexpectedly matched %d..%d\n", + printf ("%lu: /%s/ on %s unexpectedly matched %d..%d\n", linenum, pattern, string, rm[0].rm_so, rm[0].rm_eo); ret = 1; } @@ -203,7 +209,7 @@ main (int argc, char **argv) num = strtoul (p, &p, 10); if (num >= 20 || *p != ':' || p[1] != ' ') { - printf ("%zd: Invalid line %s\n", linenum, line); + printf ("%lu: Invalid line %s\n", linenum, line); ret = 1; continue; } @@ -212,7 +218,7 @@ main (int argc, char **argv) { if (strcmp (p + 2, "") != 0) { - printf ("%zd: /%s/ on %s unexpectedly failed to match register %ld %d..%d\n", + printf ("%lu: /%s/ on %s unexpectedly failed to match register %ld %d..%d\n", linenum, pattern, string, num, rm[num].rm_so, rm[num].rm_eo); ret = 1; @@ -225,7 +231,7 @@ main (int argc, char **argv) || strncmp (p + 2, string + rm[num].rm_so, rm[num].rm_eo - rm[num].rm_so) != 0) { - printf ("%zd: /%s/ on %s unexpectedly failed to match %s for register %ld %d..%d\n", + printf ("%lu: /%s/ on %s unexpectedly failed to match %s for register %ld %d..%d\n", linenum, pattern, string, p + 2, num, rm[num].rm_so, rm[num].rm_eo); ret = 1; diff --git a/testsuite/tst-regex b/testsuite/tst-regex deleted file mode 100755 index 5d596c5..0000000 Binary files a/testsuite/tst-regex and /dev/null differ diff --git a/testsuite/tst-regex.c b/testsuite/tst-regex.c index 3c62b66..a016f31 100644 --- a/testsuite/tst-regex.c +++ b/testsuite/tst-regex.c @@ -16,6 +16,8 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #define _GNU_SOURCE 1 #include #include @@ -24,7 +26,9 @@ #include #include #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -58,7 +62,9 @@ main (int argc, char *argv[]) size_t inlen; size_t outlen; +#ifdef HAVE_MCHECK_H mtrace (); +#endif if (!argv[1]) exit (1); diff --git a/testsuite/tst-rxspencer.c b/testsuite/tst-rxspencer.c index 1d3e90e..5ab2e1a 100644 --- a/testsuite/tst-rxspencer.c +++ b/testsuite/tst-rxspencer.c @@ -18,8 +18,12 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +#include "config.h" + #include +#ifdef HAVE_MCHECK_H #include +#endif #include #include #include @@ -409,7 +413,9 @@ main (int argc, char **argv) {NULL, 0, NULL, 0 } }; +#ifdef HAVE_MCHECK_H mtrace (); +#endif while (getopt_long (argc, argv, "", options, NULL) >= 0);