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

Contents of /code/trunk/RunGrepTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 733 - (hide annotations) (download)
Tue Oct 11 10:29:36 2011 UTC (3 years, 2 months ago) by ph10
File size: 20984 byte(s)
Source tidies for 8.20-RC3.

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