1 |
#! /bin/sh
|
2 |
|
3 |
# This file is generated by configure from RunTest.in. Make any changes
|
4 |
# to that file.
|
5 |
|
6 |
# Run PCRE tests
|
7 |
|
8 |
cf=diff
|
9 |
testdata=@top_srcdir@/testdata
|
10 |
|
11 |
# Select which tests to run; if no selection, run all
|
12 |
|
13 |
do1=no
|
14 |
do2=no
|
15 |
do3=no
|
16 |
do4=no
|
17 |
do5=no
|
18 |
do6=no
|
19 |
|
20 |
while [ $# -gt 0 ] ; do
|
21 |
case $1 in
|
22 |
1) do1=yes;;
|
23 |
2) do2=yes;;
|
24 |
3) do3=yes;;
|
25 |
4) do4=yes;;
|
26 |
5) do5=yes;;
|
27 |
6) do6=yes;;
|
28 |
*) echo "Unknown test number $1"; exit 1;;
|
29 |
esac
|
30 |
shift
|
31 |
done
|
32 |
|
33 |
if [ "@LINK_SIZE@" != "" -a "@LINK_SIZE@" != "-DLINK_SIZE=2" ] ; then
|
34 |
if [ $do2 = yes ] ; then
|
35 |
echo "Can't run test 2 with an internal link size other than 2"
|
36 |
exit 1
|
37 |
fi
|
38 |
if [ $do5 = yes ] ; then
|
39 |
echo "Can't run test 5 with an internal link size other than 2"
|
40 |
exit 1
|
41 |
fi
|
42 |
if [ $do6 = yes ] ; then
|
43 |
echo "Can't run test 6 with an internal link size other than 2"
|
44 |
exit 1
|
45 |
fi
|
46 |
fi
|
47 |
|
48 |
if [ "@UTF8@" = "" ] ; then
|
49 |
if [ $do4 = yes ] ; then
|
50 |
echo "Can't run test 4 because UTF-8 support is not configured"
|
51 |
exit 1
|
52 |
fi
|
53 |
if [ $do5 = yes ] ; then
|
54 |
echo "Can't run test 5 because UTF-8 support is not configured"
|
55 |
exit 1
|
56 |
fi
|
57 |
if [ $do6 = yes ] ; then
|
58 |
echo "Can't run test 6 because UTF-8 support is not configured"
|
59 |
exit 1
|
60 |
fi
|
61 |
fi
|
62 |
|
63 |
if [ "@UCP@" = "" ] ; then
|
64 |
if [ $do6 = yes ] ; then
|
65 |
echo "Can't run test 6 because Unicode property support is not configured"
|
66 |
exit 1
|
67 |
fi
|
68 |
fi
|
69 |
|
70 |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
|
71 |
$do5 = no -a $do6 = no ] ; then
|
72 |
do1=yes
|
73 |
do2=yes
|
74 |
do3=yes
|
75 |
if [ "@UTF8@" != "" ] ; then do4=yes; fi
|
76 |
if [ "@UTF8@" != "" ] ; then do5=yes; fi
|
77 |
if [ "@UTF8@" != "" -a "@UCP@" != "" ] ; then do6=yes; fi
|
78 |
fi
|
79 |
|
80 |
# Show which release
|
81 |
|
82 |
./pcretest /dev/null
|
83 |
|
84 |
# Primary test, Perl-compatible
|
85 |
|
86 |
if [ $do1 = yes ] ; then
|
87 |
echo "Test 1: main functionality (Perl compatible)"
|
88 |
./pcretest $testdata/testinput1 testtry
|
89 |
if [ $? = 0 ] ; then
|
90 |
$cf testtry $testdata/testoutput1
|
91 |
if [ $? != 0 ] ; then exit 1; fi
|
92 |
echo " "
|
93 |
else exit 1
|
94 |
fi
|
95 |
fi
|
96 |
|
97 |
# PCRE tests that are not Perl-compatible - API & error tests, mostly
|
98 |
|
99 |
if [ $do2 = yes ] ; then
|
100 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
|
101 |
echo "Test 2: API and error handling (not Perl compatible)"
|
102 |
./pcretest -i $testdata/testinput2 testtry
|
103 |
if [ $? = 0 ] ; then
|
104 |
$cf testtry $testdata/testoutput2
|
105 |
if [ $? != 0 ] ; then exit 1; fi
|
106 |
else exit 1
|
107 |
fi
|
108 |
else
|
109 |
echo Test 2 skipped for link size other than 2 \(@LINK_SIZE@\)
|
110 |
fi
|
111 |
fi
|
112 |
|
113 |
if [ $do1 = yes -a $do2 = yes ] ; then
|
114 |
echo " "
|
115 |
echo "The two main tests ran OK"
|
116 |
echo " "
|
117 |
fi
|
118 |
|
119 |
# Locale-specific tests, provided the "fr_FR" locale is available
|
120 |
|
121 |
if [ $do3 = yes ] ; then
|
122 |
locale -a | grep '^fr_FR$' >/dev/null
|
123 |
if [ $? -eq 0 ] ; then
|
124 |
echo "Test 3: locale-specific features (using 'fr_FR' locale)"
|
125 |
./pcretest $testdata/testinput3 testtry
|
126 |
if [ $? = 0 ] ; then
|
127 |
$cf testtry $testdata/testoutput3
|
128 |
if [ $? != 0 ] ; then
|
129 |
echo " "
|
130 |
echo "Locale test did not run entirely successfully."
|
131 |
echo "This usually means that there is a problem with the locale"
|
132 |
echo "settings rather than a bug in PCRE."
|
133 |
else
|
134 |
echo "Locale test ran OK"
|
135 |
fi
|
136 |
echo " "
|
137 |
else exit 1
|
138 |
fi
|
139 |
else
|
140 |
echo "Cannot test locale-specific features - 'fr_FR' locale not found,"
|
141 |
echo "or the \"locale\" command is not available to check for it."
|
142 |
echo " "
|
143 |
fi
|
144 |
fi
|
145 |
|
146 |
# Additional tests for UTF8 support
|
147 |
|
148 |
if [ $do4 = yes ] ; then
|
149 |
echo "Test 4: UTF-8 support (Perl compatible)"
|
150 |
./pcretest $testdata/testinput4 testtry
|
151 |
if [ $? = 0 ] ; then
|
152 |
$cf testtry $testdata/testoutput4
|
153 |
if [ $? != 0 ] ; then exit 1; fi
|
154 |
else exit 1
|
155 |
fi
|
156 |
echo "UTF8 test ran OK"
|
157 |
echo " "
|
158 |
fi
|
159 |
|
160 |
if [ $do5 = yes ] ; then
|
161 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
|
162 |
echo "Test 5: API and internals for UTF-8 support (not Perl compatible)"
|
163 |
./pcretest $testdata/testinput5 testtry
|
164 |
if [ $? = 0 ] ; then
|
165 |
$cf testtry $testdata/testoutput5
|
166 |
if [ $? != 0 ] ; then exit 1; fi
|
167 |
else exit 1
|
168 |
fi
|
169 |
echo "UTF8 internals test ran OK"
|
170 |
echo " "
|
171 |
else
|
172 |
echo Test 5 skipped for link size other than 2 \(@LINK_SIZE@\)
|
173 |
fi
|
174 |
fi
|
175 |
|
176 |
if [ $do6 = yes ] ; then
|
177 |
if [ "@LINK_SIZE@" = "" -o "@LINK_SIZE@" = "-DLINK_SIZE=2" ] ; then
|
178 |
echo "Test 6: Unicode property support"
|
179 |
./pcretest $testdata/testinput6 testtry
|
180 |
if [ $? = 0 ] ; then
|
181 |
$cf testtry $testdata/testoutput6
|
182 |
if [ $? != 0 ] ; then exit 1; fi
|
183 |
else exit 1
|
184 |
fi
|
185 |
echo "Unicode properties test ran OK"
|
186 |
echo " "
|
187 |
else
|
188 |
echo Test 6 skipped for link size other than 2 \(@LINK_SIZE@\)
|
189 |
fi
|
190 |
fi
|
191 |
|
192 |
# End
|