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