/[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 87 by nigel, Sat Feb 24 21:41:21 2007 UTC code/trunk/RunGrepTest revision 137 by ph10, Thu Mar 29 13:56:00 2007 UTC
# Line 3  Line 3 
3  # This file is generated by configure from RunGrepTest.in. Make any changes  # This file is generated by configure from RunGrepTest.in. Make any changes
4  # to that file.  # to that file.
5    
6    # Set the C locale, so that sort(1) behaves predictably.
7    LC_ALL=C
8    export LC_ALL
9    
10    echo " "
11  echo "Testing pcregrep"  echo "Testing pcregrep"
12  ./pcregrep -V  ./pcregrep -V
13    
# Line 10  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  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
28      valgrind) valgrind="valgrind -q --leak-check=no";;      valgrind) valgrind="valgrind -q --leak-check=no";;
29      *) echo "Unknown argument $1"; exit 1;;      *) echo "Unknown argument $1"; exit 1;;
30    esac    esac
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
37    utf8=$?
38    
39  echo "---------------------------- Test 1 ------------------------------" >testtry  echo "---------------------------- Test 1 ------------------------------" >testtry
40  $valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry  $valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry
41    
# Line 124  echo "---------------------------- Test Line 135  echo "---------------------------- Test
135  $valgrind ./pcregrep -L 'fox' $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -L 'fox' $testdata/grepinput $testdata/grepinputx >>testtry
136    
137  echo "---------------------------- Test 33 -----------------------------" >>testtry  echo "---------------------------- Test 33 -----------------------------" >>testtry
138  $valgrind ./pcregrep 'fox' $testdata/grepnonexist >>testtry 2>&1  $valgrind ./pcregrep 'fox' $testdata/grepnonexist >>testtry 2>&1
139  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
140    
141  echo "---------------------------- Test 34 -----------------------------" >>testtry  echo "---------------------------- Test 34 -----------------------------" >>testtry
142  $valgrind ./pcregrep -s 'fox' $testdata/grepnonexist >>testtry 2>&1  $valgrind ./pcregrep -s 'fox' $testdata/grepnonexist >>testtry 2>&1
143  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
144    
145  echo "---------------------------- Test 35 -----------------------------" >>testtry  echo "---------------------------- Test 35 -----------------------------" >>testtry
146  $valgrind ./pcregrep -L -r --include=grepinputx 'fox' $testdata >>testtry  $valgrind ./pcregrep -L -r --include=grepinputx 'fox' $testdata >>testtry
147  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
148    
149  echo "---------------------------- Test 36 -----------------------------" >>testtry  echo "---------------------------- Test 36 -----------------------------" >>testtry
150  $valgrind ./pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' $testdata >>testtry  $valgrind ./pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' $testdata | sort >>testtry
151  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
152    
153  echo "---------------------------- Test 37 -----------------------------" >>testtry  echo "---------------------------- Test 37 -----------------------------" >>testtry
# Line 184  echo "---------------------------- Test Line 195  echo "---------------------------- Test
195  $valgrind ./pcregrep -F -e DATA -e "AB.VE  $valgrind ./pcregrep -F -e DATA -e "AB.VE
196  elephant" $testdata/grepinput >>testtry  elephant" $testdata/grepinput >>testtry
197    
198    echo "---------------------------- Test 49 ------------------------------" >>testtry
199    $valgrind ./pcregrep "^(abc|def|ghi|jkl)" $testdata/grepinputx >>testtry
200    
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; else exit 0; fi  if [ $? != 0 ] ; then exit 1; fi
205    
206    
207    # These tests require UTF-8 support
208    
209    if [ $utf8 -ne 0 ] ; then
210      echo "Testing pcregrep UTF-8 features"
211    
212      echo "---------------------------- Test U1 ------------------------------" >testtry
213      $valgrind ./pcregrep -n -u --newline=any "^X" $testdata/grepinput8 >>testtry
214    
215      echo "---------------------------- Test U2 ------------------------------" >>testtry
216      $valgrind ./pcregrep -n -u -C 3 --newline=any "Match" $testdata/grepinput8 >>testtry
217    
218      $cf testtry $testdata/grepoutput8
219      if [ $? != 0 ] ; then exit 1; fi
220    
221    else
222      echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library"
223    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
252    
253  # End  # End

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

  ViewVC Help
Powered by ViewVC 1.1.5