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

Diff of /code/trunk/RunGrepTest

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

revision 587 by ph10, Fri Jan 14 19:01:25 2011 UTC revision 842 by ph10, Sat Dec 31 15:19:04 2011 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    # Remove any non-default colouring and aliases that the caller may have set.
13    
14    unset PCREGREP_COLOUR PCREGREP_COLOR
15    unset cp ls mv rm
16    
17    # Set the program to be tested, and valgrind settings when requested.
18    
19  pcregrep=`pwd`/pcregrep  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 "RunGrepTest: Unknown argument $1"; exit 1;;      *) echo "RunGrepTest: Unknown argument $1"; exit 1;;
26    esac    esac
27    shift    shift
# Line 28  fi Line 36  fi
36    
37  $pcregrep -V  $pcregrep -V
38    
 cf="diff -ub"  
   
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 41  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 305  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 340  echo "---------------------------- Test Line 355  echo "---------------------------- Test
355  (cd $srcdir; $valgrind $pcregrep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtry  (cd $srcdir; $valgrind $pcregrep --color=always -M "triple:\t.*\n\n" ./testdata/grepinput3) >>testtry
356  echo "RC=$?" >>testtry  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  # Now compare the results.  # Now compare the results.
411    
412  $cf $srcdir/testdata/grepoutput testtry  $cf $srcdir/testdata/grepoutput testtry
# Line 388  pattern=`printf 'def\rjkl'` Line 455  pattern=`printf 'def\rjkl'`
455  $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry  $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry
456    
457  printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry  printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
458  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  
459    
460  printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry  printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
461  $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.587  
changed lines
  Added in v.842

  ViewVC Help
Powered by ViewVC 1.1.5