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 |
|
19 |
while [ $# -gt 0 ] ; do
|
20 |
case $1 in
|
21 |
1) do1=yes;;
|
22 |
2) do2=yes;;
|
23 |
3) do3=yes;;
|
24 |
4) do4=yes;;
|
25 |
5) do5=yes;;
|
26 |
*) echo "Unknown test number $1"; exit 1;;
|
27 |
esac
|
28 |
shift
|
29 |
done
|
30 |
|
31 |
if [ "@UTF8@" = "" ] ; then
|
32 |
if [ $do4 = yes ] ; then
|
33 |
echo "Can't run test 4 because UFT8 support is not configured"
|
34 |
exit 1
|
35 |
fi
|
36 |
if [ $do5 = yes ] ; then
|
37 |
echo "Can't run test 5 because UFT8 support is not configured"
|
38 |
exit 1
|
39 |
fi
|
40 |
fi
|
41 |
|
42 |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a\
|
43 |
$do5 = no ] ; then
|
44 |
do1=yes
|
45 |
do2=yes
|
46 |
do3=yes
|
47 |
if [ "@UTF8@" != "" ] ; then do4=yes; fi
|
48 |
if [ "@UTF8@" != "" ] ; then do5=yes; fi
|
49 |
fi
|
50 |
|
51 |
# Show which release
|
52 |
|
53 |
./pcretest /dev/null
|
54 |
|
55 |
# Primary test, Perl-compatible
|
56 |
|
57 |
if [ $do1 = yes ] ; then
|
58 |
echo "Testing main functionality (Perl compatible)"
|
59 |
./pcretest $testdata/testinput1 testtry
|
60 |
if [ $? = 0 ] ; then
|
61 |
$cf testtry $testdata/testoutput1
|
62 |
if [ $? != 0 ] ; then exit 1; fi
|
63 |
echo " "
|
64 |
else exit 1
|
65 |
fi
|
66 |
fi
|
67 |
|
68 |
# PCRE tests that are not Perl-compatible - API & error tests, mostly
|
69 |
|
70 |
if [ $do2 = yes ] ; then
|
71 |
echo "Testing API and error handling (not Perl compatible)"
|
72 |
./pcretest -i $testdata/testinput2 testtry
|
73 |
if [ $? = 0 ] ; then
|
74 |
$cf testtry $testdata/testoutput2
|
75 |
if [ $? != 0 ] ; then exit 1; fi
|
76 |
else exit 1
|
77 |
fi
|
78 |
fi
|
79 |
|
80 |
if [ $do1 = yes -a $do2 = yes ] ; then
|
81 |
echo " "
|
82 |
echo "The two main tests ran OK"
|
83 |
echo " "
|
84 |
fi
|
85 |
|
86 |
# Locale-specific tests, provided the "fr_FR" locale is available
|
87 |
|
88 |
if [ $do3 = yes ] ; then
|
89 |
locale -a | grep '^fr_FR$' >/dev/null
|
90 |
if [ $? -eq 0 ] ; then
|
91 |
echo "Testing locale-specific features (using 'fr_FR' locale)"
|
92 |
./pcretest $testdata/testinput3 testtry
|
93 |
if [ $? = 0 ] ; then
|
94 |
$cf testtry $testdata/testoutput3
|
95 |
if [ $? != 0 ] ; then
|
96 |
echo " "
|
97 |
echo "Locale test did not run entirely successfully."
|
98 |
echo "This usually means that there is a problem with the locale"
|
99 |
echo "settings rather than a bug in PCRE."
|
100 |
else
|
101 |
echo "Locale test ran OK"
|
102 |
fi
|
103 |
echo " "
|
104 |
else exit 1
|
105 |
fi
|
106 |
else
|
107 |
echo "Cannot test locale-specific features - 'fr_FR' locale not found,"
|
108 |
echo "or the \"locale\" command is not available to check for it."
|
109 |
echo " "
|
110 |
fi
|
111 |
fi
|
112 |
|
113 |
# Additional tests for UTF8 support
|
114 |
|
115 |
if [ $do4 = yes ] ; then
|
116 |
echo "Testing UTF-8 support (Perl compatible)"
|
117 |
./pcretest $testdata/testinput4 testtry
|
118 |
if [ $? = 0 ] ; then
|
119 |
$cf testtry $testdata/testoutput4
|
120 |
if [ $? != 0 ] ; then exit 1; fi
|
121 |
else exit 1
|
122 |
fi
|
123 |
echo "UTF8 test ran OK"
|
124 |
echo " "
|
125 |
fi
|
126 |
|
127 |
if [ $do5 = yes ] ; then
|
128 |
echo "Testing API and internals for UTF-8 support (not Perl compatible)"
|
129 |
./pcretest $testdata/testinput5 testtry
|
130 |
if [ $? = 0 ] ; then
|
131 |
$cf testtry $testdata/testoutput5
|
132 |
if [ $? != 0 ] ; then exit 1; fi
|
133 |
else exit 1
|
134 |
fi
|
135 |
echo "UTF8 internals test ran OK"
|
136 |
echo " "
|
137 |
fi
|
138 |
|
139 |
# End
|