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

Diff of /code/trunk/RunGrepTest

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

code/trunk/RunGrepTest.in revision 81 by nigel, Sat Feb 24 21:40:59 2007 UTC code/trunk/RunGrepTest revision 137 by ph10, Thu Mar 29 13:56:00 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  if [ ! -d testdata ] ; then  valgrind=
20    ln -s @top_srcdir@/testdata testdata  testdata=testdata
21    
22    if [ -n "$srcdir" -a -d "$srcdir/testdata" ] ; then
23      testdata="$srcdir/testdata"
24  fi  fi
 testdata=./testdata  
25    
26  ./pcregrep -V 2>testtry  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  echo "---------------------------- Test 1 ------------------------------" >>testtry  ./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null
37  ./pcregrep PATTERN $testdata/grepinput >>testtry  utf8=$?
38    
39    echo "---------------------------- Test 1 ------------------------------" >testtry
40    $valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry
41    
42  echo "---------------------------- Test 2 ------------------------------" >>testtry  echo "---------------------------- Test 2 ------------------------------" >>testtry
43  ./pcregrep '^PATTERN' $testdata/grepinput >>testtry  $valgrind ./pcregrep '^PATTERN' $testdata/grepinput >>testtry
44    
45  echo "---------------------------- Test 3 ------------------------------" >>testtry  echo "---------------------------- Test 3 ------------------------------" >>testtry
46  ./pcregrep -in PATTERN $testdata/grepinput >>testtry  $valgrind ./pcregrep -in PATTERN $testdata/grepinput >>testtry
47    
48  echo "---------------------------- Test 4 ------------------------------" >>testtry  echo "---------------------------- Test 4 ------------------------------" >>testtry
49  ./pcregrep -ic PATTERN $testdata/grepinput >>testtry  $valgrind ./pcregrep -ic PATTERN $testdata/grepinput >>testtry
50    
51  echo "---------------------------- Test 5 ------------------------------" >>testtry  echo "---------------------------- Test 5 ------------------------------" >>testtry
52  ./pcregrep -in PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -in PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
53    
54  echo "---------------------------- Test 6 ------------------------------" >>testtry  echo "---------------------------- Test 6 ------------------------------" >>testtry
55  ./pcregrep -inh PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -inh PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
56    
57  echo "---------------------------- Test 7 ------------------------------" >>testtry  echo "---------------------------- Test 7 ------------------------------" >>testtry
58  ./pcregrep -il PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -il PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
59    
60  echo "---------------------------- Test 8 ------------------------------" >>testtry  echo "---------------------------- Test 8 ------------------------------" >>testtry
61  ./pcregrep -l PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -l PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
62    
63  echo "---------------------------- Test 9 ------------------------------" >>testtry  echo "---------------------------- Test 9 ------------------------------" >>testtry
64  ./pcregrep -q PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -q PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
65  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
66    
67  echo "---------------------------- Test 10 -----------------------------" >>testtry  echo "---------------------------- Test 10 -----------------------------" >>testtry
68  ./pcregrep -q NEVER-PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -q NEVER-PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
69  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
70    
71  echo "---------------------------- Test 11 -----------------------------" >>testtry  echo "---------------------------- Test 11 -----------------------------" >>testtry
72  ./pcregrep -vn pattern $testdata/grepinputx >>testtry  $valgrind ./pcregrep -vn pattern $testdata/grepinputx >>testtry
73    
74  echo "---------------------------- Test 12 -----------------------------" >>testtry  echo "---------------------------- Test 12 -----------------------------" >>testtry
75  ./pcregrep -ix pattern $testdata/grepinputx >>testtry  $valgrind ./pcregrep -ix pattern $testdata/grepinputx >>testtry
76    
77  echo "---------------------------- Test 13 -----------------------------" >>testtry  echo "---------------------------- Test 13 -----------------------------" >>testtry
78  ./pcregrep -f$testdata/greplist $testdata/grepinputx >>testtry  $valgrind ./pcregrep -f$testdata/greplist $testdata/grepinputx >>testtry
79    
80  echo "---------------------------- Test 14 -----------------------------" >>testtry  echo "---------------------------- Test 14 -----------------------------" >>testtry
81  ./pcregrep -w pat $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -w pat $testdata/grepinput $testdata/grepinputx >>testtry
82    
83  echo "---------------------------- Test 15 -----------------------------" >>testtry  echo "---------------------------- Test 15 -----------------------------" >>testtry
84  ./pcregrep 'abc^*' $testdata/grepinput 2>>testtry >>testtry  $valgrind ./pcregrep 'abc^*' $testdata/grepinput 2>>testtry >>testtry
85    
86  echo "---------------------------- Test 16 -----------------------------" >>testtry  echo "---------------------------- Test 16 -----------------------------" >>testtry
87  ./pcregrep abc $testdata/grepinput $testdata/nonexistfile 2>>testtry >>testtry  $valgrind ./pcregrep abc $testdata/grepinput $testdata/nonexistfile 2>>testtry >>testtry
88    
89  echo "---------------------------- Test 17 -----------------------------" >>testtry  echo "---------------------------- Test 17 -----------------------------" >>testtry
90  ./pcregrep -M 'the\noutput' $testdata/grepinput >>testtry  $valgrind ./pcregrep -M 'the\noutput' $testdata/grepinput >>testtry
91    
92  echo "---------------------------- Test 18 -----------------------------" >>testtry  echo "---------------------------- Test 18 -----------------------------" >>testtry
93  ./pcregrep -Mn '(the\noutput|dog\.\n--)' $testdata/grepinput >>testtry  $valgrind ./pcregrep -Mn '(the\noutput|dog\.\n--)' $testdata/grepinput >>testtry
94    
95  echo "---------------------------- Test 19 -----------------------------" >>testtry  echo "---------------------------- Test 19 -----------------------------" >>testtry
96  ./pcregrep -Mix 'Pattern' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -Mix 'Pattern' $testdata/grepinputx >>testtry
97    
98  echo "---------------------------- Test 20 -----------------------------" >>testtry  echo "---------------------------- Test 20 -----------------------------" >>testtry
99  ./pcregrep -Mixn 'complete pair\nof lines' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -Mixn 'complete pair\nof lines' $testdata/grepinputx >>testtry
100    
101  echo "---------------------------- Test 21 -----------------------------" >>testtry  echo "---------------------------- Test 21 -----------------------------" >>testtry
102  ./pcregrep -nA3 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -nA3 'four' $testdata/grepinputx >>testtry
103    
104  echo "---------------------------- Test 22 -----------------------------" >>testtry  echo "---------------------------- Test 22 -----------------------------" >>testtry
105  ./pcregrep -nB3 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -nB3 'four' $testdata/grepinputx >>testtry
106    
107  echo "---------------------------- Test 23 -----------------------------" >>testtry  echo "---------------------------- Test 23 -----------------------------" >>testtry
108  ./pcregrep -C3 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -C3 'four' $testdata/grepinputx >>testtry
109    
110  echo "---------------------------- Test 24 -----------------------------" >>testtry  echo "---------------------------- Test 24 -----------------------------" >>testtry
111  ./pcregrep -A9 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -A9 'four' $testdata/grepinputx >>testtry
112    
113  echo "---------------------------- Test 25 -----------------------------" >>testtry  echo "---------------------------- Test 25 -----------------------------" >>testtry
114  ./pcregrep -nB9 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -nB9 'four' $testdata/grepinputx >>testtry
115    
116  echo "---------------------------- Test 26 -----------------------------" >>testtry  echo "---------------------------- Test 26 -----------------------------" >>testtry
117  ./pcregrep -A9 -B9 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -A9 -B9 'four' $testdata/grepinputx >>testtry
118    
119  echo "---------------------------- Test 27 -----------------------------" >>testtry  echo "---------------------------- Test 27 -----------------------------" >>testtry
120  ./pcregrep -A10 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -A10 'four' $testdata/grepinputx >>testtry
121    
122  echo "---------------------------- Test 28 -----------------------------" >>testtry  echo "---------------------------- Test 28 -----------------------------" >>testtry
123  ./pcregrep -nB10 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -nB10 'four' $testdata/grepinputx >>testtry
124    
125  echo "---------------------------- Test 29 -----------------------------" >>testtry  echo "---------------------------- Test 29 -----------------------------" >>testtry
126  ./pcregrep -C12 -B10 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -C12 -B10 'four' $testdata/grepinputx >>testtry
127    
128  echo "---------------------------- Test 30 -----------------------------" >>testtry  echo "---------------------------- Test 30 -----------------------------" >>testtry
129  ./pcregrep -inB3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -inB3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry
130    
131  echo "---------------------------- Test 31 -----------------------------" >>testtry  echo "---------------------------- Test 31 -----------------------------" >>testtry
132  ./pcregrep -inA3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -inA3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry
133    
134  echo "---------------------------- Test 32 -----------------------------" >>testtry  echo "---------------------------- Test 32 -----------------------------" >>testtry
135  ./pcregrep -L 'fox' $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -L 'fox' $testdata/grepinput $testdata/grepinputx >>testtry
136    
137  echo "---------------------------- Test 33 -----------------------------" >>testtry  echo "---------------------------- Test 33 -----------------------------" >>testtry
138  ./pcregrep 'fox' $testdata/grepnonexist >>testtry 2>&1  $valgrind ./pcregrep 'fox' $testdata/grepnonexist >>testtry 2>&1
139  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
140    
141  echo "---------------------------- Test 34 -----------------------------" >>testtry  echo "---------------------------- Test 34 -----------------------------" >>testtry
142  ./pcregrep -s 'fox' $testdata/grepnonexist >>testtry 2>&1  $valgrind ./pcregrep -s 'fox' $testdata/grepnonexist >>testtry 2>&1
143  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
144    
145  echo "---------------------------- Test 35 -----------------------------" >>testtry  echo "---------------------------- Test 35 -----------------------------" >>testtry
146  ./pcregrep -L -r --include=grepinputx 'fox' $testdata >>testtry  $valgrind ./pcregrep -L -r --include=grepinputx 'fox' $testdata >>testtry
147  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
148    
149  echo "---------------------------- Test 36 -----------------------------" >>testtry  echo "---------------------------- Test 36 -----------------------------" >>testtry
150  ./pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' $testdata >>testtry  $valgrind ./pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' $testdata | sort >>testtry
151  echo "RC=$?" >>testtry  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.  # Now compare the results.
202    
203  $cf testtry $testdata/grepoutput  $cf testtry $testdata/grepoutput
204  if [ $? != 0 ] ; then exit 1; else exit 0; fi  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  # End

Legend:
Removed from v.81  
changed lines
  Added in v.137

  ViewVC Help
Powered by ViewVC 1.1.5