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

Contents of /code/trunk/RunGrepTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1469 - (hide annotations) (download)
Thu Apr 3 17:38:15 2014 UTC (2 weeks, 6 days ago) by ph10
File size: 27865 byte(s)
Change RunGrepTest's files so as not to clash with RunTest's; now "make -j 
check" works when the tests are run concurrently.

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