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

Diff of /code/trunk/RunGrepTest.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.77  
changed lines
  Added in v.131

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12