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

Contents of /code/trunk/RunGrepTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 137 - (show annotations) (download)
Thu Mar 29 13:56:00 2007 UTC (7 years, 8 months ago) by ph10
File size: 10872 byte(s)
Daniel's patches.

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

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12