svn commit: r224186 - in user/gabor/tre-integration/tools/test/regex: . regmatch

Gabor Kovesdan gabor at FreeBSD.org
Mon Jul 18 14:41:09 UTC 2011


Author: gabor
Date: Mon Jul 18 14:41:08 2011
New Revision: 224186
URL: http://svn.freebsd.org/changeset/base/224186

Log:
  - Add support for extended regex matching

Modified:
  user/gabor/tre-integration/tools/test/regex/Makefile
  user/gabor/tre-integration/tools/test/regex/regmatch/regmatch.c

Modified: user/gabor/tre-integration/tools/test/regex/Makefile
==============================================================================
--- user/gabor/tre-integration/tools/test/regex/Makefile	Mon Jul 18 14:05:14 2011	(r224185)
+++ user/gabor/tre-integration/tools/test/regex/Makefile	Mon Jul 18 14:41:08 2011	(r224186)
@@ -2,16 +2,18 @@
 
 SUBDIR=	regmatch
 
-TESTS=bre.tests
+TESTS=	bre.tests
+TESTS+=	ere.tests
 
 test: regmatch
 .for t in ${TESTS}
 	@echo "=== Running test ${t} ==="
-	@for l in `cat tests/${t} | grep -ve '^#'`; do \
+	@flags=`grep '# *FLAGS' tests/${t} | sed 's|# *FLAGS *||g'`; \
+	for l in `cat tests/${t} | grep -ve '^#'`; do \
 		str=`echo $${l} | cut -d \; -f 2`; \
 		pat=`echo $${l} | cut -d \; -f 1`; \
 		match=`echo $${l} | cut -d \; -f 3`; \
-		result=`env LC_ALL=C ./regmatch/regmatch $${pat} $${str}`; \
+		result=`env LC_ALL=C REGTEST_FLAGS=$${flags} ./regmatch/regmatch $${pat} $${str}`; \
 		if [ "$${match}" != "$${result}" ]; then \
 			echo "Failed matching pattern $${pat} to string $${str}"; \
 		else \

Modified: user/gabor/tre-integration/tools/test/regex/regmatch/regmatch.c
==============================================================================
--- user/gabor/tre-integration/tools/test/regex/regmatch/regmatch.c	Mon Jul 18 14:05:14 2011	(r224185)
+++ user/gabor/tre-integration/tools/test/regex/regmatch/regmatch.c	Mon Jul 18 14:41:08 2011	(r224186)
@@ -45,10 +45,17 @@ main(int argc, char *argv[])
 {
 	regex_t pattern;
 	regmatch_t pmatch;
+	char *env;
 	ssize_t len;
 	int cflags = 0, ret;
 	int eflags = REG_STARTEND;
 
+	env = getenv("REGTEST_FLAGS");
+	if (strchr(env, 'E') != NULL)
+		cflags |= REG_EXTENDED;
+	if (strchr(env, 'F') != NULL)
+		cflags |= REG_NOSPEC;
+
 	if (argc != 3)
 		usage();
 


More information about the svn-src-user mailing list