| 1 |
#! /bin/sh |
#! /bin/sh |
| 2 |
|
|
|
# This file is generated by configure from RunGrepTest.in. Make any changes |
|
|
# to that file. |
|
|
|
|
|
echo "Testing pcregrep" |
|
|
./pcregrep -V |
|
|
|
|
| 3 |
# Run pcregrep tests. The assumption is that the PCRE tests check the library |
# Run pcregrep tests. The assumption is that the PCRE tests check the library |
| 4 |
# itself. What we are checking here is the file handling and options that are |
# itself. What we are checking here is the file handling and options that are |
| 5 |
# supported by pcregrep. |
# supported by pcregrep. |
| 6 |
|
|
| 7 |
cf=diff |
# Set the C locale, so that sort(1) behaves predictably. |
| 8 |
|
LC_ALL=C |
| 9 |
|
export LC_ALL |
| 10 |
|
|
| 11 |
|
pcregrep=`pwd`/pcregrep |
| 12 |
|
|
| 13 |
|
echo " " |
| 14 |
|
echo "Testing pcregrep" |
| 15 |
|
$pcregrep -V |
| 16 |
|
|
| 17 |
|
cf="diff -ub" |
| 18 |
valgrind= |
valgrind= |
|
if [ ! -d testdata ] ; then |
|
|
ln -s @top_srcdir@/testdata testdata |
|
|
fi |
|
|
testdata=./testdata |
|
| 19 |
|
|
| 20 |
while [ $# -gt 0 ] ; do |
while [ $# -gt 0 ] ; do |
| 21 |
case $1 in |
case $1 in |
| 22 |
valgrind) valgrind="valgrind -q --leak-check=no";; |
valgrind) valgrind="valgrind -q --leak-check=no";; |
| 23 |
*) echo "Unknown argument $1"; exit 1;; |
*) echo "Unknown argument $1"; exit 1;; |
| 24 |
esac |
esac |
| 25 |
shift |
shift |
| 26 |
done |
done |
| 27 |
|
|
| 28 |
|
# If PCRE has been built in a directory other than the source directory, and |
| 29 |
|
# this test is being run from "make check" as usual, then $(srcdir) will be |
| 30 |
|
# set. If not, set it to the current directory. We then arrange to run the |
| 31 |
|
# pcregrep command in the source directory so that the file names that appear |
| 32 |
|
# in the output are always the same. |
| 33 |
|
|
| 34 |
|
if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then |
| 35 |
|
srcdir=. |
| 36 |
|
fi |
| 37 |
|
|
| 38 |
|
# Check for the availability of UTF-8 support |
| 39 |
|
|
| 40 |
./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null |
./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null |
| 41 |
no_utf8=$? |
utf8=$? |
| 42 |
|
|
| 43 |
echo "---------------------------- Test 1 ------------------------------" >testtry |
echo "---------------------------- Test 1 ------------------------------" >testtry |
| 44 |
$valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep PATTERN ./testdata/grepinput) >>testtry |
| 45 |
|
|
| 46 |
echo "---------------------------- Test 2 ------------------------------" >>testtry |
echo "---------------------------- Test 2 ------------------------------" >>testtry |
| 47 |
$valgrind ./pcregrep '^PATTERN' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep '^PATTERN' ./testdata/grepinput) >>testtry |
| 48 |
|
|
| 49 |
echo "---------------------------- Test 3 ------------------------------" >>testtry |
echo "---------------------------- Test 3 ------------------------------" >>testtry |
| 50 |
$valgrind ./pcregrep -in PATTERN $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -in PATTERN ./testdata/grepinput) >>testtry |
| 51 |
|
|
| 52 |
echo "---------------------------- Test 4 ------------------------------" >>testtry |
echo "---------------------------- Test 4 ------------------------------" >>testtry |
| 53 |
$valgrind ./pcregrep -ic PATTERN $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -ic PATTERN ./testdata/grepinput) >>testtry |
| 54 |
|
|
| 55 |
echo "---------------------------- Test 5 ------------------------------" >>testtry |
echo "---------------------------- Test 5 ------------------------------" >>testtry |
| 56 |
$valgrind ./pcregrep -in PATTERN $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 57 |
|
|
| 58 |
echo "---------------------------- Test 6 ------------------------------" >>testtry |
echo "---------------------------- Test 6 ------------------------------" >>testtry |
| 59 |
$valgrind ./pcregrep -inh PATTERN $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 60 |
|
|
| 61 |
echo "---------------------------- Test 7 ------------------------------" >>testtry |
echo "---------------------------- Test 7 ------------------------------" >>testtry |
| 62 |
$valgrind ./pcregrep -il PATTERN $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 63 |
|
|
| 64 |
echo "---------------------------- Test 8 ------------------------------" >>testtry |
echo "---------------------------- Test 8 ------------------------------" >>testtry |
| 65 |
$valgrind ./pcregrep -l PATTERN $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 66 |
|
|
| 67 |
echo "---------------------------- Test 9 ------------------------------" >>testtry |
echo "---------------------------- Test 9 ------------------------------" >>testtry |
| 68 |
$valgrind ./pcregrep -q PATTERN $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 69 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 70 |
|
|
| 71 |
echo "---------------------------- Test 10 -----------------------------" >>testtry |
echo "---------------------------- Test 10 -----------------------------" >>testtry |
| 72 |
$valgrind ./pcregrep -q NEVER-PATTERN $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 73 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 74 |
|
|
| 75 |
echo "---------------------------- Test 11 -----------------------------" >>testtry |
echo "---------------------------- Test 11 -----------------------------" >>testtry |
| 76 |
$valgrind ./pcregrep -vn pattern $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -vn pattern ./testdata/grepinputx) >>testtry |
| 77 |
|
|
| 78 |
echo "---------------------------- Test 12 -----------------------------" >>testtry |
echo "---------------------------- Test 12 -----------------------------" >>testtry |
| 79 |
$valgrind ./pcregrep -ix pattern $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -ix pattern ./testdata/grepinputx) >>testtry |
| 80 |
|
|
| 81 |
echo "---------------------------- Test 13 -----------------------------" >>testtry |
echo "---------------------------- Test 13 -----------------------------" >>testtry |
| 82 |
$valgrind ./pcregrep -f$testdata/greplist $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -f./testdata/greplist ./testdata/grepinputx) >>testtry |
| 83 |
|
|
| 84 |
echo "---------------------------- Test 14 -----------------------------" >>testtry |
echo "---------------------------- Test 14 -----------------------------" >>testtry |
| 85 |
$valgrind ./pcregrep -w pat $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 86 |
|
|
| 87 |
echo "---------------------------- Test 15 -----------------------------" >>testtry |
echo "---------------------------- Test 15 -----------------------------" >>testtry |
| 88 |
$valgrind ./pcregrep 'abc^*' $testdata/grepinput 2>>testtry >>testtry |
(cd $srcdir; $valgrind $pcregrep 'abc^*' ./testdata/grepinput) 2>>testtry >>testtry |
| 89 |
|
|
| 90 |
echo "---------------------------- Test 16 -----------------------------" >>testtry |
echo "---------------------------- Test 16 -----------------------------" >>testtry |
| 91 |
$valgrind ./pcregrep abc $testdata/grepinput $testdata/nonexistfile 2>>testtry >>testtry |
(cd $srcdir; $valgrind $pcregrep abc ./testdata/grepinput ./testdata/nonexistfile) 2>>testtry >>testtry |
| 92 |
|
|
| 93 |
echo "---------------------------- Test 17 -----------------------------" >>testtry |
echo "---------------------------- Test 17 -----------------------------" >>testtry |
| 94 |
$valgrind ./pcregrep -M 'the\noutput' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -M 'the\noutput' ./testdata/grepinput) >>testtry |
| 95 |
|
|
| 96 |
echo "---------------------------- Test 18 -----------------------------" >>testtry |
echo "---------------------------- Test 18 -----------------------------" >>testtry |
| 97 |
$valgrind ./pcregrep -Mn '(the\noutput|dog\.\n--)' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtry |
| 98 |
|
|
| 99 |
echo "---------------------------- Test 19 -----------------------------" >>testtry |
echo "---------------------------- Test 19 -----------------------------" >>testtry |
| 100 |
$valgrind ./pcregrep -Mix 'Pattern' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -Mix 'Pattern' ./testdata/grepinputx) >>testtry |
| 101 |
|
|
| 102 |
echo "---------------------------- Test 20 -----------------------------" >>testtry |
echo "---------------------------- Test 20 -----------------------------" >>testtry |
| 103 |
$valgrind ./pcregrep -Mixn 'complete pair\nof lines' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtry |
| 104 |
|
|
| 105 |
echo "---------------------------- Test 21 -----------------------------" >>testtry |
echo "---------------------------- Test 21 -----------------------------" >>testtry |
| 106 |
$valgrind ./pcregrep -nA3 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -nA3 'four' ./testdata/grepinputx) >>testtry |
| 107 |
|
|
| 108 |
echo "---------------------------- Test 22 -----------------------------" >>testtry |
echo "---------------------------- Test 22 -----------------------------" >>testtry |
| 109 |
$valgrind ./pcregrep -nB3 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -nB3 'four' ./testdata/grepinputx) >>testtry |
| 110 |
|
|
| 111 |
echo "---------------------------- Test 23 -----------------------------" >>testtry |
echo "---------------------------- Test 23 -----------------------------" >>testtry |
| 112 |
$valgrind ./pcregrep -C3 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -C3 'four' ./testdata/grepinputx) >>testtry |
| 113 |
|
|
| 114 |
echo "---------------------------- Test 24 -----------------------------" >>testtry |
echo "---------------------------- Test 24 -----------------------------" >>testtry |
| 115 |
$valgrind ./pcregrep -A9 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -A9 'four' ./testdata/grepinputx) >>testtry |
| 116 |
|
|
| 117 |
echo "---------------------------- Test 25 -----------------------------" >>testtry |
echo "---------------------------- Test 25 -----------------------------" >>testtry |
| 118 |
$valgrind ./pcregrep -nB9 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -nB9 'four' ./testdata/grepinputx) >>testtry |
| 119 |
|
|
| 120 |
echo "---------------------------- Test 26 -----------------------------" >>testtry |
echo "---------------------------- Test 26 -----------------------------" >>testtry |
| 121 |
$valgrind ./pcregrep -A9 -B9 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -A9 -B9 'four' ./testdata/grepinputx) >>testtry |
| 122 |
|
|
| 123 |
echo "---------------------------- Test 27 -----------------------------" >>testtry |
echo "---------------------------- Test 27 -----------------------------" >>testtry |
| 124 |
$valgrind ./pcregrep -A10 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -A10 'four' ./testdata/grepinputx) >>testtry |
| 125 |
|
|
| 126 |
echo "---------------------------- Test 28 -----------------------------" >>testtry |
echo "---------------------------- Test 28 -----------------------------" >>testtry |
| 127 |
$valgrind ./pcregrep -nB10 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -nB10 'four' ./testdata/grepinputx) >>testtry |
| 128 |
|
|
| 129 |
echo "---------------------------- Test 29 -----------------------------" >>testtry |
echo "---------------------------- Test 29 -----------------------------" >>testtry |
| 130 |
$valgrind ./pcregrep -C12 -B10 'four' $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -C12 -B10 'four' ./testdata/grepinputx) >>testtry |
| 131 |
|
|
| 132 |
echo "---------------------------- Test 30 -----------------------------" >>testtry |
echo "---------------------------- Test 30 -----------------------------" >>testtry |
| 133 |
$valgrind ./pcregrep -inB3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 134 |
|
|
| 135 |
echo "---------------------------- Test 31 -----------------------------" >>testtry |
echo "---------------------------- Test 31 -----------------------------" >>testtry |
| 136 |
$valgrind ./pcregrep -inA3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 137 |
|
|
| 138 |
echo "---------------------------- Test 32 -----------------------------" >>testtry |
echo "---------------------------- Test 32 -----------------------------" >>testtry |
| 139 |
$valgrind ./pcregrep -L 'fox' $testdata/grepinput $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtry |
| 140 |
|
|
| 141 |
echo "---------------------------- Test 33 -----------------------------" >>testtry |
echo "---------------------------- Test 33 -----------------------------" >>testtry |
| 142 |
$valgrind ./pcregrep 'fox' $testdata/grepnonexist >>testtry 2>&1 |
(cd $srcdir; $valgrind $pcregrep 'fox' ./testdata/grepnonexist) >>testtry 2>&1 |
| 143 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 144 |
|
|
| 145 |
echo "---------------------------- Test 34 -----------------------------" >>testtry |
echo "---------------------------- Test 34 -----------------------------" >>testtry |
| 146 |
$valgrind ./pcregrep -s 'fox' $testdata/grepnonexist >>testtry 2>&1 |
(cd $srcdir; $valgrind $pcregrep -s 'fox' ./testdata/grepnonexist) >>testtry 2>&1 |
| 147 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 148 |
|
|
| 149 |
echo "---------------------------- Test 35 -----------------------------" >>testtry |
echo "---------------------------- Test 35 -----------------------------" >>testtry |
| 150 |
$valgrind ./pcregrep -L -r --include=grepinputx 'fox' $testdata >>testtry |
(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx 'fox' ./testdata) >>testtry |
| 151 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 152 |
|
|
| 153 |
echo "---------------------------- Test 36 -----------------------------" >>testtry |
echo "---------------------------- Test 36 -----------------------------" >>testtry |
| 154 |
$valgrind ./pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' $testdata >>testtry |
(cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' ./testdata | sort) >>testtry |
| 155 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 156 |
|
|
| 157 |
echo "---------------------------- Test 37 -----------------------------" >>testtry |
echo "---------------------------- Test 37 -----------------------------" >>testtry |
| 158 |
$valgrind ./pcregrep '^(a+)*\d' $testdata/grepinput >>testtry 2>teststderr |
(cd $srcdir; $valgrind $pcregrep '^(a+)*\d' ./testdata/grepinput) >>testtry 2>teststderr |
| 159 |
echo "RC=$?" >>testtry |
echo "RC=$?" >>testtry |
| 160 |
echo "======== STDERR ========" >>testtry |
echo "======== STDERR ========" >>testtry |
| 161 |
cat teststderr >>testtry |
cat teststderr >>testtry |
| 162 |
|
|
| 163 |
echo "---------------------------- Test 38 ------------------------------" >>testtry |
echo "---------------------------- Test 38 ------------------------------" >>testtry |
| 164 |
$valgrind ./pcregrep '>\x00<' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep '>\x00<' ./testdata/grepinput) >>testtry |
| 165 |
|
|
| 166 |
echo "---------------------------- Test 39 ------------------------------" >>testtry |
echo "---------------------------- Test 39 ------------------------------" >>testtry |
| 167 |
$valgrind ./pcregrep -A1 'before the binary zero' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -A1 'before the binary zero' ./testdata/grepinput) >>testtry |
| 168 |
|
|
| 169 |
echo "---------------------------- Test 40 ------------------------------" >>testtry |
echo "---------------------------- Test 40 ------------------------------" >>testtry |
| 170 |
$valgrind ./pcregrep -B1 'after the binary zero' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -B1 'after the binary zero' ./testdata/grepinput) >>testtry |
| 171 |
|
|
| 172 |
echo "---------------------------- Test 41 ------------------------------" >>testtry |
echo "---------------------------- Test 41 ------------------------------" >>testtry |
| 173 |
$valgrind ./pcregrep -B1 -o '\w+ the binary zero' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtry |
| 174 |
|
|
| 175 |
echo "---------------------------- Test 41 ------------------------------" >>testtry |
echo "---------------------------- Test 41 ------------------------------" >>testtry |
| 176 |
$valgrind ./pcregrep -B1 -onH '\w+ the binary zero' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtry |
| 177 |
|
|
| 178 |
echo "---------------------------- Test 42 ------------------------------" >>testtry |
echo "---------------------------- Test 42 ------------------------------" >>testtry |
| 179 |
$valgrind ./pcregrep -on 'before|zero|after' $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput) >>testtry |
| 180 |
|
|
| 181 |
echo "---------------------------- Test 43 ------------------------------" >>testtry |
echo "---------------------------- Test 43 ------------------------------" >>testtry |
| 182 |
$valgrind ./pcregrep -on -e before -e zero -e after $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -on -e before -e zero -e after ./testdata/grepinput) >>testtry |
| 183 |
|
|
| 184 |
echo "---------------------------- Test 44 ------------------------------" >>testtry |
echo "---------------------------- Test 44 ------------------------------" >>testtry |
| 185 |
$valgrind ./pcregrep -on -f $testdata/greplist -e binary $testdata/grepinput >>testtry |
(cd $srcdir; $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtry |
| 186 |
|
|
| 187 |
echo "---------------------------- Test 45 ------------------------------" >>testtry |
echo "---------------------------- Test 45 ------------------------------" >>testtry |
| 188 |
$valgrind ./pcregrep -e abc -e '(unclosed' $testdata/grepinput 2>>testtry >>testtry |
(cd $srcdir; $valgrind $pcregrep -e abc -e '(unclosed' ./testdata/grepinput) 2>>testtry >>testtry |
| 189 |
|
|
| 190 |
echo "---------------------------- Test 46 ------------------------------" >>testtry |
echo "---------------------------- Test 46 ------------------------------" >>testtry |
| 191 |
$valgrind ./pcregrep -Fx "AB.VE |
(cd $srcdir; $valgrind $pcregrep -Fx "AB.VE |
| 192 |
elephant" $testdata/grepinput >>testtry |
elephant" ./testdata/grepinput) >>testtry |
| 193 |
|
|
| 194 |
echo "---------------------------- Test 47 ------------------------------" >>testtry |
echo "---------------------------- Test 47 ------------------------------" >>testtry |
| 195 |
$valgrind ./pcregrep -F "AB.VE |
(cd $srcdir; $valgrind $pcregrep -F "AB.VE |
| 196 |
elephant" $testdata/grepinput >>testtry |
elephant" ./testdata/grepinput) >>testtry |
| 197 |
|
|
| 198 |
echo "---------------------------- Test 48 ------------------------------" >>testtry |
echo "---------------------------- Test 48 ------------------------------" >>testtry |
| 199 |
$valgrind ./pcregrep -F -e DATA -e "AB.VE |
(cd $srcdir; $valgrind $pcregrep -F -e DATA -e "AB.VE |
| 200 |
elephant" $testdata/grepinput >>testtry |
elephant" ./testdata/grepinput) >>testtry |
| 201 |
|
|
| 202 |
echo "---------------------------- Test 49 ------------------------------" >>testtry |
echo "---------------------------- Test 49 ------------------------------" >>testtry |
| 203 |
$valgrind ./pcregrep "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
(cd $srcdir; $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry |
|
|
|
|
echo "---------------------------- Test 50 ------------------------------" >>testtry |
|
|
$valgrind ./pcregrep -N CR "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
|
|
|
|
|
echo "---------------------------- Test 51 ------------------------------" >>testtry |
|
|
$valgrind ./pcregrep --newline=crlf "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
|
|
|
|
|
echo "---------------------------- Test 52 ------------------------------" >>testtry |
|
|
$valgrind ./pcregrep --newline=cr -F "def
jkl" $testdata/grepinputx >>testtry |
|
|
|
|
|
echo "---------------------------- Test 53 ------------------------------" >>testtry |
|
|
$valgrind ./pcregrep --newline=crlf -F "xxx |
|
|
jkl" $testdata/grepinputx >>testtry |
|
|
|
|
|
echo "---------------------------- Test 54 ------------------------------" >>testtry |
|
|
$valgrind ./pcregrep -n --newline=any "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry |
|
| 204 |
|
|
| 205 |
# Now compare the results. |
# Now compare the results. |
| 206 |
|
|
| 207 |
$cf testtry $testdata/grepoutput |
$cf testtry $srcdir/testdata/grepoutput |
| 208 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 209 |
|
|
| 210 |
|
|
| 211 |
# These tests require UTF-8 support |
# These tests require UTF-8 support |
| 212 |
|
|
| 213 |
if [ $no_utf8 -ne 0 ] ; then |
if [ $utf8 -ne 0 ] ; then |
| 214 |
echo "Testing pcregrep UTF-8 features" |
echo "Testing pcregrep UTF-8 features" |
| 215 |
|
|
| 216 |
echo "---------------------------- Test U1 ------------------------------" >testtry |
echo "---------------------------- Test U1 ------------------------------" >testtry |
| 217 |
$valgrind ./pcregrep -n -u --newline=any "^X" $testdata/grepinput8 >>testtry |
(cd $srcdir; $valgrind $pcregrep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtry |
| 218 |
|
|
| 219 |
echo "---------------------------- Test U2 ------------------------------" >>testtry |
echo "---------------------------- Test U2 ------------------------------" >>testtry |
| 220 |
$valgrind ./pcregrep -n -u -C 3 --newline=any "Match" $testdata/grepinput8 >>testtry |
(cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtry |
| 221 |
|
|
| 222 |
$cf testtry $testdata/grepoutput8 |
$cf testtry $srcdir/testdata/grepoutput8 |
| 223 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
| 224 |
|
|
| 225 |
else |
else |
| 226 |
echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library" |
echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library" |
| 227 |
fi |
fi |
| 228 |
|
|
| 229 |
exit 0 |
|
| 230 |
|
# The tests for various newline values may not work in environments where |
| 231 |
|
# the newlines in the files are not \n. |
| 232 |
|
|
| 233 |
|
echo "Testing pcregrep newline settings" |
| 234 |
|
|
| 235 |
|
echo "---------------------------- Test N1 ------------------------------" >testtry |
| 236 |
|
(cd $srcdir; $valgrind $pcregrep -N CR "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry |
| 237 |
|
|
| 238 |
|
echo "---------------------------- Test N2 ------------------------------" >>testtry |
| 239 |
|
(cd $srcdir; $valgrind $pcregrep --newline=crlf "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry |
| 240 |
|
|
| 241 |
|
echo "---------------------------- Test N3 ------------------------------" >>testtry |
| 242 |
|
pattern=`printf 'def\rjkl'` |
| 243 |
|
(cd $srcdir; $valgrind $pcregrep --newline=cr -F "$pattern" ./testdata/grepinputx) >>testtry |
| 244 |
|
|
| 245 |
|
echo "---------------------------- Test n$ ------------------------------" >>testtry |
| 246 |
|
pattern=`printf 'xxx\r\njkl'` |
| 247 |
|
(cd $srcdir; $valgrind $pcregrep --newline=crlf -F "$pattern" ./testdata/grepinputx) >>testtry |
| 248 |
|
|
| 249 |
|
echo "---------------------------- Test N5 ------------------------------" >>testtry |
| 250 |
|
(cd $srcdir; $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry |
| 251 |
|
|
| 252 |
|
$cf testtry $srcdir/testdata/grepoutputN |
| 253 |
|
if [ $? != 0 ] ; then exit 1; fi |
| 254 |
|
|
| 255 |
|
exit 0 |
| 256 |
|
|
| 257 |
# End |
# End |