always enable regex tests when included regex is used
2004-11-03 Paolo Bonzini <bonzini@gnu * bug-regex11.c: Improve portability. * bug-regex12.c: Improve portability. * bug-regex13.c: Improve portability. * bug-regex14.c: Improve portability. * bug-regex21.c: Improve portability. * bug-regex9.c: Improve portability. * tst-boost.c: Improve portability. * tst-pcre.c: Improve portability. * tst-regex.c: Improve portability. * tst-rxspencer.c: Improve portability. git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-9
This commit is contained in:
1 parent
8219cef2eb
commit
fdf570a596
15 files changed
+105
-25
No files matched your search
@@ -1,3 +1,16 @@
|
||||
2004-11-03 Paolo Bonzini <bonzini@gnu
|
||||
|
||||
* bug-regex11.c: Improve portability.
|
||||
* bug-regex12.c: Improve portability.
|
||||
* bug-regex13.c: Improve portability.
|
||||
* bug-regex14.c: Improve portability.
|
||||
* bug-regex21.c: Improve portability.
|
||||
* bug-regex9.c: Improve portability.
|
||||
* tst-boost.c: Improve portability.
|
||||
* tst-pcre.c: Improve portability.
|
||||
* tst-regex.c: Improve portability.
|
||||
* tst-rxspencer.c: Improve portability.
|
||||
|
||||
2004-10-08 Paolo Bonzini <bonzini@gnu.org>
|
||||
|
||||
* lib/utils.c (utils_id_s): Renamed to open_files.
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
+11
-7
@@ -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)], ,
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -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;
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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 <sys/types.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -32,7 +36,9 @@ main (void)
|
||||
size_t i;
|
||||
int ret = 0;
|
||||
|
||||
#ifdef HAVE_MCHECK_H
|
||||
mtrace ();
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 100; ++i)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/* Test for memory/CPU leak in regcomp. */
|
||||
|
||||
#include <error.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -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 <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
|
||||
@@ -28,7 +32,9 @@ int main (void)
|
||||
int i;
|
||||
int ret = 0;
|
||||
|
||||
#ifdef HAVE_MCHECK_H
|
||||
mtrace ();
|
||||
#endif
|
||||
|
||||
for (i = 0; i < 32; ++i)
|
||||
{
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -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)
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
+17
-11
@@ -18,8 +18,12 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -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, "<unset>") != 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;
|
||||
|
||||
Binary file not shown.
@@ -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 <alloca.h>
|
||||
#include <assert.h>
|
||||
@@ -24,7 +26,9 @@
|
||||
#include <fcntl.h>
|
||||
#include <iconv.h>
|
||||
#include <locale.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -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);
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_MCHECK_H
|
||||
#include <mcheck.h>
|
||||
#endif
|
||||
#include <regex.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user