| 1 |
#! /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 |
|
| 13 |
while [ $# -gt 0 ] ; do
|
| 14 |
case $1 in
|
| 15 |
1) do1=yes;;
|
| 16 |
2) do2=yes;;
|
| 17 |
3) do3=yes;;
|
| 18 |
*) echo "Unknown test number $1"; exit 1;;
|
| 19 |
esac
|
| 20 |
shift
|
| 21 |
done
|
| 22 |
|
| 23 |
if [ $do1 = no -a $do2 = no -a $do3 = no ] ; then
|
| 24 |
do1=yes
|
| 25 |
do2=yes
|
| 26 |
do3=yes
|
| 27 |
fi
|
| 28 |
|
| 29 |
# Primary test, Perl-compatible
|
| 30 |
|
| 31 |
if [ $do1 = yes ] ; then
|
| 32 |
echo "Testing main functionality (Perl compatible)"
|
| 33 |
./pcretest testinput testtry
|
| 34 |
if [ $? = 0 ] ; then
|
| 35 |
$cf testtry testoutput
|
| 36 |
if [ $? != 0 ] ; then exit 1; fi
|
| 37 |
else exit 1
|
| 38 |
fi
|
| 39 |
fi
|
| 40 |
|
| 41 |
# PCRE tests that are not Perl-compatible - API & error tests, mostly
|
| 42 |
|
| 43 |
if [ $do2 = yes ] ; then
|
| 44 |
echo "Testing API and error handling (not Perl compatible)"
|
| 45 |
./pcretest -i testinput2 testtry
|
| 46 |
if [ $? = 0 ] ; then
|
| 47 |
$cf testtry testoutput2
|
| 48 |
if [ $? != 0 ] ; then exit 1; fi
|
| 49 |
else exit 1
|
| 50 |
fi
|
| 51 |
fi
|
| 52 |
|
| 53 |
# Additional Perl-compatible tests for Perl 5.005's new features
|
| 54 |
|
| 55 |
if [ $do3 = yes ] ; then
|
| 56 |
echo "Testing Perl 5.005 features (Perl 5.005 compatible)"
|
| 57 |
./pcretest testinput3 testtry
|
| 58 |
if [ $? = 0 ] ; then
|
| 59 |
$cf testtry testoutput3
|
| 60 |
if [ $? != 0 ] ; then exit 1; fi
|
| 61 |
else exit 1
|
| 62 |
fi
|
| 63 |
fi
|
| 64 |
|
| 65 |
if [ $do1 = yes -a $do2 = yes -a $do3 = yes ] ; then
|
| 66 |
echo "Tests all ran OK"
|
| 67 |
fi
|
| 68 |
|
| 69 |
# End
|