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

Contents of /code/trunk/RunGrepTest.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 116 - (show annotations) (download)
Fri Mar 9 15:23:02 2007 UTC (7 years, 5 months ago) by ph10
File size: 10622 byte(s)
Tests cleanup: use -C in RunTest; add /Z to pcretest and make test 3 
independent of link size.

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

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12