/[pcre]/code/trunk/RunGrepTest
ViewVC logotype

Contents of /code/trunk/RunGrepTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1651 - (show annotations)
Mon May 23 15:06:35 2016 UTC (2 months ago) by ph10
File size: 28887 byte(s)
Error occurred while calculating annotation data.
File tidies for 8.39-RC1.
1 #! /bin/sh
2
3 # 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
5 # supported by pcregrep. This script must be run in the build directory.
6
7 # Set the C locale, so that sort(1) behaves predictably.
8
9 LC_ALL=C
10 export LC_ALL
11
12 # Remove any non-default colouring and aliases that the caller may have set.
13
14 unset PCREGREP_COLOUR PCREGREP_COLOR
15 unset cp ls mv rm
16
17 # Remember the current (build) directory, set the program to be tested, and
18 # valgrind settings when requested.
19
20 builddir=`pwd`
21 pcregrep=$builddir/pcregrep
22
23 valgrind=
24 while [ $# -gt 0 ] ; do
25 case $1 in
26 valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all";;
27 *) echo "RunGrepTest: Unknown argument $1"; exit 1;;
28 esac
29 shift
30 done
31
32 echo " "
33 pcregrep_version=`$pcregrep -V`
34 if [ "$valgrind" = "" ] ; then
35 echo "Testing $pcregrep_version"
36 else
37 echo "Testing $pcregrep_version using valgrind"
38 fi
39
40 # Set up a suitable "diff" command for comparison. Some systems have a diff
41 # that lacks a -u option. Try to deal with this; better do the test for the -b
42 # option as well.
43
44 cf="diff"
45 diff -b /dev/null /dev/null 2>/dev/null && cf="diff -b"
46 diff -u /dev/null /dev/null 2>/dev/null && cf="diff -u"
47 diff -ub /dev/null /dev/null 2>/dev/null && cf="diff -ub"
48
49 # If this test is being run from "make check", $srcdir will be set. If not, set
50 # it to the current or parent directory, whichever one contains the test data.
51 # Subsequently, we run most of the pcregrep tests in the source directory so
52 # that the file names in the output are always the same.
53
54 if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
55 if [ -d "./testdata" ] ; then
56 srcdir=.
57 elif [ -d "../testdata" ] ; then
58 srcdir=..
59 else
60 echo "Cannot find the testdata directory"
61 exit 1
62 fi
63 fi
64
65 # Check for the availability of UTF-8 support
66
67 ./pcretest -C utf >/dev/null
68 utf8=$?
69
70 # We need valgrind suppressions when JIT is in use. (This isn't perfect because
71 # some tests are run with -no-jit, but as PCRE1 is in maintenance only, I have
72 # not bothered about that.)
73
74 ./pcretest -C jit >/dev/null
75 if [ $? -eq 1 -a "$valgrind" != "" ] ; then
76 valgrind="$valgrind --suppressions=./testdata/valgrind-jit.supp"
77 fi
78
79 echo "Testing pcregrep main features"
80
81 echo "---------------------------- Test 1 ------------------------------" >testtrygrep
82 (cd $srcdir; $valgrind $pcregrep PATTERN ./testdata/grepinput) >>testtrygrep
83 echo "RC=$?" >>testtrygrep
84
85 echo "---------------------------- Test 2 ------------------------------" >>testtrygrep
86 (cd $srcdir; $valgrind $pcregrep '^PATTERN' ./testdata/grepinput) >>testtrygrep
87 echo "RC=$?" >>testtrygrep
88
89 echo "---------------------------- Test 3 ------------------------------" >>testtrygrep
90 (cd $srcdir; $valgrind $pcregrep -in PATTERN ./testdata/grepinput) >>testtrygrep
91 echo "RC=$?" >>testtrygrep
92
93 echo "---------------------------- Test 4 ------------------------------" >>testtrygrep
94 (cd $srcdir; $valgrind $pcregrep -ic PATTERN ./testdata/grepinput) >>testtrygrep
95 echo "RC=$?" >>testtrygrep
96
97 echo "---------------------------- Test 5 ------------------------------" >>testtrygrep
98 (cd $srcdir; $valgrind $pcregrep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
99 echo "RC=$?" >>testtrygrep
100
101 echo "---------------------------- Test 6 ------------------------------" >>testtrygrep
102 (cd $srcdir; $valgrind $pcregrep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
103 echo "RC=$?" >>testtrygrep
104
105 echo "---------------------------- Test 7 ------------------------------" >>testtrygrep
106 (cd $srcdir; $valgrind $pcregrep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
107 echo "RC=$?" >>testtrygrep
108
109 echo "---------------------------- Test 8 ------------------------------" >>testtrygrep
110 (cd $srcdir; $valgrind $pcregrep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
111 echo "RC=$?" >>testtrygrep
112
113 echo "---------------------------- Test 9 ------------------------------" >>testtrygrep
114 (cd $srcdir; $valgrind $pcregrep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
115 echo "RC=$?" >>testtrygrep
116
117 echo "---------------------------- Test 10 -----------------------------" >>testtrygrep
118 (cd $srcdir; $valgrind $pcregrep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
119 echo "RC=$?" >>testtrygrep
120
121 echo "---------------------------- Test 11 -----------------------------" >>testtrygrep
122 (cd $srcdir; $valgrind $pcregrep -vn pattern ./testdata/grepinputx) >>testtrygrep
123 echo "RC=$?" >>testtrygrep
124
125 echo "---------------------------- Test 12 -----------------------------" >>testtrygrep
126 (cd $srcdir; $valgrind $pcregrep -ix pattern ./testdata/grepinputx) >>testtrygrep
127 echo "RC=$?" >>testtrygrep
128
129 echo "---------------------------- Test 13 -----------------------------" >>testtrygrep
130 echo seventeen >testtemp1grep
131 (cd $srcdir; $valgrind $pcregrep -f./testdata/greplist -f $builddir/testtemp1grep ./testdata/grepinputx) >>testtrygrep
132 echo "RC=$?" >>testtrygrep
133
134 echo "---------------------------- Test 14 -----------------------------" >>testtrygrep
135 (cd $srcdir; $valgrind $pcregrep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
136 echo "RC=$?" >>testtrygrep
137
138 echo "---------------------------- Test 15 -----------------------------" >>testtrygrep
139 (cd $srcdir; $valgrind $pcregrep 'abc^*' ./testdata/grepinput) 2>>testtrygrep >>testtrygrep
140 echo "RC=$?" >>testtrygrep
141
142 echo "---------------------------- Test 16 -----------------------------" >>testtrygrep
143 (cd $srcdir; $valgrind $pcregrep abc ./testdata/grepinput ./testdata/nonexistfile) 2>>testtrygrep >>testtrygrep
144 echo "RC=$?" >>testtrygrep
145
146 echo "---------------------------- Test 17 -----------------------------" >>testtrygrep
147 (cd $srcdir; $valgrind $pcregrep -M 'the\noutput' ./testdata/grepinput) >>testtrygrep
148 echo "RC=$?" >>testtrygrep
149
150 echo "---------------------------- Test 18 -----------------------------" >>testtrygrep
151 (cd $srcdir; $valgrind $pcregrep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtrygrep
152 echo "RC=$?" >>testtrygrep
153
154 echo "---------------------------- Test 19 -----------------------------" >>testtrygrep
155 (cd $srcdir; $valgrind $pcregrep -Mix 'Pattern' ./testdata/grepinputx) >>testtrygrep
156 echo "RC=$?" >>testtrygrep
157
158 echo "---------------------------- Test 20 -----------------------------" >>testtrygrep
159 (cd $srcdir; $valgrind $pcregrep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtrygrep
160 echo "RC=$?" >>testtrygrep
161
162 echo "---------------------------- Test 21 -----------------------------" >>testtrygrep
163 (cd $srcdir; $valgrind $pcregrep -nA3 'four' ./testdata/grepinputx) >>testtrygrep
164 echo "RC=$?" >>testtrygrep
165
166 echo "---------------------------- Test 22 -----------------------------" >>testtrygrep
167 (cd $srcdir; $valgrind $pcregrep -nB3 'four' ./testdata/grepinputx) >>testtrygrep
168 echo "RC=$?" >>testtrygrep
169
170 echo "---------------------------- Test 23 -----------------------------" >>testtrygrep
171 (cd $srcdir; $valgrind $pcregrep -C3 'four' ./testdata/grepinputx) >>testtrygrep
172 echo "RC=$?" >>testtrygrep
173
174 echo "---------------------------- Test 24 -----------------------------" >>testtrygrep
175 (cd $srcdir; $valgrind $pcregrep -A9 'four' ./testdata/grepinputx) >>testtrygrep
176 echo "RC=$?" >>testtrygrep
177
178 echo "---------------------------- Test 25 -----------------------------" >>testtrygrep
179 (cd $srcdir; $valgrind $pcregrep -nB9 'four' ./testdata/grepinputx) >>testtrygrep
180 echo "RC=$?" >>testtrygrep
181
182 echo "---------------------------- Test 26 -----------------------------" >>testtrygrep
183 (cd $srcdir; $valgrind $pcregrep -A9 -B9 'four' ./testdata/grepinputx) >>testtrygrep
184 echo "RC=$?" >>testtrygrep
185
186 echo "---------------------------- Test 27 -----------------------------" >>testtrygrep
187 (cd $srcdir; $valgrind $pcregrep -A10 'four' ./testdata/grepinputx) >>testtrygrep
188 echo "RC=$?" >>testtrygrep
189
190 echo "---------------------------- Test 28 -----------------------------" >>testtrygrep
191 (cd $srcdir; $valgrind $pcregrep -nB10 'four' ./testdata/grepinputx) >>testtrygrep
192 echo "RC=$?" >>testtrygrep
193
194 echo "---------------------------- Test 29 -----------------------------" >>testtrygrep
195 (cd $srcdir; $valgrind $pcregrep -C12 -B10 'four' ./testdata/grepinputx) >>testtrygrep
196 echo "RC=$?" >>testtrygrep
197
198 echo "---------------------------- Test 30 -----------------------------" >>testtrygrep
199 (cd $srcdir; $valgrind $pcregrep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
200 echo "RC=$?" >>testtrygrep
201
202 echo "---------------------------- Test 31 -----------------------------" >>testtrygrep
203 (cd $srcdir; $valgrind $pcregrep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
204 echo "RC=$?" >>testtrygrep
205
206 echo "---------------------------- Test 32 -----------------------------" >>testtrygrep
207 (cd $srcdir; $valgrind $pcregrep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
208 echo "RC=$?" >>testtrygrep
209
210 echo "---------------------------- Test 33 -----------------------------" >>testtrygrep
211 (cd $srcdir; $valgrind $pcregrep 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
212 echo "RC=$?" >>testtrygrep
213
214 echo "---------------------------- Test 34 -----------------------------" >>testtrygrep
215 (cd $srcdir; $valgrind $pcregrep -s 'fox' ./testdata/grepnonexist) >>testtrygrep 2>&1
216 echo "RC=$?" >>testtrygrep
217
218 echo "---------------------------- Test 35 -----------------------------" >>testtrygrep
219 (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx --include grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
220 echo "RC=$?" >>testtrygrep
221
222 echo "---------------------------- Test 36 -----------------------------" >>testtrygrep
223 (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude 'grepinput$' --exclude=grepinput8 --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
224 echo "RC=$?" >>testtrygrep
225
226 echo "---------------------------- Test 37 -----------------------------" >>testtrygrep
227 (cd $srcdir; $valgrind $pcregrep '^(a+)*\d' ./testdata/grepinput) >>testtrygrep 2>teststderrgrep
228 echo "RC=$?" >>testtrygrep
229 echo "======== STDERR ========" >>testtrygrep
230 cat teststderrgrep >>testtrygrep
231
232 echo "---------------------------- Test 38 ------------------------------" >>testtrygrep
233 (cd $srcdir; $valgrind $pcregrep '>\x00<' ./testdata/grepinput) >>testtrygrep
234 echo "RC=$?" >>testtrygrep
235
236 echo "---------------------------- Test 39 ------------------------------" >>testtrygrep
237 (cd $srcdir; $valgrind $pcregrep -A1 'before the binary zero' ./testdata/grepinput) >>testtrygrep
238 echo "RC=$?" >>testtrygrep
239
240 echo "---------------------------- Test 40 ------------------------------" >>testtrygrep
241 (cd $srcdir; $valgrind $pcregrep -B1 'after the binary zero' ./testdata/grepinput) >>testtrygrep
242 echo "RC=$?" >>testtrygrep
243
244 echo "---------------------------- Test 41 ------------------------------" >>testtrygrep
245 (cd $srcdir; $valgrind $pcregrep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
246 echo "RC=$?" >>testtrygrep
247
248 echo "---------------------------- Test 42 ------------------------------" >>testtrygrep
249 (cd $srcdir; $valgrind $pcregrep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtrygrep
250 echo "RC=$?" >>testtrygrep
251
252 echo "---------------------------- Test 43 ------------------------------" >>testtrygrep
253 (cd $srcdir; $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput) >>testtrygrep
254 echo "RC=$?" >>testtrygrep
255
256 echo "---------------------------- Test 44 ------------------------------" >>testtrygrep
257 (cd $srcdir; $valgrind $pcregrep -on -e before -ezero -e after ./testdata/grepinput) >>testtrygrep
258 echo "RC=$?" >>testtrygrep
259
260 echo "---------------------------- Test 45 ------------------------------" >>testtrygrep
261 (cd $srcdir; $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtrygrep
262 echo "RC=$?" >>testtrygrep
263
264 echo "---------------------------- Test 46 ------------------------------" >>testtrygrep
265 (cd $srcdir; $valgrind $pcregrep -eabc -e '(unclosed' ./testdata/grepinput) 2>>testtrygrep >>testtrygrep
266 echo "RC=$?" >>testtrygrep
267
268 echo "---------------------------- Test 47 ------------------------------" >>testtrygrep
269 (cd $srcdir; $valgrind $pcregrep -Fx "AB.VE
270 elephant" ./testdata/grepinput) >>testtrygrep
271 echo "RC=$?" >>testtrygrep
272
273 echo "---------------------------- Test 48 ------------------------------" >>testtrygrep
274 (cd $srcdir; $valgrind $pcregrep -F "AB.VE
275 elephant" ./testdata/grepinput) >>testtrygrep
276 echo "RC=$?" >>testtrygrep
277
278 echo "---------------------------- Test 49 ------------------------------" >>testtrygrep
279 (cd $srcdir; $valgrind $pcregrep -F -e DATA -e "AB.VE
280 elephant" ./testdata/grepinput) >>testtrygrep
281 echo "RC=$?" >>testtrygrep
282
283 echo "---------------------------- Test 50 ------------------------------" >>testtrygrep
284 (cd $srcdir; $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtrygrep
285 echo "RC=$?" >>testtrygrep
286
287 echo "---------------------------- Test 51 ------------------------------" >>testtrygrep
288 (cd $srcdir; $valgrind $pcregrep -Mv "brown\sfox" ./testdata/grepinputv) >>testtrygrep
289 echo "RC=$?" >>testtrygrep
290
291 echo "---------------------------- Test 52 ------------------------------" >>testtrygrep
292 (cd $srcdir; $valgrind $pcregrep --colour=always jumps ./testdata/grepinputv) >>testtrygrep
293 echo "RC=$?" >>testtrygrep
294
295 echo "---------------------------- Test 53 ------------------------------" >>testtrygrep
296 (cd $srcdir; $valgrind $pcregrep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
297 echo "RC=$?" >>testtrygrep
298
299 echo "---------------------------- Test 54 ------------------------------" >>testtrygrep
300 (cd $srcdir; $valgrind $pcregrep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtrygrep
301 echo "RC=$?" >>testtrygrep
302
303 echo "---------------------------- Test 55 -----------------------------" >>testtrygrep
304 (cd $srcdir; $valgrind $pcregrep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtrygrep
305 echo "RC=$?" >>testtrygrep
306
307 echo "---------------------------- Test 56 -----------------------------" >>testtrygrep
308 (cd $srcdir; $valgrind $pcregrep -c lazy ./testdata/grepinput*) >>testtrygrep
309 echo "RC=$?" >>testtrygrep
310
311 echo "---------------------------- Test 57 -----------------------------" >>testtrygrep
312 (cd $srcdir; $valgrind $pcregrep -c -l lazy ./testdata/grepinput*) >>testtrygrep
313 echo "RC=$?" >>testtrygrep
314
315 echo "---------------------------- Test 58 -----------------------------" >>testtrygrep
316 (cd $srcdir; $valgrind $pcregrep --regex=PATTERN ./testdata/grepinput) >>testtrygrep
317 echo "RC=$?" >>testtrygrep
318
319 echo "---------------------------- Test 59 -----------------------------" >>testtrygrep
320 (cd $srcdir; $valgrind $pcregrep --regexp=PATTERN ./testdata/grepinput) >>testtrygrep
321 echo "RC=$?" >>testtrygrep
322
323 echo "---------------------------- Test 60 -----------------------------" >>testtrygrep
324 (cd $srcdir; $valgrind $pcregrep --regex PATTERN ./testdata/grepinput) >>testtrygrep
325 echo "RC=$?" >>testtrygrep
326
327 echo "---------------------------- Test 61 -----------------------------" >>testtrygrep
328 (cd $srcdir; $valgrind $pcregrep --regexp PATTERN ./testdata/grepinput) >>testtrygrep
329 echo "RC=$?" >>testtrygrep
330
331 echo "---------------------------- Test 62 -----------------------------" >>testtrygrep
332 (cd $srcdir; $valgrind $pcregrep --match-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtrygrep 2>&1
333 echo "RC=$?" >>testtrygrep
334
335 echo "---------------------------- Test 63 -----------------------------" >>testtrygrep
336 (cd $srcdir; $valgrind $pcregrep --recursion-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtrygrep 2>&1
337 echo "RC=$?" >>testtrygrep
338
339 echo "---------------------------- Test 64 ------------------------------" >>testtrygrep
340 (cd $srcdir; $valgrind $pcregrep -o1 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
341 echo "RC=$?" >>testtrygrep
342
343 echo "---------------------------- Test 65 ------------------------------" >>testtrygrep
344 (cd $srcdir; $valgrind $pcregrep -o2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
345 echo "RC=$?" >>testtrygrep
346
347 echo "---------------------------- Test 66 ------------------------------" >>testtrygrep
348 (cd $srcdir; $valgrind $pcregrep -o3 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
349 echo "RC=$?" >>testtrygrep
350
351 echo "---------------------------- Test 67 ------------------------------" >>testtrygrep
352 (cd $srcdir; $valgrind $pcregrep -o12 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
353 echo "RC=$?" >>testtrygrep
354
355 echo "---------------------------- Test 68 ------------------------------" >>testtrygrep
356 (cd $srcdir; $valgrind $pcregrep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtrygrep
357 echo "RC=$?" >>testtrygrep
358
359 echo "---------------------------- Test 69 -----------------------------" >>testtrygrep
360 (cd $srcdir; $valgrind $pcregrep -vn --colour=always pattern ./testdata/grepinputx) >>testtrygrep
361 echo "RC=$?" >>testtrygrep
362
363 echo "---------------------------- Test 70 -----------------------------" >>testtrygrep
364 (cd $srcdir; $valgrind $pcregrep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtrygrep
365 echo "RC=$?" >>testtrygrep
366
367 echo "---------------------------- Test 71 -----------------------------" >>testtrygrep
368 (cd $srcdir; $valgrind $pcregrep -o "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
369 echo "RC=$?" >>testtrygrep
370
371 echo "---------------------------- Test 72 -----------------------------" >>testtrygrep
372 (cd $srcdir; $valgrind $pcregrep --color=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
373 echo "RC=$?" >>testtrygrep
374
375 echo "---------------------------- Test 73 -----------------------------" >>testtrygrep
376 (cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|^02|^03" ./testdata/grepinput) >>testtrygrep
377 echo "RC=$?" >>testtrygrep
378
379 echo "---------------------------- Test 74 -----------------------------" >>testtrygrep
380 (cd $srcdir; $valgrind $pcregrep -o "^01|02|^03" ./testdata/grepinput) >>testtrygrep
381 echo "RC=$?" >>testtrygrep
382
383 echo "---------------------------- Test 75 -----------------------------" >>testtrygrep
384 (cd $srcdir; $valgrind $pcregrep --color=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
385 echo "RC=$?" >>testtrygrep
386
387 echo "---------------------------- Test 76 -----------------------------" >>testtrygrep
388 (cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|02|^03" ./testdata/grepinput) >>testtrygrep
389 echo "RC=$?" >>testtrygrep
390
391 echo "---------------------------- Test 77 -----------------------------" >>testtrygrep
392 (cd $srcdir; $valgrind $pcregrep -o "^01|^02|03" ./testdata/grepinput) >>testtrygrep
393 echo "RC=$?" >>testtrygrep
394
395 echo "---------------------------- Test 78 -----------------------------" >>testtrygrep
396 (cd $srcdir; $valgrind $pcregrep --color=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
397 echo "RC=$?" >>testtrygrep
398
399 echo "---------------------------- Test 79 -----------------------------" >>testtrygrep
400 (cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|^02|03" ./testdata/grepinput) >>testtrygrep
401 echo "RC=$?" >>testtrygrep
402
403 echo "---------------------------- Test 80 -----------------------------" >>testtrygrep
404 (cd $srcdir; $valgrind $pcregrep -o "\b01|\b02" ./testdata/grepinput) >>testtrygrep
405 echo "RC=$?" >>testtrygrep
406
407 echo "---------------------------- Test 81 -----------------------------" >>testtrygrep
408 (cd $srcdir; $valgrind $pcregrep --color=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
409 echo "RC=$?" >>testtrygrep
410
411 echo "---------------------------- Test 82 -----------------------------" >>testtrygrep
412 (cd $srcdir; $valgrind $pcregrep -o --colour=always "\\b01|\\b02" ./testdata/grepinput) >>testtrygrep
413 echo "RC=$?" >>testtrygrep
414
415 echo "---------------------------- Test 83 -----------------------------" >>testtrygrep
416 (cd $srcdir; $valgrind $pcregrep --buffer-size=100 "^a" ./testdata/grepinput3) >>testtrygrep 2>&1
417 echo "RC=$?" >>testtrygrep
418
419 echo "---------------------------- Test 84 -----------------------------" >>testtrygrep
420 echo testdata/grepinput3 >testtemp1grep
421 (cd $srcdir; $valgrind $pcregrep --file-list ./testdata/grepfilelist --file-list $builddir/testtemp1grep "fox|complete|t7") >>testtrygrep 2>&1
422 echo "RC=$?" >>testtrygrep
423
424 echo "---------------------------- Test 85 -----------------------------" >>testtrygrep
425 (cd $srcdir; $valgrind $pcregrep --file-list=./testdata/grepfilelist "dolor" ./testdata/grepinput3) >>testtrygrep 2>&1
426 echo "RC=$?" >>testtrygrep
427
428 echo "---------------------------- Test 86 -----------------------------" >>testtrygrep
429 (cd $srcdir; $valgrind $pcregrep "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
430 echo "RC=$?" >>testtrygrep
431
432 echo "---------------------------- Test 87 -----------------------------" >>testtrygrep
433 (cd $srcdir; $valgrind $pcregrep "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
434 echo "RC=$?" >>testtrygrep
435
436 echo "---------------------------- Test 88 -----------------------------" >>testtrygrep
437 (cd $srcdir; $valgrind $pcregrep -v "cat" ./testdata/grepbinary) >>testtrygrep 2>&1
438 echo "RC=$?" >>testtrygrep
439
440 echo "---------------------------- Test 89 -----------------------------" >>testtrygrep
441 (cd $srcdir; $valgrind $pcregrep -I "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
442 echo "RC=$?" >>testtrygrep
443
444 echo "---------------------------- Test 90 -----------------------------" >>testtrygrep
445 (cd $srcdir; $valgrind $pcregrep --binary-files=without-match "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
446 echo "RC=$?" >>testtrygrep
447
448 echo "---------------------------- Test 91 -----------------------------" >>testtrygrep
449 (cd $srcdir; $valgrind $pcregrep -a "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
450 echo "RC=$?" >>testtrygrep
451
452 echo "---------------------------- Test 92 -----------------------------" >>testtrygrep
453 (cd $srcdir; $valgrind $pcregrep --binary-files=text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
454 echo "RC=$?" >>testtrygrep
455
456 echo "---------------------------- Test 93 -----------------------------" >>testtrygrep
457 (cd $srcdir; $valgrind $pcregrep --text "dog" ./testdata/grepbinary) >>testtrygrep 2>&1
458 echo "RC=$?" >>testtrygrep
459
460 echo "---------------------------- Test 94 -----------------------------" >>testtrygrep
461 (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx --include grepinput8 'fox' ./testdata/grepinput* | sort) >>testtrygrep
462 echo "RC=$?" >>testtrygrep
463
464 echo "---------------------------- Test 95 -----------------------------" >>testtrygrep
465 (cd $srcdir; $valgrind $pcregrep --file-list ./testdata/grepfilelist --exclude grepinputv "fox|complete") >>testtrygrep 2>&1
466 echo "RC=$?" >>testtrygrep
467
468 echo "---------------------------- Test 96 -----------------------------" >>testtrygrep
469 (cd $srcdir; $valgrind $pcregrep -L -r --include-dir=testdata --exclude '^(?!grepinput)' 'fox' ./test* | sort) >>testtrygrep
470 echo "RC=$?" >>testtrygrep
471
472 echo "---------------------------- Test 97 -----------------------------" >>testtrygrep
473 echo "grepinput$" >testtemp1grep
474 echo "grepinput8" >>testtemp1grep
475 (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
476 echo "RC=$?" >>testtrygrep
477
478 echo "---------------------------- Test 98 -----------------------------" >>testtrygrep
479 echo "grepinput$" >testtemp1grep
480 echo "grepinput8" >>testtemp1grep
481 (cd $srcdir; $valgrind $pcregrep -L -r --exclude=grepinput3 --include=grepinput --exclude-from $builddir/testtemp1grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
482 echo "RC=$?" >>testtrygrep
483
484 echo "---------------------------- Test 99 -----------------------------" >>testtrygrep
485 echo "grepinput$" >testtemp1grep
486 echo "grepinput8" >testtemp2grep
487 (cd $srcdir; $valgrind $pcregrep -L -r --include grepinput --exclude-from $builddir/testtemp1grep --exclude-from=$builddir/testtemp2grep --exclude-dir='^\.' 'fox' ./testdata | sort) >>testtrygrep
488 echo "RC=$?" >>testtrygrep
489
490 echo "---------------------------- Test 100 ------------------------------" >>testtrygrep
491 (cd $srcdir; $valgrind $pcregrep -Ho2 --only-matching=1 -o3 '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
492 echo "RC=$?" >>testtrygrep
493
494 echo "---------------------------- Test 101 ------------------------------" >>testtrygrep
495 (cd $srcdir; $valgrind $pcregrep -o3 -Ho2 -o12 --only-matching=1 -o3 --colour=always --om-separator='|' '(\w+) binary (\w+)(\.)?' ./testdata/grepinput) >>testtrygrep
496 echo "RC=$?" >>testtrygrep
497
498 echo "---------------------------- Test 102 -----------------------------" >>testtrygrep
499 (cd $srcdir; $valgrind $pcregrep -n "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
500 echo "RC=$?" >>testtrygrep
501
502 echo "---------------------------- Test 103 -----------------------------" >>testtrygrep
503 (cd $srcdir; $valgrind $pcregrep --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
504 echo "RC=$?" >>testtrygrep
505
506 echo "---------------------------- Test 104 -----------------------------" >>testtrygrep
507 (cd $srcdir; $valgrind $pcregrep -n --only-matching "^$" ./testdata/grepinput3) >>testtrygrep 2>&1
508 echo "RC=$?" >>testtrygrep
509
510 echo "---------------------------- Test 105 -----------------------------" >>testtrygrep
511 (cd $srcdir; $valgrind $pcregrep --colour=always "ipsum|" ./testdata/grepinput3) >>testtrygrep 2>&1
512 echo "RC=$?" >>testtrygrep
513
514 echo "---------------------------- Test 106 -----------------------------" >>testtrygrep
515 (cd $srcdir; echo "a" | $valgrind $pcregrep -M "|a" ) >>testtrygrep 2>&1
516 echo "RC=$?" >>testtrygrep
517
518 echo "---------------------------- Test 107 -----------------------------" >>testtrygrep
519 echo "a" >testtemp1grep
520 echo "aaaaa" >>testtemp1grep
521 (cd $srcdir; $valgrind $pcregrep --line-offsets '(?<=\Ka)' $builddir/testtemp1grep) >>testtrygrep 2>&1
522 echo "RC=$?" >>testtrygrep
523
524 echo "---------------------------- Test 108 ------------------------------" >>testtrygrep
525 (cd $srcdir; $valgrind $pcregrep -lq PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtrygrep
526 echo "RC=$?" >>testtrygrep
527
528 echo "---------------------------- Test 109 -----------------------------" >>testtrygrep
529 (cd $srcdir; $valgrind $pcregrep -cq lazy ./testdata/grepinput*) >>testtrygrep
530 echo "RC=$?" >>testtrygrep
531
532 # Now compare the results.
533
534 $cf $srcdir/testdata/grepoutput testtrygrep
535 if [ $? != 0 ] ; then exit 1; fi
536
537
538 # These tests require UTF-8 support
539
540 if [ $utf8 -ne 0 ] ; then
541 echo "Testing pcregrep UTF-8 features"
542
543 echo "---------------------------- Test U1 ------------------------------" >testtrygrep
544 (cd $srcdir; $valgrind $pcregrep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtrygrep
545 echo "RC=$?" >>testtrygrep
546
547 echo "---------------------------- Test U2 ------------------------------" >>testtrygrep
548 (cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtrygrep
549 echo "RC=$?" >>testtrygrep
550
551 $cf $srcdir/testdata/grepoutput8 testtrygrep
552 if [ $? != 0 ] ; then exit 1; fi
553
554 else
555 echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library"
556 fi
557
558
559 # We go to some contortions to try to ensure that the tests for the various
560 # newline settings will work in environments where the normal newline sequence
561 # is not \n. Do not use exported files, whose line endings might be changed.
562 # Instead, create an input file using printf so that its contents are exactly
563 # what we want. Note the messy fudge to get printf to write a string that
564 # starts with a hyphen. These tests are run in the build directory.
565
566 echo "Testing pcregrep newline settings"
567 printf "abc\rdef\r\nghi\njkl" >testNinputgrep
568
569 printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtrygrep
570 $valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
571
572 printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtrygrep
573 $valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
574
575 printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtrygrep
576 pattern=`printf 'def\rjkl'`
577 $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinputgrep >>testtrygrep
578
579 printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtrygrep
580 $valgrind $pcregrep -n --newline=crlf -F -f $srcdir/testdata/greppatN4 testNinputgrep >>testtrygrep
581
582 printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtrygrep
583 $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
584
585 printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtrygrep
586 $valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinputgrep >>testtrygrep
587
588 $cf $srcdir/testdata/grepoutputN testtrygrep
589 if [ $? != 0 ] ; then exit 1; fi
590
591 exit 0
592
593 # End

Properties

Name Value
svn:executable *
svn:keywords "Author Date Id Revision Url"

  ViewVC Help
Powered by ViewVC 1.1.5