| 14 |
echo "Testing pcregrep" |
echo "Testing pcregrep" |
| 15 |
$pcregrep -V |
$pcregrep -V |
| 16 |
|
|
|
cf="diff -ub" |
|
| 17 |
valgrind= |
valgrind= |
|
|
|
| 18 |
while [ $# -gt 0 ] ; do |
while [ $# -gt 0 ] ; do |
| 19 |
case $1 in |
case $1 in |
| 20 |
valgrind) valgrind="valgrind -q --leak-check=no";; |
valgrind) valgrind="valgrind -q --leak-check=no";; |
| 23 |
shift |
shift |
| 24 |
done |
done |
| 25 |
|
|
| 26 |
|
cf="diff -ub" |
| 27 |
|
|
| 28 |
|
# Set up a suitable "diff" command for comparison. Some systems have a diff |
| 29 |
|
# that lacks a -u option. Try to deal with this; better do the test for the -b |
| 30 |
|
# option as well. |
| 31 |
|
|
| 32 |
|
if diff -u /dev/null /dev/null; then |
| 33 |
|
if diff -ub /dev/null /dev/null; then cf="diff -ub"; else cf="diff -u"; fi |
| 34 |
|
else |
| 35 |
|
if diff -b /dev/null /dev/null; then cf="diff -b"; else cf="diff"; fi |
| 36 |
|
fi |
| 37 |
|
|
| 38 |
# If PCRE has been built in a directory other than the source directory, and |
# If PCRE has been built in a directory other than the source directory, and |
| 39 |
# this test is being run from "make check" as usual, then $(srcdir) will be |
# this test is being run from "make check" as usual, then $(srcdir) will be |
| 40 |
# set. If not, set it to the current directory. We then arrange to run the |
# set. If not, set it to the current directory. We then arrange to run the |
| 157 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 158 |
|
|
| 159 |
echo "---------------------------- Test 35 -----------------------------" >>testtry |
echo "---------------------------- Test 35 -----------------------------" >>testtry |
| 160 |
(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx 'fox' ./testdata) >>testtry |
(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx --exclude_dir='^\.' 'fox' ./testdata) >>testtry |
| 161 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 162 |
|
|
| 163 |
echo "---------------------------- Test 36 -----------------------------" >>testtry |
echo "---------------------------- Test 36 -----------------------------" >>testtry |
| 164 |
(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' ./testdata | sort) >>testtry |
(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude 'grepinput$' --exclude_dir='^\.' 'fox' ./testdata | sort) >>testtry |
| 165 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 166 |
|
|
| 167 |
echo "---------------------------- Test 37 -----------------------------" >>testtry |
echo "---------------------------- Test 37 -----------------------------" >>testtry |
| 189 |
(cd $srcdir; $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput) >>testtry |
(cd $srcdir; $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput) >>testtry |
| 190 |
|
|
| 191 |
echo "---------------------------- Test 43 ------------------------------" >>testtry |
echo "---------------------------- Test 43 ------------------------------" >>testtry |
| 192 |
(cd $srcdir; $valgrind $pcregrep -on -e before -e zero -e after ./testdata/grepinput) >>testtry |
(cd $srcdir; $valgrind $pcregrep -on -e before -ezero -e after ./testdata/grepinput) >>testtry |
| 193 |
|
|
| 194 |
echo "---------------------------- Test 44 ------------------------------" >>testtry |
echo "---------------------------- Test 44 ------------------------------" >>testtry |
| 195 |
(cd $srcdir; $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtry |
(cd $srcdir; $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtry |
| 196 |
|
|
| 197 |
echo "---------------------------- Test 45 ------------------------------" >>testtry |
echo "---------------------------- Test 45 ------------------------------" >>testtry |
| 198 |
(cd $srcdir; $valgrind $pcregrep -e abc -e '(unclosed' ./testdata/grepinput) 2>>testtry >>testtry |
(cd $srcdir; $valgrind $pcregrep -eabc -e '(unclosed' ./testdata/grepinput) 2>>testtry >>testtry |
| 199 |
|
|
| 200 |
echo "---------------------------- Test 46 ------------------------------" >>testtry |
echo "---------------------------- Test 46 ------------------------------" >>testtry |
| 201 |
(cd $srcdir; $valgrind $pcregrep -Fx "AB.VE |
(cd $srcdir; $valgrind $pcregrep -Fx "AB.VE |
| 224 |
echo "---------------------------- Test 53 ------------------------------" >>testtry |
echo "---------------------------- Test 53 ------------------------------" >>testtry |
| 225 |
(cd $srcdir; $valgrind $pcregrep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtry |
(cd $srcdir; $valgrind $pcregrep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtry |
| 226 |
|
|
| 227 |
|
echo "---------------------------- Test 54 -----------------------------" >>testtry |
| 228 |
|
(cd $srcdir; $valgrind $pcregrep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtry |
| 229 |
|
|
| 230 |
|
echo "---------------------------- Test 55 -----------------------------" >>testtry |
| 231 |
|
(cd $srcdir; $valgrind $pcregrep -c lazy ./testdata/grepinput*) >>testtry |
| 232 |
|
|
| 233 |
|
echo "---------------------------- Test 56 -----------------------------" >>testtry |
| 234 |
|
(cd $srcdir; $valgrind $pcregrep -c -l lazy ./testdata/grepinput*) >>testtry |
| 235 |
|
|
| 236 |
|
echo "---------------------------- Test 57 -----------------------------" >>testtry |
| 237 |
|
(cd $srcdir; $valgrind $pcregrep --regex=PATTERN ./testdata/grepinput) >>testtry |
| 238 |
|
|
| 239 |
|
echo "---------------------------- Test 58 -----------------------------" >>testtry |
| 240 |
|
(cd $srcdir; $valgrind $pcregrep --regexp=PATTERN ./testdata/grepinput) >>testtry |
| 241 |
|
|
| 242 |
|
echo "---------------------------- Test 59 -----------------------------" >>testtry |
| 243 |
|
(cd $srcdir; $valgrind $pcregrep --regex PATTERN ./testdata/grepinput) >>testtry |
| 244 |
|
|
| 245 |
|
echo "---------------------------- Test 60 -----------------------------" >>testtry |
| 246 |
|
(cd $srcdir; $valgrind $pcregrep --regexp PATTERN ./testdata/grepinput) >>testtry |
| 247 |
|
|
| 248 |
# Now compare the results. |
# Now compare the results. |
| 249 |
|
|
| 250 |
$cf $srcdir/testdata/grepoutput testtry |
$cf $srcdir/testdata/grepoutput testtry |