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

Diff of /code/trunk/RunGrepTest

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

revision 142 by ph10, Fri Mar 30 15:55:18 2007 UTC revision 437 by ph10, Sun Sep 6 16:34:42 2009 UTC
# Line 14  echo " " Line 14  echo " "
14  echo "Testing pcregrep"  echo "Testing pcregrep"
15  $pcregrep -V  $pcregrep -V
16    
 cf="diff -ub"  
17  valgrind=  valgrind=
   
18  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
19    case $1 in    case $1 in
20      valgrind) valgrind="valgrind -q --leak-check=no";;      valgrind) valgrind="valgrind -q --leak-check=no";;
# Line 25  while [ $# -gt 0 ] ; do Line 23  while [ $# -gt 0 ] ; do
23    shift    shift
24  done  done
25    
26    cf="diff -ub"
27    
28    # Set up a suitable "diff" command for comparison. Some systems have a diff
29    # that lacks a -u option. Try to deal with this; better do the test for the -b
30    # option as well.
31    
32    if diff -u /dev/null /dev/null; then
33      if diff -ub /dev/null /dev/null; then cf="diff -ub"; else cf="diff -u"; fi
34    else
35      if diff -b /dev/null /dev/null; then cf="diff -b"; else cf="diff"; fi
36    fi
37    
38  # If PCRE has been built in a directory other than the source directory, and  # If PCRE has been built in a directory other than the source directory, and
39  # this test is being run from "make check" as usual, then $(srcdir) will be  # this test is being run from "make check" as usual, then $(srcdir) will be
40  # set. If not, set it to the current directory. We then arrange to run the  # set. If not, set it to the current directory. We then arrange to run the
# Line 147  echo "---------------------------- Test Line 157  echo "---------------------------- Test
157  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
158    
159  echo "---------------------------- Test 35 -----------------------------" >>testtry  echo "---------------------------- Test 35 -----------------------------" >>testtry
160  (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx 'fox' ./testdata) >>testtry  (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx --exclude_dir='^\.' 'fox' ./testdata) >>testtry
161  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
162    
163  echo "---------------------------- Test 36 -----------------------------" >>testtry  echo "---------------------------- Test 36 -----------------------------" >>testtry
164  (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' ./testdata | sort) >>testtry  (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude 'grepinput$' --exclude_dir='^\.' 'fox' ./testdata | sort) >>testtry
165  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
166    
167  echo "---------------------------- Test 37 -----------------------------" >>testtry  echo "---------------------------- Test 37 -----------------------------" >>testtry
# Line 179  echo "---------------------------- Test Line 189  echo "---------------------------- Test
189  (cd $srcdir; $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput) >>testtry  (cd $srcdir; $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput) >>testtry
190    
191  echo "---------------------------- Test 43 ------------------------------" >>testtry  echo "---------------------------- Test 43 ------------------------------" >>testtry
192  (cd $srcdir; $valgrind $pcregrep -on -e before -e zero -e after ./testdata/grepinput) >>testtry  (cd $srcdir; $valgrind $pcregrep -on -e before -ezero -e after ./testdata/grepinput) >>testtry
193    
194  echo "---------------------------- Test 44 ------------------------------" >>testtry  echo "---------------------------- Test 44 ------------------------------" >>testtry
195  (cd $srcdir; $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtry  (cd $srcdir; $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtry
196    
197  echo "---------------------------- Test 45 ------------------------------" >>testtry  echo "---------------------------- Test 45 ------------------------------" >>testtry
198  (cd $srcdir; $valgrind $pcregrep -e abc -e '(unclosed' ./testdata/grepinput) 2>>testtry >>testtry  (cd $srcdir; $valgrind $pcregrep -eabc -e '(unclosed' ./testdata/grepinput) 2>>testtry >>testtry
199    
200  echo "---------------------------- Test 46 ------------------------------" >>testtry  echo "---------------------------- Test 46 ------------------------------" >>testtry
201  (cd $srcdir; $valgrind $pcregrep -Fx "AB.VE  (cd $srcdir; $valgrind $pcregrep -Fx "AB.VE
# Line 202  elephant" ./testdata/grepinput) >>testtr Line 212  elephant" ./testdata/grepinput) >>testtr
212  echo "---------------------------- Test 49 ------------------------------" >>testtry  echo "---------------------------- Test 49 ------------------------------" >>testtry
213  (cd $srcdir; $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry  (cd $srcdir; $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry
214    
215    echo "---------------------------- Test 50 ------------------------------" >>testtry
216    (cd $srcdir; $valgrind $pcregrep -Mv "brown\sfox" ./testdata/grepinputv) >>testtry
217    
218    echo "---------------------------- Test 51 ------------------------------" >>testtry
219    (cd $srcdir; $valgrind $pcregrep --colour=always jumps ./testdata/grepinputv) >>testtry
220    
221    echo "---------------------------- Test 52 ------------------------------" >>testtry
222    (cd $srcdir; $valgrind $pcregrep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtry
223    
224    echo "---------------------------- Test 53 ------------------------------" >>testtry
225    (cd $srcdir; $valgrind $pcregrep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtry
226    
227    echo "---------------------------- Test 54 -----------------------------" >>testtry
228    (cd $srcdir; $valgrind $pcregrep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtry
229    
230    echo "---------------------------- Test 55 -----------------------------" >>testtry
231    (cd $srcdir; $valgrind $pcregrep -c lazy ./testdata/grepinput*) >>testtry
232    
233    echo "---------------------------- Test 56 -----------------------------" >>testtry
234    (cd $srcdir; $valgrind $pcregrep -c -l lazy ./testdata/grepinput*) >>testtry
235    
236    echo "---------------------------- Test 57 -----------------------------" >>testtry
237    (cd $srcdir; $valgrind $pcregrep --regex=PATTERN ./testdata/grepinput) >>testtry
238    
239    echo "---------------------------- Test 58 -----------------------------" >>testtry
240    (cd $srcdir; $valgrind $pcregrep --regexp=PATTERN ./testdata/grepinput) >>testtry
241    
242    echo "---------------------------- Test 59 -----------------------------" >>testtry
243    (cd $srcdir; $valgrind $pcregrep --regex PATTERN ./testdata/grepinput) >>testtry
244    
245    echo "---------------------------- Test 60 -----------------------------" >>testtry
246    (cd $srcdir; $valgrind $pcregrep --regexp PATTERN ./testdata/grepinput) >>testtry
247    
248  # Now compare the results.  # Now compare the results.
249    
250  $cf testtry $srcdir/testdata/grepoutput  $cf $srcdir/testdata/grepoutput testtry
251  if [ $? != 0 ] ; then exit 1; fi  if [ $? != 0 ] ; then exit 1; fi
252    
253    
# Line 219  if [ $utf8 -ne 0 ] ; then Line 262  if [ $utf8 -ne 0 ] ; then
262    echo "---------------------------- Test U2 ------------------------------" >>testtry    echo "---------------------------- Test U2 ------------------------------" >>testtry
263    (cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtry    (cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtry
264    
265    $cf testtry $srcdir/testdata/grepoutput8    $cf $srcdir/testdata/grepoutput8 testtry
266    if [ $? != 0 ] ; then exit 1; fi    if [ $? != 0 ] ; then exit 1; fi
267    
268  else  else
# Line 227  else Line 270  else
270  fi  fi
271    
272    
273  # The tests for various newline values may not work in environments where  # We go to some contortions to try to ensure that the tests for the various
274  # the newlines in the files are not \n.  # newline settings will work in environments where the normal newline sequence
275    # is not \n. Do not use exported files, whose line endings might be changed.
276    # Instead, create an input file using printf so that its contents are exactly
277    # what we want. Note the messy fudge to get printf to write a string that
278    # starts with a hyphen.
279    
280  echo "Testing pcregrep newline settings"  echo "Testing pcregrep newline settings"
281    printf "abc\rdef\r\nghi\njkl" >testNinput
282    
283  echo "---------------------------- Test N1 ------------------------------" >testtry  printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtry
284  (cd $srcdir; $valgrind $pcregrep -N CR "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinput >>testtry
285    
286  echo "---------------------------- Test N2 ------------------------------" >>testtry  printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtry
287  (cd $srcdir; $valgrind $pcregrep --newline=crlf "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinput >>testtry
288    
289  echo "---------------------------- Test N3 ------------------------------" >>testtry  printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtry
290  pattern=`printf 'def\rjkl'`  pattern=`printf 'def\rjkl'`
291  (cd $srcdir; $valgrind $pcregrep --newline=cr -F "$pattern" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry
292    
293  echo "---------------------------- Test n$ ------------------------------" >>testtry  printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
294  pattern=`printf 'xxx\r\njkl'`  pattern=`printf 'xxx\r\njkl'`
295  (cd $srcdir; $valgrind $pcregrep --newline=crlf -F "$pattern" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput >>testtry
296    
297    printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
298    $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput >>testtry
299    
300  echo "---------------------------- Test N5 ------------------------------" >>testtry  printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtry
301  (cd $srcdir; $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry  $valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinput >>testtry
302    
303  $cf testtry $srcdir/testdata/grepoutputN  $cf $srcdir/testdata/grepoutputN testtry
304  if [ $? != 0 ] ; then exit 1; fi  if [ $? != 0 ] ; then exit 1; fi
305    
306  exit 0  exit 0

Legend:
Removed from v.142  
changed lines
  Added in v.437

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12