/[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 97 by ph10, Mon Mar 5 12:36:47 2007 UTC code/trunk/RunGrepTest revision 137 by ph10, Thu Mar 29 13:56:00 2007 UTC
# Line 7  Line 7 
7  LC_ALL=C  LC_ALL=C
8  export LC_ALL  export LC_ALL
9    
10    echo " "
11  echo "Testing pcregrep"  echo "Testing pcregrep"
12  ./pcregrep -V  ./pcregrep -V
13    
# Line 14  echo "Testing pcregrep" Line 15  echo "Testing pcregrep"
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 -u"  cf="diff -ub"
19  valgrind=  valgrind=
20  if [ ! -d testdata ] ; then  testdata=testdata
21    ln -s @top_srcdir@/testdata testdata  
22    if [ -n "$srcdir" -a -d "$srcdir/testdata" ] ; then
23      testdata="$srcdir/testdata"
24  fi  fi
 testdata=./testdata  
25    
26  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
27    case $1 in    case $1 in
# Line 29  while [ $# -gt 0 ] ; do Line 31  while [ $# -gt 0 ] ; do
31    shift    shift
32  done  done
33    
34    # Check for the availability of UTF-8 support
35    
36  ./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null  ./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null
37  no_utf8=$?  utf8=$?
38    
39  echo "---------------------------- Test 1 ------------------------------" >testtry  echo "---------------------------- Test 1 ------------------------------" >testtry
40  $valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry  $valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry
# Line 194  elephant" $testdata/grepinput >>testtry Line 198  elephant" $testdata/grepinput >>testtry
198  echo "---------------------------- Test 49 ------------------------------" >>testtry  echo "---------------------------- Test 49 ------------------------------" >>testtry
199  $valgrind ./pcregrep "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry  $valgrind ./pcregrep "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry
200    
 echo "---------------------------- Test 50 ------------------------------" >>testtry  
 $valgrind ./pcregrep -N CR "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry  
   
 echo "---------------------------- Test 51 ------------------------------" >>testtry  
 $valgrind ./pcregrep --newline=crlf "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry  
   
 echo "---------------------------- Test 52 ------------------------------" >>testtry  
 pattern=`printf 'def\rjkl'`  
 $valgrind ./pcregrep --newline=cr -F "$pattern" $testdata/grepinputx >>testtry  
   
 echo "---------------------------- Test 53 ------------------------------" >>testtry  
 pattern=`printf 'xxx\r\njkl'`  
 $valgrind ./pcregrep --newline=crlf -F "$pattern" $testdata/grepinputx >>testtry  
   
 echo "---------------------------- Test 54 ------------------------------" >>testtry  
 $valgrind ./pcregrep -n --newline=any "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry  
   
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; fi  if [ $? != 0 ] ; then exit 1; fi
205    
206    
207  # These tests require UTF-8 support  # These tests require UTF-8 support
208    
209  if [ $no_utf8 -ne 0 ] ; then  if [ $utf8 -ne 0 ] ; then
210    echo "Testing pcregrep UTF-8 features"    echo "Testing pcregrep UTF-8 features"
211    
212    echo "---------------------------- Test U1 ------------------------------" >testtry    echo "---------------------------- Test U1 ------------------------------" >testtry
# Line 234  else Line 222  else
222    echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library"    echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library"
223  fi  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  exit 0
252    
253  # End  # End

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

  ViewVC Help
Powered by ViewVC 1.1.5