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

Contents of /code/trunk/RunGrepTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93 - (hide annotations) (download)
Sat Feb 24 21:41:42 2007 UTC (7 years, 5 months ago) by nigel
Original Path: code/trunk/RunGrepTest.in
File size: 10437 byte(s)
Load pcre-7.0 into code/trunk.

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12