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

Diff of /code/trunk/RunGrepTest

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

revision 565 by ph10, Sun Oct 31 18:18:48 2010 UTC revision 947 by ph10, Sun Mar 4 16:51:13 2012 UTC
# Line 5  Line 5 
5  # supported by pcregrep.  # supported by pcregrep.
6    
7  # Set the C locale, so that sort(1) behaves predictably.  # Set the C locale, so that sort(1) behaves predictably.
8    
9  LC_ALL=C  LC_ALL=C
10  export LC_ALL  export LC_ALL
11    
12  pcregrep=`pwd`/pcregrep  # Remove any non-default colouring and aliases that the caller may have set.
13    
14  echo " "  unset PCREGREP_COLOUR PCREGREP_COLOR
15  echo "Testing pcregrep"  unset cp ls mv rm
16  $pcregrep -V  
17    # Set the program to be tested, and valgrind settings when requested.
18    
19    pcregrep=`pwd`/pcregrep
20    
21  valgrind=  valgrind=
22  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
23    case $1 in    case $1 in
24      valgrind) valgrind="valgrind -q --leak-check=no";;      valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all";;
25      *) echo "Unknown argument $1"; exit 1;;      *) echo "RunGrepTest: Unknown argument $1"; exit 1;;
26    esac    esac
27    shift    shift
28  done  done
29    
30  cf="diff -ub"  echo " "
31    if [ "$valgrind" = "" ] ; then
32      echo "Testing pcregrep"
33    else
34      echo "Testing pcregrep using valgrind"
35    fi
36    
37    $pcregrep -V
38    
39  # Set up a suitable "diff" command for comparison. Some systems have a diff  # Set up a suitable "diff" command for comparison. Some systems have a diff
40  # that lacks a -u option. Try to deal with this; better do the test for the -b  # that lacks a -u option. Try to deal with this; better do the test for the -b
41  # option as well.  # option as well.
42    
43    cf="diff -ub"
44  if diff -u /dev/null /dev/null; then  if diff -u /dev/null /dev/null; then
45    if diff -ub /dev/null /dev/null; then cf="diff -ub"; else cf="diff -u"; fi    if diff -ub /dev/null /dev/null; then cf="diff -ub"; else cf="diff -u"; fi
46  else  else
# Line 36  else Line 48  else
48  fi  fi
49    
50  # 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
51  # 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
52  # set. If not, set it to the current directory. We then arrange to run the  # set. If not, set it to the current or parent directory, whichever one
53  # pcregrep command in the source directory so that the file names that appear  # contains the test data. We then arrange to run the pcregrep command in the
54  # in the output are always the same.  # source directory so that the file names that appear in the output are always
55    # the same.
56    
57  if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then  if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
58    srcdir=.    if [ -d "./testdata" ] ; then
59        srcdir=.
60      elif [ -d "../testdata" ] ; then
61        srcdir=..
62      else
63        echo "Cannot find the testdata directory"
64        exit 1
65      fi
66  fi  fi
67    
68  # Check for the availability of UTF-8 support  # Check for the availability of UTF-8 support
69    
70  ./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null  ./pcretest -C utf >/dev/null
71  utf8=$?  utf8=$?
72    
73  echo "---------------------------- Test 1 ------------------------------" >testtry  echo "---------------------------- Test 1 ------------------------------" >testtry
# Line 187  echo "---------------------------- Test Line 207  echo "---------------------------- Test
207  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
208    
209  echo "---------------------------- Test 35 -----------------------------" >>testtry  echo "---------------------------- Test 35 -----------------------------" >>testtry
210  (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx --exclude_dir='^\.' 'fox' ./testdata) >>testtry  (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx --exclude-dir='^\.' 'fox' ./testdata) >>testtry
211  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
212    
213  echo "---------------------------- Test 36 -----------------------------" >>testtry  echo "---------------------------- Test 36 -----------------------------" >>testtry
# Line 300  echo "---------------------------- Test Line 320  echo "---------------------------- Test
320  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
321    
322  echo "---------------------------- Test 62 -----------------------------" >>testtry  echo "---------------------------- Test 62 -----------------------------" >>testtry
323  (cd $srcdir; $valgrind $pcregrep --match-limit=1000 -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtry 2>&1  (cd $srcdir; $valgrind $pcregrep --match-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtry 2>&1
324  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
325    
326  echo "---------------------------- Test 63 -----------------------------" >>testtry  echo "---------------------------- Test 63 -----------------------------" >>testtry
327  (cd $srcdir; $valgrind $pcregrep --recursion-limit=1000 -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtry 2>&1  (cd $srcdir; $valgrind $pcregrep --recursion-limit=1000 --no-jit -M 'This is a file(.|\R)*file.' ./testdata/grepinput) >>testtry 2>&1
328  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
329    
330  echo "---------------------------- Test 64 ------------------------------" >>testtry  echo "---------------------------- Test 64 ------------------------------" >>testtry
# Line 327  echo "---------------------------- Test Line 347  echo "---------------------------- Test
347  (cd $srcdir; $valgrind $pcregrep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtry  (cd $srcdir; $valgrind $pcregrep --only-matching=2 '(?<=PAT)TERN (ap(pear)s)' ./testdata/grepinput) >>testtry
348  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
349    
350    echo "---------------------------- Test 69 -----------------------------" >>testtry
351    (cd $srcdir; $valgrind $pcregrep -vn --colour=always pattern ./testdata/grepinputx) >>testtry
352    echo "RC=$?" >>testtry
353    
354    echo "---------------------------- Test 70 -----------------------------" >>testtry
355    (cd $srcdir; $valgrind $pcregrep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtry
356    echo "RC=$?" >>testtry
357    
358    echo "---------------------------- Test 71 -----------------------------" >>testtry
359    (cd $srcdir; $valgrind $pcregrep -o "^01|^02|^03" ./testdata/grepinput) >>testtry
360    echo "RC=$?" >>testtry
361    
362    echo "---------------------------- Test 72 -----------------------------" >>testtry
363    (cd $srcdir; $valgrind $pcregrep --color=always "^01|^02|^03" ./testdata/grepinput) >>testtry
364    echo "RC=$?" >>testtry
365    
366    echo "---------------------------- Test 73 -----------------------------" >>testtry
367    (cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|^02|^03" ./testdata/grepinput) >>testtry
368    echo "RC=$?" >>testtry
369    
370    echo "---------------------------- Test 74 -----------------------------" >>testtry
371    (cd $srcdir; $valgrind $pcregrep -o "^01|02|^03" ./testdata/grepinput) >>testtry
372    echo "RC=$?" >>testtry
373    
374    echo "---------------------------- Test 75 -----------------------------" >>testtry
375    (cd $srcdir; $valgrind $pcregrep --color=always "^01|02|^03" ./testdata/grepinput) >>testtry
376    echo "RC=$?" >>testtry
377    
378    echo "---------------------------- Test 76 -----------------------------" >>testtry
379    (cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|02|^03" ./testdata/grepinput) >>testtry
380    echo "RC=$?" >>testtry
381    
382    echo "---------------------------- Test 77 -----------------------------" >>testtry
383    (cd $srcdir; $valgrind $pcregrep -o "^01|^02|03" ./testdata/grepinput) >>testtry
384    echo "RC=$?" >>testtry
385    
386    echo "---------------------------- Test 78 -----------------------------" >>testtry
387    (cd $srcdir; $valgrind $pcregrep --color=always "^01|^02|03" ./testdata/grepinput) >>testtry
388    echo "RC=$?" >>testtry
389    
390    echo "---------------------------- Test 79 -----------------------------" >>testtry
391    (cd $srcdir; $valgrind $pcregrep -o --colour=always "^01|^02|03" ./testdata/grepinput) >>testtry
392    echo "RC=$?" >>testtry
393    
394    echo "---------------------------- Test 80 -----------------------------" >>testtry
395    (cd $srcdir; $valgrind $pcregrep -o "\b01|\b02" ./testdata/grepinput) >>testtry
396    echo "RC=$?" >>testtry
397    
398    echo "---------------------------- Test 81 -----------------------------" >>testtry
399    (cd $srcdir; $valgrind $pcregrep --color=always "\\b01|\\b02" ./testdata/grepinput) >>testtry
400    echo "RC=$?" >>testtry
401    
402    echo "---------------------------- Test 82 -----------------------------" >>testtry
403    (cd $srcdir; $valgrind $pcregrep -o --colour=always "\\b01|\\b02" ./testdata/grepinput) >>testtry
404    echo "RC=$?" >>testtry
405    
406    echo "---------------------------- Test 83 -----------------------------" >>testtry
407    (cd $srcdir; $valgrind $pcregrep --buffer-size=100 "^a" ./testdata/grepinput3) >>testtry 2>&1
408    echo "RC=$?" >>testtry
409    
410    echo "---------------------------- Test 84 -----------------------------" >>testtry
411    (cd $srcdir; $valgrind $pcregrep --file-list ./testdata/grepfilelist "fox|complete") >>testtry 2>&1
412    echo "RC=$?" >>testtry
413    
414    echo "---------------------------- Test 85 -----------------------------" >>testtry
415    (cd $srcdir; $valgrind $pcregrep --file-list=./testdata/grepfilelist "dolor" ./testdata/grepinput3) >>testtry 2>&1
416    echo "RC=$?" >>testtry
417    
418    echo "---------------------------- Test 86 -----------------------------" >>testtry
419    (cd $srcdir; $valgrind $pcregrep "dog" ./testdata/grepbinary) >>testtry 2>&1
420    echo "RC=$?" >>testtry
421    
422    echo "---------------------------- Test 87 -----------------------------" >>testtry
423    (cd $srcdir; $valgrind $pcregrep "cat" ./testdata/grepbinary) >>testtry 2>&1
424    echo "RC=$?" >>testtry
425    
426    echo "---------------------------- Test 88 -----------------------------" >>testtry
427    (cd $srcdir; $valgrind $pcregrep -v "cat" ./testdata/grepbinary) >>testtry 2>&1
428    echo "RC=$?" >>testtry
429    
430    echo "---------------------------- Test 89 -----------------------------" >>testtry
431    (cd $srcdir; $valgrind $pcregrep -I "dog" ./testdata/grepbinary) >>testtry 2>&1
432    echo "RC=$?" >>testtry
433    
434    echo "---------------------------- Test 90 -----------------------------" >>testtry
435    (cd $srcdir; $valgrind $pcregrep --binary-files=without-match "dog" ./testdata/grepbinary) >>testtry 2>&1
436    echo "RC=$?" >>testtry
437    
438    echo "---------------------------- Test 91 -----------------------------" >>testtry
439    (cd $srcdir; $valgrind $pcregrep -a "dog" ./testdata/grepbinary) >>testtry 2>&1
440    echo "RC=$?" >>testtry
441    
442    echo "---------------------------- Test 92 -----------------------------" >>testtry
443    (cd $srcdir; $valgrind $pcregrep --binary-files=text "dog" ./testdata/grepbinary) >>testtry 2>&1
444    echo "RC=$?" >>testtry
445    
446    echo "---------------------------- Test 93 -----------------------------" >>testtry
447    (cd $srcdir; $valgrind $pcregrep --text "dog" ./testdata/grepbinary) >>testtry 2>&1
448    echo "RC=$?" >>testtry
449    
450  # Now compare the results.  # Now compare the results.
451    
452  $cf $srcdir/testdata/grepoutput testtry  $cf $srcdir/testdata/grepoutput testtry
# Line 375  pattern=`printf 'def\rjkl'` Line 495  pattern=`printf 'def\rjkl'`
495  $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry  $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry
496    
497  printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry  printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
498  pattern=`printf 'xxx\r\njkl'`  $valgrind $pcregrep -n --newline=crlf -F -f $srcdir/testdata/greppatN4 testNinput >>testtry
 $valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput >>testtry  
499    
500  printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry  printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
501  $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput >>testtry  $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput >>testtry

Legend:
Removed from v.565  
changed lines
  Added in v.947

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12