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

Contents of /code/trunk/RunGrepTest

Parent Directory Parent Directory | Revision Log Revision Log


Revision 97 - (hide annotations) (download)
Mon Mar 5 12:36:47 2007 UTC (7 years, 4 months ago) by ph10
Original Path: code/trunk/RunGrepTest.in
File size: 10581 byte(s)
Applied Bob and Daniel's patches to convert the build system to automake. Added 
the maintain directory, containing files that are used for maintenance, but are 
not distributed. This is an intermediate step.

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

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12