/[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 437 by ph10, Sun Sep 6 16:34:42 2009 UTC
# Line 1  Line 1 
1  #! /bin/sh  #! /bin/sh
2    
 # This file is generated by configure from RunGrepTest.in. Make any changes  
 # to that file.  
   
 echo "Testing pcregrep"  
 ./pcregrep -V  
   
3  # Run pcregrep tests. The assumption is that the PCRE tests check the library  # Run pcregrep tests. The assumption is that the PCRE tests check the library
4  # 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
5  # supported by pcregrep.  # supported by pcregrep.
6    
7  cf=diff  # Set the C locale, so that sort(1) behaves predictably.
8  valgrind=  LC_ALL=C
9  if [ ! -d testdata ] ; then  export LC_ALL
10    ln -s @top_srcdir@/testdata testdata  
11  fi  pcregrep=`pwd`/pcregrep
 testdata=./testdata  
12    
13    echo " "
14    echo "Testing pcregrep"
15    $pcregrep -V
16    
17    valgrind=
18  while [ $# -gt 0 ] ; do  while [ $# -gt 0 ] ; do
19    case $1 in    case $1 in
20      valgrind) valgrind="valgrind -q --leak-check=no";;      valgrind) valgrind="valgrind -q --leak-check=no";;
21      *) echo "Unknown argument $1"; exit 1;;      *) echo "Unknown argument $1"; exit 1;;
22    esac    esac
23    shift    shift
24  done  done
25    
26    cf="diff -ub"
27    
28    # Set up a suitable "diff" command for comparison. Some systems have a diff
29    # that lacks a -u option. Try to deal with this; better do the test for the -b
30    # option as well.
31    
32    if diff -u /dev/null /dev/null; then
33      if diff -ub /dev/null /dev/null; then cf="diff -ub"; else cf="diff -u"; fi
34    else
35      if diff -b /dev/null /dev/null; then cf="diff -b"; else cf="diff"; fi
36    fi
37    
38    # If PCRE has been built in a directory other than the source directory, and
39    # this test is being run from "make check" as usual, then $(srcdir) will be
40    # set. If not, set it to the current directory. We then arrange to run the
41    # pcregrep command in the source directory so that the file names that appear
42    # in the output are always the same.
43    
44    if [ -z "$srcdir" -o ! -d "$srcdir/testdata" ] ; then
45      srcdir=.
46    fi
47    
48    # Check for the availability of UTF-8 support
49    
50    ./pcretest -C | ./pcregrep "No UTF-8 support" >/dev/null
51    utf8=$?
52    
53  echo "---------------------------- Test 1 ------------------------------" >testtry  echo "---------------------------- Test 1 ------------------------------" >testtry
54  $valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep PATTERN ./testdata/grepinput) >>testtry
55    
56  echo "---------------------------- Test 2 ------------------------------" >>testtry  echo "---------------------------- Test 2 ------------------------------" >>testtry
57  $valgrind ./pcregrep '^PATTERN' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep '^PATTERN' ./testdata/grepinput) >>testtry
58    
59  echo "---------------------------- Test 3 ------------------------------" >>testtry  echo "---------------------------- Test 3 ------------------------------" >>testtry
60  $valgrind ./pcregrep -in PATTERN $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -in PATTERN ./testdata/grepinput) >>testtry
61    
62  echo "---------------------------- Test 4 ------------------------------" >>testtry  echo "---------------------------- Test 4 ------------------------------" >>testtry
63  $valgrind ./pcregrep -ic PATTERN $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -ic PATTERN ./testdata/grepinput) >>testtry
64    
65  echo "---------------------------- Test 5 ------------------------------" >>testtry  echo "---------------------------- Test 5 ------------------------------" >>testtry
66  $valgrind ./pcregrep -in PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -in PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
67    
68  echo "---------------------------- Test 6 ------------------------------" >>testtry  echo "---------------------------- Test 6 ------------------------------" >>testtry
69  $valgrind ./pcregrep -inh PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -inh PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
70    
71  echo "---------------------------- Test 7 ------------------------------" >>testtry  echo "---------------------------- Test 7 ------------------------------" >>testtry
72  $valgrind ./pcregrep -il PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -il PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
73    
74  echo "---------------------------- Test 8 ------------------------------" >>testtry  echo "---------------------------- Test 8 ------------------------------" >>testtry
75  $valgrind ./pcregrep -l PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -l PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
76    
77  echo "---------------------------- Test 9 ------------------------------" >>testtry  echo "---------------------------- Test 9 ------------------------------" >>testtry
78  $valgrind ./pcregrep -q PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -q PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
79  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
80    
81  echo "---------------------------- Test 10 -----------------------------" >>testtry  echo "---------------------------- Test 10 -----------------------------" >>testtry
82  $valgrind ./pcregrep -q NEVER-PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -q NEVER-PATTERN ./testdata/grepinput ./testdata/grepinputx) >>testtry
83  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
84    
85  echo "---------------------------- Test 11 -----------------------------" >>testtry  echo "---------------------------- Test 11 -----------------------------" >>testtry
86  $valgrind ./pcregrep -vn pattern $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -vn pattern ./testdata/grepinputx) >>testtry
87    
88  echo "---------------------------- Test 12 -----------------------------" >>testtry  echo "---------------------------- Test 12 -----------------------------" >>testtry
89  $valgrind ./pcregrep -ix pattern $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -ix pattern ./testdata/grepinputx) >>testtry
90    
91  echo "---------------------------- Test 13 -----------------------------" >>testtry  echo "---------------------------- Test 13 -----------------------------" >>testtry
92  $valgrind ./pcregrep -f$testdata/greplist $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -f./testdata/greplist ./testdata/grepinputx) >>testtry
93    
94  echo "---------------------------- Test 14 -----------------------------" >>testtry  echo "---------------------------- Test 14 -----------------------------" >>testtry
95  $valgrind ./pcregrep -w pat $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -w pat ./testdata/grepinput ./testdata/grepinputx) >>testtry
96    
97  echo "---------------------------- Test 15 -----------------------------" >>testtry  echo "---------------------------- Test 15 -----------------------------" >>testtry
98  $valgrind ./pcregrep 'abc^*' $testdata/grepinput 2>>testtry >>testtry  (cd $srcdir; $valgrind $pcregrep 'abc^*' ./testdata/grepinput) 2>>testtry >>testtry
99    
100  echo "---------------------------- Test 16 -----------------------------" >>testtry  echo "---------------------------- Test 16 -----------------------------" >>testtry
101  $valgrind ./pcregrep abc $testdata/grepinput $testdata/nonexistfile 2>>testtry >>testtry  (cd $srcdir; $valgrind $pcregrep abc ./testdata/grepinput ./testdata/nonexistfile) 2>>testtry >>testtry
102    
103  echo "---------------------------- Test 17 -----------------------------" >>testtry  echo "---------------------------- Test 17 -----------------------------" >>testtry
104  $valgrind ./pcregrep -M 'the\noutput' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -M 'the\noutput' ./testdata/grepinput) >>testtry
105    
106  echo "---------------------------- Test 18 -----------------------------" >>testtry  echo "---------------------------- Test 18 -----------------------------" >>testtry
107  $valgrind ./pcregrep -Mn '(the\noutput|dog\.\n--)' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -Mn '(the\noutput|dog\.\n--)' ./testdata/grepinput) >>testtry
108    
109  echo "---------------------------- Test 19 -----------------------------" >>testtry  echo "---------------------------- Test 19 -----------------------------" >>testtry
110  $valgrind ./pcregrep -Mix 'Pattern' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -Mix 'Pattern' ./testdata/grepinputx) >>testtry
111    
112  echo "---------------------------- Test 20 -----------------------------" >>testtry  echo "---------------------------- Test 20 -----------------------------" >>testtry
113  $valgrind ./pcregrep -Mixn 'complete pair\nof lines' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -Mixn 'complete pair\nof lines' ./testdata/grepinputx) >>testtry
114    
115  echo "---------------------------- Test 21 -----------------------------" >>testtry  echo "---------------------------- Test 21 -----------------------------" >>testtry
116  $valgrind ./pcregrep -nA3 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -nA3 'four' ./testdata/grepinputx) >>testtry
117    
118  echo "---------------------------- Test 22 -----------------------------" >>testtry  echo "---------------------------- Test 22 -----------------------------" >>testtry
119  $valgrind ./pcregrep -nB3 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -nB3 'four' ./testdata/grepinputx) >>testtry
120    
121  echo "---------------------------- Test 23 -----------------------------" >>testtry  echo "---------------------------- Test 23 -----------------------------" >>testtry
122  $valgrind ./pcregrep -C3 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -C3 'four' ./testdata/grepinputx) >>testtry
123    
124  echo "---------------------------- Test 24 -----------------------------" >>testtry  echo "---------------------------- Test 24 -----------------------------" >>testtry
125  $valgrind ./pcregrep -A9 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -A9 'four' ./testdata/grepinputx) >>testtry
126    
127  echo "---------------------------- Test 25 -----------------------------" >>testtry  echo "---------------------------- Test 25 -----------------------------" >>testtry
128  $valgrind ./pcregrep -nB9 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -nB9 'four' ./testdata/grepinputx) >>testtry
129    
130  echo "---------------------------- Test 26 -----------------------------" >>testtry  echo "---------------------------- Test 26 -----------------------------" >>testtry
131  $valgrind ./pcregrep -A9 -B9 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -A9 -B9 'four' ./testdata/grepinputx) >>testtry
132    
133  echo "---------------------------- Test 27 -----------------------------" >>testtry  echo "---------------------------- Test 27 -----------------------------" >>testtry
134  $valgrind ./pcregrep -A10 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -A10 'four' ./testdata/grepinputx) >>testtry
135    
136  echo "---------------------------- Test 28 -----------------------------" >>testtry  echo "---------------------------- Test 28 -----------------------------" >>testtry
137  $valgrind ./pcregrep -nB10 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -nB10 'four' ./testdata/grepinputx) >>testtry
138    
139  echo "---------------------------- Test 29 -----------------------------" >>testtry  echo "---------------------------- Test 29 -----------------------------" >>testtry
140  $valgrind ./pcregrep -C12 -B10 'four' $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -C12 -B10 'four' ./testdata/grepinputx) >>testtry
141    
142  echo "---------------------------- Test 30 -----------------------------" >>testtry  echo "---------------------------- Test 30 -----------------------------" >>testtry
143  $valgrind ./pcregrep -inB3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -inB3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtry
144    
145  echo "---------------------------- Test 31 -----------------------------" >>testtry  echo "---------------------------- Test 31 -----------------------------" >>testtry
146  $valgrind ./pcregrep -inA3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -inA3 'pattern' ./testdata/grepinput ./testdata/grepinputx) >>testtry
147    
148  echo "---------------------------- Test 32 -----------------------------" >>testtry  echo "---------------------------- Test 32 -----------------------------" >>testtry
149  $valgrind ./pcregrep -L 'fox' $testdata/grepinput $testdata/grepinputx >>testtry  (cd $srcdir; $valgrind $pcregrep -L 'fox' ./testdata/grepinput ./testdata/grepinputx) >>testtry
150    
151  echo "---------------------------- Test 33 -----------------------------" >>testtry  echo "---------------------------- Test 33 -----------------------------" >>testtry
152  $valgrind ./pcregrep 'fox' $testdata/grepnonexist >>testtry 2>&1  (cd $srcdir; $valgrind $pcregrep 'fox' ./testdata/grepnonexist) >>testtry 2>&1
153  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
154    
155  echo "---------------------------- Test 34 -----------------------------" >>testtry  echo "---------------------------- Test 34 -----------------------------" >>testtry
156  $valgrind ./pcregrep -s 'fox' $testdata/grepnonexist >>testtry 2>&1  (cd $srcdir; $valgrind $pcregrep -s 'fox' ./testdata/grepnonexist) >>testtry 2>&1
157  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
158    
159  echo "---------------------------- Test 35 -----------------------------" >>testtry  echo "---------------------------- Test 35 -----------------------------" >>testtry
160  $valgrind ./pcregrep -L -r --include=grepinputx 'fox' $testdata >>testtry  (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinputx --exclude_dir='^\.' 'fox' ./testdata) >>testtry
161  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
162    
163  echo "---------------------------- Test 36 -----------------------------" >>testtry  echo "---------------------------- Test 36 -----------------------------" >>testtry
164  $valgrind ./pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' $testdata >>testtry  (cd $srcdir; $valgrind $pcregrep -L -r --include=grepinput --exclude 'grepinput$' --exclude_dir='^\.' 'fox' ./testdata | sort) >>testtry
165  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
166    
167  echo "---------------------------- Test 37 -----------------------------" >>testtry  echo "---------------------------- Test 37 -----------------------------" >>testtry
168  $valgrind ./pcregrep  '^(a+)*\d' $testdata/grepinput >>testtry 2>teststderr  (cd $srcdir; $valgrind $pcregrep  '^(a+)*\d' ./testdata/grepinput) >>testtry 2>teststderr
169  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
170  echo "======== STDERR ========" >>testtry  echo "======== STDERR ========" >>testtry
171  cat teststderr >>testtry  cat teststderr >>testtry
172    
173  echo "---------------------------- Test 38 ------------------------------" >>testtry  echo "---------------------------- Test 38 ------------------------------" >>testtry
174  $valgrind ./pcregrep '>\x00<' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep '>\x00<' ./testdata/grepinput) >>testtry
175    
176  echo "---------------------------- Test 39 ------------------------------" >>testtry  echo "---------------------------- Test 39 ------------------------------" >>testtry
177  $valgrind ./pcregrep -A1 'before the binary zero' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -A1 'before the binary zero' ./testdata/grepinput) >>testtry
178    
179  echo "---------------------------- Test 40 ------------------------------" >>testtry  echo "---------------------------- Test 40 ------------------------------" >>testtry
180  $valgrind ./pcregrep -B1 'after the binary zero' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -B1 'after the binary zero' ./testdata/grepinput) >>testtry
181    
182  echo "---------------------------- Test 41 ------------------------------" >>testtry  echo "---------------------------- Test 41 ------------------------------" >>testtry
183  $valgrind ./pcregrep -B1 -o '\w+ the binary zero' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -B1 -o '\w+ the binary zero' ./testdata/grepinput) >>testtry
184    
185  echo "---------------------------- Test 41 ------------------------------" >>testtry  echo "---------------------------- Test 41 ------------------------------" >>testtry
186  $valgrind ./pcregrep -B1 -onH '\w+ the binary zero' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -B1 -onH '\w+ the binary zero' ./testdata/grepinput) >>testtry
187    
188  echo "---------------------------- Test 42 ------------------------------" >>testtry  echo "---------------------------- Test 42 ------------------------------" >>testtry
189  $valgrind ./pcregrep -on 'before|zero|after' $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -on 'before|zero|after' ./testdata/grepinput) >>testtry
190    
191  echo "---------------------------- Test 43 ------------------------------" >>testtry  echo "---------------------------- Test 43 ------------------------------" >>testtry
192  $valgrind ./pcregrep -on -e before -e zero -e after $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -on -e before -ezero -e after ./testdata/grepinput) >>testtry
193    
194  echo "---------------------------- Test 44 ------------------------------" >>testtry  echo "---------------------------- Test 44 ------------------------------" >>testtry
195  $valgrind ./pcregrep -on -f $testdata/greplist -e binary $testdata/grepinput >>testtry  (cd $srcdir; $valgrind $pcregrep -on -f ./testdata/greplist -e binary ./testdata/grepinput) >>testtry
196    
197  echo "---------------------------- Test 45 ------------------------------" >>testtry  echo "---------------------------- Test 45 ------------------------------" >>testtry
198  $valgrind ./pcregrep -e abc -e '(unclosed' $testdata/grepinput 2>>testtry >>testtry  (cd $srcdir; $valgrind $pcregrep -eabc -e '(unclosed' ./testdata/grepinput) 2>>testtry >>testtry
199    
200  echo "---------------------------- Test 46 ------------------------------" >>testtry  echo "---------------------------- Test 46 ------------------------------" >>testtry
201  $valgrind ./pcregrep -Fx "AB.VE  (cd $srcdir; $valgrind $pcregrep -Fx "AB.VE
202  elephant" $testdata/grepinput >>testtry  elephant" ./testdata/grepinput) >>testtry
203    
204  echo "---------------------------- Test 47 ------------------------------" >>testtry  echo "---------------------------- Test 47 ------------------------------" >>testtry
205  $valgrind ./pcregrep -F "AB.VE  (cd $srcdir; $valgrind $pcregrep -F "AB.VE
206  elephant" $testdata/grepinput >>testtry  elephant" ./testdata/grepinput) >>testtry
207    
208  echo "---------------------------- Test 48 ------------------------------" >>testtry  echo "---------------------------- Test 48 ------------------------------" >>testtry
209  $valgrind ./pcregrep -F -e DATA -e "AB.VE  (cd $srcdir; $valgrind $pcregrep -F -e DATA -e "AB.VE
210  elephant" $testdata/grepinput >>testtry  elephant" ./testdata/grepinput) >>testtry
211    
212    echo "---------------------------- Test 49 ------------------------------" >>testtry
213    (cd $srcdir; $valgrind $pcregrep "^(abc|def|ghi|jkl)" ./testdata/grepinputx) >>testtry
214    
215    echo "---------------------------- Test 50 ------------------------------" >>testtry
216    (cd $srcdir; $valgrind $pcregrep -Mv "brown\sfox" ./testdata/grepinputv) >>testtry
217    
218    echo "---------------------------- Test 51 ------------------------------" >>testtry
219    (cd $srcdir; $valgrind $pcregrep --colour=always jumps ./testdata/grepinputv) >>testtry
220    
221    echo "---------------------------- Test 52 ------------------------------" >>testtry
222    (cd $srcdir; $valgrind $pcregrep --file-offsets 'before|zero|after' ./testdata/grepinput) >>testtry
223    
224    echo "---------------------------- Test 53 ------------------------------" >>testtry
225    (cd $srcdir; $valgrind $pcregrep --line-offsets 'before|zero|after' ./testdata/grepinput) >>testtry
226    
227    echo "---------------------------- Test 54 -----------------------------" >>testtry
228    (cd $srcdir; $valgrind $pcregrep -f./testdata/greplist --color=always ./testdata/grepinputx) >>testtry
229    
230    echo "---------------------------- Test 55 -----------------------------" >>testtry
231    (cd $srcdir; $valgrind $pcregrep -c lazy ./testdata/grepinput*) >>testtry
232    
233    echo "---------------------------- Test 56 -----------------------------" >>testtry
234    (cd $srcdir; $valgrind $pcregrep -c -l lazy ./testdata/grepinput*) >>testtry
235    
236    echo "---------------------------- Test 57 -----------------------------" >>testtry
237    (cd $srcdir; $valgrind $pcregrep --regex=PATTERN ./testdata/grepinput) >>testtry
238    
239    echo "---------------------------- Test 58 -----------------------------" >>testtry
240    (cd $srcdir; $valgrind $pcregrep --regexp=PATTERN ./testdata/grepinput) >>testtry
241    
242    echo "---------------------------- Test 59 -----------------------------" >>testtry
243    (cd $srcdir; $valgrind $pcregrep --regex PATTERN ./testdata/grepinput) >>testtry
244    
245    echo "---------------------------- Test 60 -----------------------------" >>testtry
246    (cd $srcdir; $valgrind $pcregrep --regexp PATTERN ./testdata/grepinput) >>testtry
247    
248  # Now compare the results.  # Now compare the results.
249    
250  $cf testtry $testdata/grepoutput  $cf $srcdir/testdata/grepoutput testtry
251  if [ $? != 0 ] ; then exit 1; else exit 0; fi  if [ $? != 0 ] ; then exit 1; fi
252    
253    
254    # These tests require UTF-8 support
255    
256    if [ $utf8 -ne 0 ] ; then
257      echo "Testing pcregrep UTF-8 features"
258    
259      echo "---------------------------- Test U1 ------------------------------" >testtry
260      (cd $srcdir; $valgrind $pcregrep -n -u --newline=any "^X" ./testdata/grepinput8) >>testtry
261    
262      echo "---------------------------- Test U2 ------------------------------" >>testtry
263      (cd $srcdir; $valgrind $pcregrep -n -u -C 3 --newline=any "Match" ./testdata/grepinput8) >>testtry
264    
265      $cf $srcdir/testdata/grepoutput8 testtry
266      if [ $? != 0 ] ; then exit 1; fi
267    
268    else
269      echo "Skipping pcregrep UTF-8 tests: no UTF-8 support in PCRE library"
270    fi
271    
272    
273    # We go to some contortions to try to ensure that the tests for the various
274    # newline settings will work in environments where the normal newline sequence
275    # is not \n. Do not use exported files, whose line endings might be changed.
276    # Instead, create an input file using printf so that its contents are exactly
277    # what we want. Note the messy fudge to get printf to write a string that
278    # starts with a hyphen.
279    
280    echo "Testing pcregrep newline settings"
281    printf "abc\rdef\r\nghi\njkl" >testNinput
282    
283    printf "%c--------------------------- Test N1 ------------------------------\r\n" - >testtry
284    $valgrind $pcregrep -n -N CR "^(abc|def|ghi|jkl)" testNinput >>testtry
285    
286    printf "%c--------------------------- Test N2 ------------------------------\r\n" - >>testtry
287    $valgrind $pcregrep -n --newline=crlf "^(abc|def|ghi|jkl)" testNinput >>testtry
288    
289    printf "%c--------------------------- Test N3 ------------------------------\r\n" - >>testtry
290    pattern=`printf 'def\rjkl'`
291    $valgrind $pcregrep -n --newline=cr -F "$pattern" testNinput >>testtry
292    
293    printf "%c--------------------------- Test N4 ------------------------------\r\n" - >>testtry
294    pattern=`printf 'xxx\r\njkl'`
295    $valgrind $pcregrep -n --newline=crlf -F "$pattern" testNinput >>testtry
296    
297    printf "%c--------------------------- Test N5 ------------------------------\r\n" - >>testtry
298    $valgrind $pcregrep -n --newline=any "^(abc|def|ghi|jkl)" testNinput >>testtry
299    
300    printf "%c--------------------------- Test N6 ------------------------------\r\n" - >>testtry
301    $valgrind $pcregrep -n --newline=anycrlf "^(abc|def|ghi|jkl)" testNinput >>testtry
302    
303    $cf $srcdir/testdata/grepoutputN testtry
304    if [ $? != 0 ] ; then exit 1; fi
305    
306    exit 0
307    
308  # End  # End

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

  ViewVC Help
Powered by ViewVC 1.1.5