6 |
# Run PCRE tests |
# Run PCRE tests |
7 |
|
|
8 |
cf=diff |
cf=diff |
9 |
|
testdata=@top_srcdir@/testdata |
10 |
|
|
11 |
# Select which tests to run; if no selection, run all |
# Select which tests to run; if no selection, run all |
12 |
|
|
15 |
do3=no |
do3=no |
16 |
do4=no |
do4=no |
17 |
do5=no |
do5=no |
|
do6=no |
|
18 |
|
|
19 |
while [ $# -gt 0 ] ; do |
while [ $# -gt 0 ] ; do |
20 |
case $1 in |
case $1 in |
23 |
3) do3=yes;; |
3) do3=yes;; |
24 |
4) do4=yes;; |
4) do4=yes;; |
25 |
5) do5=yes;; |
5) do5=yes;; |
|
6) do6=yes;; |
|
26 |
*) echo "Unknown test number $1"; exit 1;; |
*) echo "Unknown test number $1"; exit 1;; |
27 |
esac |
esac |
28 |
shift |
shift |
29 |
done |
done |
30 |
|
|
31 |
if [ "@UTF8@" = "" ] ; then |
if [ "@UTF8@" = "" ] ; then |
32 |
if [ $do5 = yes ] ; then |
if [ $do4 = yes ] ; then |
33 |
echo "Can't run test 5 because UFT8 support is not configured" |
echo "Can't run test 4 because UFT8 support is not configured" |
34 |
exit 1 |
exit 1 |
35 |
fi |
fi |
36 |
if [ $do6 = yes ] ; then |
if [ $do5 = yes ] ; then |
37 |
echo "Can't run test 6 because UFT8 support is not configured" |
echo "Can't run test 5 because UFT8 support is not configured" |
38 |
exit 1 |
exit 1 |
39 |
fi |
fi |
40 |
fi |
fi |
41 |
|
|
42 |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a\ |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a\ |
43 |
$do5 = no -a $do6 = no ] ; then |
$do5 = no ] ; then |
44 |
do1=yes |
do1=yes |
45 |
do2=yes |
do2=yes |
46 |
do3=yes |
do3=yes |
47 |
do4=yes |
if [ "@UTF8@" != "" ] ; then do4=yes; fi |
48 |
if [ "@UTF8@" != "" ] ; then do5=yes; fi |
if [ "@UTF8@" != "" ] ; then do5=yes; fi |
|
if [ "@UTF8@" != "" ] ; then do6=yes; fi |
|
49 |
fi |
fi |
50 |
|
|
51 |
# Primary test, Perl-compatible |
# Primary test, Perl-compatible |
52 |
|
|
53 |
if [ $do1 = yes ] ; then |
if [ $do1 = yes ] ; then |
54 |
echo "Testing main functionality (Perl compatible)" |
echo "Testing main functionality (Perl compatible)" |
55 |
./pcretest testdata/testinput1 testtry |
./pcretest $testdata/testinput1 testtry |
56 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
57 |
$cf testtry testdata/testoutput1 |
$cf testtry $testdata/testoutput1 |
58 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
59 |
|
echo " " |
60 |
else exit 1 |
else exit 1 |
61 |
fi |
fi |
62 |
fi |
fi |
65 |
|
|
66 |
if [ $do2 = yes ] ; then |
if [ $do2 = yes ] ; then |
67 |
echo "Testing API and error handling (not Perl compatible)" |
echo "Testing API and error handling (not Perl compatible)" |
68 |
./pcretest -i testdata/testinput2 testtry |
./pcretest -i $testdata/testinput2 testtry |
|
if [ $? = 0 ] ; then |
|
|
$cf testtry testdata/testoutput2 |
|
|
if [ $? != 0 ] ; then exit 1; fi |
|
|
else exit 1 |
|
|
fi |
|
|
fi |
|
|
|
|
|
# Additional Perl-compatible tests for Perl 5.005's new features |
|
|
|
|
|
if [ $do3 = yes ] ; then |
|
|
echo "Testing Perl 5.005 features (Perl 5.005 compatible)" |
|
|
./pcretest testdata/testinput3 testtry |
|
69 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
70 |
$cf testtry testdata/testoutput3 |
$cf testtry $testdata/testoutput2 |
71 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
72 |
else exit 1 |
else exit 1 |
73 |
fi |
fi |
74 |
fi |
fi |
75 |
|
|
76 |
if [ $do1 = yes -a $do2 = yes -a $do3 = yes ] ; then |
if [ $do1 = yes -a $do2 = yes ] ; then |
77 |
echo " " |
echo " " |
78 |
echo "The three main tests all ran OK" |
echo "The two main tests ran OK" |
79 |
echo " " |
echo " " |
80 |
fi |
fi |
81 |
|
|
82 |
# Locale-specific tests, provided the "fr" locale is available |
# Locale-specific tests, provided the "fr" locale is available |
83 |
|
|
84 |
if [ $do4 = yes ] ; then |
if [ $do3 = yes ] ; then |
85 |
locale -a | grep '^fr$' >/dev/null |
locale -a | grep '^fr$' >/dev/null |
86 |
if [ $? -eq 0 ] ; then |
if [ $? -eq 0 ] ; then |
87 |
echo "Testing locale-specific features (using 'fr' locale)" |
echo "Testing locale-specific features (using 'fr' locale)" |
88 |
./pcretest testdata/testinput4 testtry |
./pcretest $testdata/testinput3 testtry |
89 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
90 |
$cf testtry testdata/testoutput4 |
$cf testtry $testdata/testoutput3 |
91 |
if [ $? != 0 ] ; then |
if [ $? != 0 ] ; then |
92 |
echo " " |
echo " " |
93 |
echo "Locale test did not run entirely successfully." |
echo "Locale test did not run entirely successfully." |
108 |
|
|
109 |
# Additional tests for UTF8 support |
# Additional tests for UTF8 support |
110 |
|
|
111 |
if [ $do5 = yes ] ; then |
if [ $do4 = yes ] ; then |
112 |
echo "Testing experimental, incomplete UTF8 support (Perl compatible)" |
echo "Testing UTF-8 support (Perl compatible)" |
113 |
./pcretest testdata/testinput5 testtry |
./pcretest $testdata/testinput4 testtry |
114 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
115 |
$cf testtry testdata/testoutput5 |
$cf testtry $testdata/testoutput4 |
116 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
117 |
else exit 1 |
else exit 1 |
118 |
fi |
fi |
120 |
echo " " |
echo " " |
121 |
fi |
fi |
122 |
|
|
123 |
if [ $do6 = yes ] ; then |
if [ $do5 = yes ] ; then |
124 |
echo "Testing API and internals for UTF8 support (not Perl compatible)" |
echo "Testing API and internals for UTF-8 support (not Perl compatible)" |
125 |
./pcretest testdata/testinput6 testtry |
./pcretest $testdata/testinput5 testtry |
126 |
if [ $? = 0 ] ; then |
if [ $? = 0 ] ; then |
127 |
$cf testtry testdata/testoutput6 |
$cf testtry $testdata/testoutput5 |
128 |
if [ $? != 0 ] ; then exit 1; fi |
if [ $? != 0 ] ; then exit 1; fi |
129 |
else exit 1 |
else exit 1 |
130 |
fi |
fi |