Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jul 2011 14:41:08 +0000 (UTC)
From:      Gabor Kovesdan <gabor@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r224186 - in user/gabor/tre-integration/tools/test/regex: . regmatch
Message-ID:  <201107181441.p6IEf849027076@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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();
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201107181441.p6IEf849027076>