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

Contents of /code/trunk/RunGrepTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1003 - (hide annotations) (download)
Wed Aug 15 16:45:36 2012 UTC (20 months, 1 week ago) by ph10
File size: 24735 byte(s)
Fix a number of issues in pcregrep.

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

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12