| 1 |
nigel |
23 |
#! /bin/sh |
| 2 |
|
|
|
| 3 |
|
|
# Run PCRE tests |
| 4 |
|
|
|
| 5 |
|
|
cf=diff |
| 6 |
|
|
|
| 7 |
|
|
# Select which tests to run; if no selection, run all |
| 8 |
|
|
|
| 9 |
|
|
do1=no |
| 10 |
|
|
do2=no |
| 11 |
|
|
do3=no |
| 12 |
nigel |
25 |
do4=no |
| 13 |
nigel |
23 |
|
| 14 |
|
|
while [ $# -gt 0 ] ; do |
| 15 |
|
|
case $1 in |
| 16 |
|
|
1) do1=yes;; |
| 17 |
|
|
2) do2=yes;; |
| 18 |
|
|
3) do3=yes;; |
| 19 |
nigel |
25 |
4) do4=yes;; |
| 20 |
|
|
*) echo "Unknown test number $1"; exit 1;; |
| 21 |
nigel |
23 |
esac |
| 22 |
|
|
shift |
| 23 |
|
|
done |
| 24 |
|
|
|
| 25 |
nigel |
25 |
if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no ] ; then |
| 26 |
nigel |
23 |
do1=yes |
| 27 |
|
|
do2=yes |
| 28 |
|
|
do3=yes |
| 29 |
nigel |
25 |
do4=yes |
| 30 |
|
|
fi |
| 31 |
|
|
|
| 32 |
nigel |
23 |
# Primary test, Perl-compatible |
| 33 |
|
|
|
| 34 |
|
|
if [ $do1 = yes ] ; then |
| 35 |
|
|
echo "Testing main functionality (Perl compatible)" |
| 36 |
|
|
./pcretest testinput testtry |
| 37 |
nigel |
25 |
if [ $? = 0 ] ; then |
| 38 |
nigel |
23 |
$cf testtry testoutput |
| 39 |
nigel |
25 |
if [ $? != 0 ] ; then exit 1; fi |
| 40 |
nigel |
23 |
else exit 1 |
| 41 |
|
|
fi |
| 42 |
|
|
fi |
| 43 |
|
|
|
| 44 |
|
|
# PCRE tests that are not Perl-compatible - API & error tests, mostly |
| 45 |
|
|
|
| 46 |
|
|
if [ $do2 = yes ] ; then |
| 47 |
|
|
echo "Testing API and error handling (not Perl compatible)" |
| 48 |
|
|
./pcretest -i testinput2 testtry |
| 49 |
nigel |
25 |
if [ $? = 0 ] ; then |
| 50 |
|
|
$cf testtry testoutput2 |
| 51 |
|
|
if [ $? != 0 ] ; then exit 1; fi |
| 52 |
nigel |
23 |
else exit 1 |
| 53 |
|
|
fi |
| 54 |
|
|
fi |
| 55 |
|
|
|
| 56 |
|
|
# Additional Perl-compatible tests for Perl 5.005's new features |
| 57 |
|
|
|
| 58 |
|
|
if [ $do3 = yes ] ; then |
| 59 |
|
|
echo "Testing Perl 5.005 features (Perl 5.005 compatible)" |
| 60 |
|
|
./pcretest testinput3 testtry |
| 61 |
nigel |
25 |
if [ $? = 0 ] ; then |
| 62 |
nigel |
23 |
$cf testtry testoutput3 |
| 63 |
nigel |
25 |
if [ $? != 0 ] ; then exit 1; fi |
| 64 |
nigel |
23 |
else exit 1 |
| 65 |
|
|
fi |
| 66 |
|
|
fi |
| 67 |
|
|
|
| 68 |
|
|
if [ $do1 = yes -a $do2 = yes -a $do3 = yes ] ; then |
| 69 |
nigel |
25 |
echo "The three main tests all ran OK" |
| 70 |
|
|
echo " " |
| 71 |
|
|
fi |
| 72 |
nigel |
23 |
|
| 73 |
nigel |
25 |
# Locale-specific tests, provided the "fr" locale is available |
| 74 |
|
|
|
| 75 |
|
|
if [ $do4 = yes ] ; then |
| 76 |
|
|
locale -a | grep '^fr$' >/dev/null |
| 77 |
|
|
if [ $? -eq 0 ] ; then |
| 78 |
|
|
echo "Testing locale-specific features (using 'fr' locale)" |
| 79 |
|
|
./pcretest testinput4 testtry |
| 80 |
|
|
if [ $? = 0 ] ; then |
| 81 |
|
|
$cf testtry testoutput4 |
| 82 |
|
|
if [ $? != 0 ] ; then exit 1; fi |
| 83 |
|
|
echo "Locale test ran OK" |
| 84 |
|
|
echo " " |
| 85 |
|
|
else exit 1 |
| 86 |
|
|
fi |
| 87 |
|
|
else |
| 88 |
|
|
echo "Cannot test locale-specific features - 'fr' locale not found," |
| 89 |
|
|
echo "or the \"locale\" command is not available to check for it." |
| 90 |
|
|
echo " " |
| 91 |
|
|
fi |
| 92 |
|
|
fi |
| 93 |
|
|
|
| 94 |
|
|
# End |