diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2012-08-27 11:20:22 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2012-08-27 11:20:22 +0000 |
commit | 68d8f7c667b7438a2d8754e0f1ca2be39f0c239a (patch) | |
tree | 7308205b82e0d4c1ec5e7ba3c3f0380ad2d82530 /RunGrepTest | |
parent | d3011fc1d300f091ee157a07123ab91296f5de56 (diff) | |
download | pcre-68d8f7c667b7438a2d8754e0f1ca2be39f0c239a.tar.gz |
Fix RunGrepTest so that it runs in a non-source build directory. Recent changes
broke it.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1018 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'RunGrepTest')
-rwxr-xr-x | RunGrepTest | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/RunGrepTest b/RunGrepTest index 493fc73..3450123 100755 --- a/RunGrepTest +++ b/RunGrepTest @@ -2,7 +2,7 @@ # Run pcregrep tests. The assumption is that the PCRE tests check the library # itself. What we are checking here is the file handling and options that are -# supported by pcregrep. +# supported by pcregrep. This script must be run in the build directory. # Set the C locale, so that sort(1) behaves predictably. @@ -14,9 +14,11 @@ export LC_ALL unset PCREGREP_COLOUR PCREGREP_COLOR unset cp ls mv rm -# Set the program to be tested, and valgrind settings when requested. +# Remember the current (build) directory, set the program to be tested, and +# valgrind settings when requested. -pcregrep=`pwd`/pcregrep +builddir=`pwd` +pcregrep=$builddir/pcregrep valgrind= while [ $# -gt 0 ] ; do @@ -28,14 +30,13 @@ while [ $# -gt 0 ] ; do done echo " " +pcregrep_version=`$pcregrep -V` if [ "$valgrind" = "" ] ; then - echo "Testing pcregrep" + echo "Testing $pcregrep_version" else - echo "Testing pcregrep using valgrind" + echo "Testing $pcregrep_version using valgrind" fi -$pcregrep -V - # Set up a suitable "diff" command for comparison. Some systems have a diff # that lacks a -u option. Try to deal with this; better do the test for the -b # option as well. @@ -45,12 +46,10 @@ diff -b /dev/null /dev/null 2>/dev/null && cf="diff -b" diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u" diff -ub /dev/null /dev/null 2>/dev/null && cf="diff -ub" -# If PCRE has been built in a directory other than the source directory, and -# this test is being run from "make check" as usual, then $srcdir will be -# set. If not, set it to the current or parent directory, whichever one -# contains the test data. We then arrange to run the pcregrep command in the -# source directory so that the file names that appear in the output are always -# the same. +# If this test is being run from "make check", $srcdir will be set. If not, set +# it to the current or parent directory, whichever one contains the test data. +# Subsequently, we run most of the pcregrep tests in the source directory so +# that the file names in the output are always the same. if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then if [ -d "./testdata" ] ; then @@ -68,6 +67,8 @@ fi ./pcretest -C utf >/dev/null utf8=$? +echo "Testing pcregrep main features" + echo "---------------------------- Test 1 ------------------------------" >testtry (cd $srcdir; $valgrind $pcregrep PATTERN ./testdata/grepinput) >>testtry echo "RC=$?" >>testtry @@ -118,7 +119,7 @@ echo "RC=$?" >>testtry echo "---------------------------- Test 13 -----------------------------" >>testtry echo seventeen >testtemp1 -(cd $srcdir; $valgrind $pcregrep -f./testdata/greplist -f testtemp1 ./testdata/grepinputx) >>testtry +(cd $srcdir; $valgrind $pcregrep -f./testdata/greplist -f $builddir/testtemp1 ./testdata/grepinputx) >>testtry echo "RC=$?" >>testtry echo "---------------------------- Test 14 -----------------------------" >>testtry @@ -408,7 +409,7 @@ echo "RC=$?" >>testtry echo "---------------------------- Test 84 -----------------------------" >>testtry echo testdata/grepinput3 >testtemp1 -(cd $srcdir; $valgrind $pcregrep --file-list ./testdata/grepfilelist --file-list testtemp1 "fox|complete|t7") >>testtry 2>&1 +(cd $srcdir; $valgrind $pcregrep --file-list ./testdata/grepfilelist --file-list $builddir/testtemp1 "fox|complete|t7") >>testtry 2>&1 echo "RC=$?" >>testtry echo "---------------------------- Test 85 -----------------------------" >>testtry @@ -462,19 +463,19 @@ echo "RC=$?" >>testtry echo "---------------------------- Test 97 -----------------------------" >>testtry echo "grepinput$" >testtemp1 echo "grepinput8" >>testtemp1 -(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude-from testtemp1 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtry +(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude-from $builddir/testtemp1 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtry echo "RC=$?" >>testtry echo "---------------------------- Test 98 -----------------------------" >>testtry echo "grepinput$" >testtemp1 echo "grepinput8" >>testtemp1 -(cd $srcdir; $valgrind $pcregrep -L -r --exclude=grepinput3 --include=grepinput --exclude-from testtemp1 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtry +(cd $srcdir; $valgrind $pcregrep -L -r --exclude=grepinput3 --include=grepinput --exclude-from $builddir/testtemp1 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtry echo "RC=$?" >>testtry echo "---------------------------- Test 99 -----------------------------" >>testtry echo "grepinput$" >testtemp1 echo "grepinput8" >testtemp2 -(cd $srcdir; $valgrind $pcregrep -L -r --include grepinput --exclude-from testtemp1 --exclude-from=testtemp2 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtry +(cd $srcdir; $valgrind $pcregrep -L -r --include grepinput --exclude-from $builddir/testtemp1 --exclude-from=$builddir/testtemp2 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtry echo "RC=$?" >>testtry # Now compare the results. @@ -509,7 +510,7 @@ fi # is not \n. Do not use exported files, whose line endings might be changed. # Instead, create an input file using printf so that its contents are exactly # what we want. Note the messy fudge to get printf to write a string that -# starts with a hyphen. +# starts with a hyphen. These tests are run in the build directory. echo "Testing pcregrep newline settings" printf "abc\rdef\r\nghi\njkl" >testNinput |