/[pcre]/code/tags/pcre-8.01/RunGrepTest
ViewVC logotype

Diff of /code/tags/pcre-8.01/RunGrepTest

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

revision 86 by nigel, Sat Feb 24 21:40:59 2007 UTC revision 87 by nigel, Sat Feb 24 21:41:21 2007 UTC
# Line 4  Line 4 
4  # to that file.  # to that file.
5    
6  echo "Testing pcregrep"  echo "Testing pcregrep"
7    ./pcregrep -V
8    
9  # 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
10  # 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
11  # supported by pcregrep.  # supported by pcregrep.
12    
13  cf=diff  cf=diff
14    valgrind=
15  if [ ! -d testdata ] ; then  if [ ! -d testdata ] ; then
16    ln -s @top_srcdir@/testdata testdata    ln -s @top_srcdir@/testdata testdata
17  fi  fi
18  testdata=./testdata  testdata=./testdata
19    
20  ./pcregrep -V 2>testtry  while [ $# -gt 0 ] ; do
21      case $1 in
22        valgrind) valgrind="valgrind -q --leak-check=no";;
23        *) echo "Unknown argument $1"; exit 1;;
24      esac
25      shift
26    done
27    
28  echo "---------------------------- Test 1 ------------------------------" >>testtry  echo "---------------------------- Test 1 ------------------------------" >testtry
29  ./pcregrep PATTERN $testdata/grepinput >>testtry  $valgrind ./pcregrep PATTERN $testdata/grepinput >>testtry
30    
31  echo "---------------------------- Test 2 ------------------------------" >>testtry  echo "---------------------------- Test 2 ------------------------------" >>testtry
32  ./pcregrep '^PATTERN' $testdata/grepinput >>testtry  $valgrind ./pcregrep '^PATTERN' $testdata/grepinput >>testtry
33    
34  echo "---------------------------- Test 3 ------------------------------" >>testtry  echo "---------------------------- Test 3 ------------------------------" >>testtry
35  ./pcregrep -in PATTERN $testdata/grepinput >>testtry  $valgrind ./pcregrep -in PATTERN $testdata/grepinput >>testtry
36    
37  echo "---------------------------- Test 4 ------------------------------" >>testtry  echo "---------------------------- Test 4 ------------------------------" >>testtry
38  ./pcregrep -ic PATTERN $testdata/grepinput >>testtry  $valgrind ./pcregrep -ic PATTERN $testdata/grepinput >>testtry
39    
40  echo "---------------------------- Test 5 ------------------------------" >>testtry  echo "---------------------------- Test 5 ------------------------------" >>testtry
41  ./pcregrep -in PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -in PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
42    
43  echo "---------------------------- Test 6 ------------------------------" >>testtry  echo "---------------------------- Test 6 ------------------------------" >>testtry
44  ./pcregrep -inh PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -inh PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
45    
46  echo "---------------------------- Test 7 ------------------------------" >>testtry  echo "---------------------------- Test 7 ------------------------------" >>testtry
47  ./pcregrep -il PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -il PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
48    
49  echo "---------------------------- Test 8 ------------------------------" >>testtry  echo "---------------------------- Test 8 ------------------------------" >>testtry
50  ./pcregrep -l PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -l PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
51    
52  echo "---------------------------- Test 9 ------------------------------" >>testtry  echo "---------------------------- Test 9 ------------------------------" >>testtry
53  ./pcregrep -q PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -q PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
54  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
55    
56  echo "---------------------------- Test 10 -----------------------------" >>testtry  echo "---------------------------- Test 10 -----------------------------" >>testtry
57  ./pcregrep -q NEVER-PATTERN $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -q NEVER-PATTERN $testdata/grepinput $testdata/grepinputx >>testtry
58  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
59    
60  echo "---------------------------- Test 11 -----------------------------" >>testtry  echo "---------------------------- Test 11 -----------------------------" >>testtry
61  ./pcregrep -vn pattern $testdata/grepinputx >>testtry  $valgrind ./pcregrep -vn pattern $testdata/grepinputx >>testtry
62    
63  echo "---------------------------- Test 12 -----------------------------" >>testtry  echo "---------------------------- Test 12 -----------------------------" >>testtry
64  ./pcregrep -ix pattern $testdata/grepinputx >>testtry  $valgrind ./pcregrep -ix pattern $testdata/grepinputx >>testtry
65    
66  echo "---------------------------- Test 13 -----------------------------" >>testtry  echo "---------------------------- Test 13 -----------------------------" >>testtry
67  ./pcregrep -f$testdata/greplist $testdata/grepinputx >>testtry  $valgrind ./pcregrep -f$testdata/greplist $testdata/grepinputx >>testtry
68    
69  echo "---------------------------- Test 14 -----------------------------" >>testtry  echo "---------------------------- Test 14 -----------------------------" >>testtry
70  ./pcregrep -w pat $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -w pat $testdata/grepinput $testdata/grepinputx >>testtry
71    
72  echo "---------------------------- Test 15 -----------------------------" >>testtry  echo "---------------------------- Test 15 -----------------------------" >>testtry
73  ./pcregrep 'abc^*' $testdata/grepinput 2>>testtry >>testtry  $valgrind ./pcregrep 'abc^*' $testdata/grepinput 2>>testtry >>testtry
74    
75  echo "---------------------------- Test 16 -----------------------------" >>testtry  echo "---------------------------- Test 16 -----------------------------" >>testtry
76  ./pcregrep abc $testdata/grepinput $testdata/nonexistfile 2>>testtry >>testtry  $valgrind ./pcregrep abc $testdata/grepinput $testdata/nonexistfile 2>>testtry >>testtry
77    
78  echo "---------------------------- Test 17 -----------------------------" >>testtry  echo "---------------------------- Test 17 -----------------------------" >>testtry
79  ./pcregrep -M 'the\noutput' $testdata/grepinput >>testtry  $valgrind ./pcregrep -M 'the\noutput' $testdata/grepinput >>testtry
80    
81  echo "---------------------------- Test 18 -----------------------------" >>testtry  echo "---------------------------- Test 18 -----------------------------" >>testtry
82  ./pcregrep -Mn '(the\noutput|dog\.\n--)' $testdata/grepinput >>testtry  $valgrind ./pcregrep -Mn '(the\noutput|dog\.\n--)' $testdata/grepinput >>testtry
83    
84  echo "---------------------------- Test 19 -----------------------------" >>testtry  echo "---------------------------- Test 19 -----------------------------" >>testtry
85  ./pcregrep -Mix 'Pattern' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -Mix 'Pattern' $testdata/grepinputx >>testtry
86    
87  echo "---------------------------- Test 20 -----------------------------" >>testtry  echo "---------------------------- Test 20 -----------------------------" >>testtry
88  ./pcregrep -Mixn 'complete pair\nof lines' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -Mixn 'complete pair\nof lines' $testdata/grepinputx >>testtry
89    
90  echo "---------------------------- Test 21 -----------------------------" >>testtry  echo "---------------------------- Test 21 -----------------------------" >>testtry
91  ./pcregrep -nA3 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -nA3 'four' $testdata/grepinputx >>testtry
92    
93  echo "---------------------------- Test 22 -----------------------------" >>testtry  echo "---------------------------- Test 22 -----------------------------" >>testtry
94  ./pcregrep -nB3 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -nB3 'four' $testdata/grepinputx >>testtry
95    
96  echo "---------------------------- Test 23 -----------------------------" >>testtry  echo "---------------------------- Test 23 -----------------------------" >>testtry
97  ./pcregrep -C3 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -C3 'four' $testdata/grepinputx >>testtry
98    
99  echo "---------------------------- Test 24 -----------------------------" >>testtry  echo "---------------------------- Test 24 -----------------------------" >>testtry
100  ./pcregrep -A9 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -A9 'four' $testdata/grepinputx >>testtry
101    
102  echo "---------------------------- Test 25 -----------------------------" >>testtry  echo "---------------------------- Test 25 -----------------------------" >>testtry
103  ./pcregrep -nB9 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -nB9 'four' $testdata/grepinputx >>testtry
104    
105  echo "---------------------------- Test 26 -----------------------------" >>testtry  echo "---------------------------- Test 26 -----------------------------" >>testtry
106  ./pcregrep -A9 -B9 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -A9 -B9 'four' $testdata/grepinputx >>testtry
107    
108  echo "---------------------------- Test 27 -----------------------------" >>testtry  echo "---------------------------- Test 27 -----------------------------" >>testtry
109  ./pcregrep -A10 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -A10 'four' $testdata/grepinputx >>testtry
110    
111  echo "---------------------------- Test 28 -----------------------------" >>testtry  echo "---------------------------- Test 28 -----------------------------" >>testtry
112  ./pcregrep -nB10 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -nB10 'four' $testdata/grepinputx >>testtry
113    
114  echo "---------------------------- Test 29 -----------------------------" >>testtry  echo "---------------------------- Test 29 -----------------------------" >>testtry
115  ./pcregrep -C12 -B10 'four' $testdata/grepinputx >>testtry  $valgrind ./pcregrep -C12 -B10 'four' $testdata/grepinputx >>testtry
116    
117  echo "---------------------------- Test 30 -----------------------------" >>testtry  echo "---------------------------- Test 30 -----------------------------" >>testtry
118  ./pcregrep -inB3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -inB3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry
119    
120  echo "---------------------------- Test 31 -----------------------------" >>testtry  echo "---------------------------- Test 31 -----------------------------" >>testtry
121  ./pcregrep -inA3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -inA3 'pattern' $testdata/grepinput $testdata/grepinputx >>testtry
122    
123  echo "---------------------------- Test 32 -----------------------------" >>testtry  echo "---------------------------- Test 32 -----------------------------" >>testtry
124  ./pcregrep -L 'fox' $testdata/grepinput $testdata/grepinputx >>testtry  $valgrind ./pcregrep -L 'fox' $testdata/grepinput $testdata/grepinputx >>testtry
125    
126  echo "---------------------------- Test 33 -----------------------------" >>testtry  echo "---------------------------- Test 33 -----------------------------" >>testtry
127  ./pcregrep 'fox' $testdata/grepnonexist >>testtry 2>&1  $valgrind ./pcregrep 'fox' $testdata/grepnonexist >>testtry 2>&1
128  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
129    
130  echo "---------------------------- Test 34 -----------------------------" >>testtry  echo "---------------------------- Test 34 -----------------------------" >>testtry
131  ./pcregrep -s 'fox' $testdata/grepnonexist >>testtry 2>&1  $valgrind ./pcregrep -s 'fox' $testdata/grepnonexist >>testtry 2>&1
132  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
133    
134  echo "---------------------------- Test 35 -----------------------------" >>testtry  echo "---------------------------- Test 35 -----------------------------" >>testtry
135  ./pcregrep -L -r --include=grepinputx 'fox' $testdata >>testtry  $valgrind ./pcregrep -L -r --include=grepinputx 'fox' $testdata >>testtry
136  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
137    
138  echo "---------------------------- Test 36 -----------------------------" >>testtry  echo "---------------------------- Test 36 -----------------------------" >>testtry
139  ./pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' $testdata >>testtry  $valgrind ./pcregrep -L -r --include=grepinput --exclude 'grepinput$' 'fox' $testdata >>testtry
140  echo "RC=$?" >>testtry  echo "RC=$?" >>testtry
141    
142    echo "---------------------------- Test 37 -----------------------------" >>testtry
143    $valgrind ./pcregrep  '^(a+)*\d' $testdata/grepinput >>testtry 2>teststderr
144    echo "RC=$?" >>testtry
145    echo "======== STDERR ========" >>testtry
146    cat teststderr >>testtry
147    
148    echo "---------------------------- Test 38 ------------------------------" >>testtry
149    $valgrind ./pcregrep '>\x00<' $testdata/grepinput >>testtry
150    
151    echo "---------------------------- Test 39 ------------------------------" >>testtry
152    $valgrind ./pcregrep -A1 'before the binary zero' $testdata/grepinput >>testtry
153    
154    echo "---------------------------- Test 40 ------------------------------" >>testtry
155    $valgrind ./pcregrep -B1 'after the binary zero' $testdata/grepinput >>testtry
156    
157    echo "---------------------------- Test 41 ------------------------------" >>testtry
158    $valgrind ./pcregrep -B1 -o '\w+ the binary zero' $testdata/grepinput >>testtry
159    
160    echo "---------------------------- Test 41 ------------------------------" >>testtry
161    $valgrind ./pcregrep -B1 -onH '\w+ the binary zero' $testdata/grepinput >>testtry
162    
163    echo "---------------------------- Test 42 ------------------------------" >>testtry
164    $valgrind ./pcregrep -on 'before|zero|after' $testdata/grepinput >>testtry
165    
166    echo "---------------------------- Test 43 ------------------------------" >>testtry
167    $valgrind ./pcregrep -on -e before -e zero -e after $testdata/grepinput >>testtry
168    
169    echo "---------------------------- Test 44 ------------------------------" >>testtry
170    $valgrind ./pcregrep -on -f $testdata/greplist -e binary $testdata/grepinput >>testtry
171    
172    echo "---------------------------- Test 45 ------------------------------" >>testtry
173    $valgrind ./pcregrep -e abc -e '(unclosed' $testdata/grepinput 2>>testtry >>testtry
174    
175    echo "---------------------------- Test 46 ------------------------------" >>testtry
176    $valgrind ./pcregrep -Fx "AB.VE
177    elephant" $testdata/grepinput >>testtry
178    
179    echo "---------------------------- Test 47 ------------------------------" >>testtry
180    $valgrind ./pcregrep -F "AB.VE
181    elephant" $testdata/grepinput >>testtry
182    
183    echo "---------------------------- Test 48 ------------------------------" >>testtry
184    $valgrind ./pcregrep -F -e DATA -e "AB.VE
185    elephant" $testdata/grepinput >>testtry
186    
187  # Now compare the results.  # Now compare the results.
188    

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12