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

Diff of /code/trunk/RunGrepTest

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

revision 644 by ph10, Sat Jul 30 17:13:00 2011 UTC revision 837 by ph10, Thu Dec 29 17:25:26 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 that the caller may have set.
13    
14    unset PCREGREP_COLOUR PCREGREP_COLOR
15    
16    # Set the program to be tested, and valgrind settings when requested.
17    
18  pcregrep=`pwd`/pcregrep  pcregrep=`pwd`/pcregrep
19    
20  valgrind=  valgrind=
21  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
22    case $1 in    case $1 in
23      valgrind) valgrind="valgrind -q --leak-check=no";;      valgrind) valgrind="valgrind -q --leak-check=no --smc-check=all";;
24      *) echo "RunGrepTest: Unknown argument $1"; exit 1;;      *) echo "RunGrepTest: Unknown argument $1"; exit 1;;
25    esac    esac
26    shift    shift
# Line 28  fi Line 35  fi
35    
36  $pcregrep -V  $pcregrep -V
37    
 cf="diff -ub"  
   
38  # 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
39  # 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
40  # option as well.  # option as well.
41    
42    cf="diff -ub"
43  if diff -u /dev/null /dev/null; then  if diff -u /dev/null /dev/null; then
44    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
45  else  else
# Line 41  else Line 47  else
47  fi  fi
48    
49  # 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
50  # 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
51  # 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
52  # 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
53  # in the output are always the same.  # source directory so that the file names that appear in the output are always
54    # the same.
55    
56  if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then  if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
57    srcdir=.    if [ -d "./testdata" ] ; then
58        srcdir=.
59      elif [ -d "../testdata" ] ; then
60        srcdir=..
61      else
62        echo "Cannot find the testdata directory"
63        exit 1
64      fi
65  fi  fi
66    
67  # Check for the availability of UTF-8 support  # Check for the availability of UTF-8 support
68    
69  ./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null  ./pcretest -C utf >/dev/null
70  utf8=$?  utf8=$?
71    
72  echo "---------------------------- Test 1 ------------------------------" >testtry  echo "---------------------------- Test 1 ------------------------------" >testtry
# Line 305  echo "---------------------------- Test Line 319  echo "---------------------------- Test
319  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
320    
321  echo "---------------------------- Test 62 -----------------------------" >>testtry  echo "---------------------------- Test 62 -----------------------------" >>testtry
322  (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
323  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
324    
325  echo "---------------------------- Test 63 -----------------------------" >>testtry  echo "---------------------------- Test 63 -----------------------------" >>testtry
326  (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
327  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
328    
329  echo "---------------------------- Test 64 ------------------------------" >>testtry  echo "---------------------------- Test 64 ------------------------------" >>testtry
# Line 440  pattern=`printf 'def\rjkl'` Line 454  pattern=`printf 'def\rjkl'`
454  $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry  $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry
455    
456  printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry  printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
457  pattern=`printf 'xxx\r\njkl'`  $valgrind $pcregrep -n --newline=crlf -F -f testdata/greppatN4 testNinput >>testtry
 $valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput >>testtry  
458    
459  printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry  printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
460  $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.644  
changed lines
  Added in v.837

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12