| 1 |
#! /bin/sh
|
| 2 |
|
| 3 |
# This is a script for the use of PCRE maintainers. It configures and rebuilds
|
| 4 |
# PCRE with a variety of configuration options, and in each case runs the tests
|
| 5 |
# to ensure that all goes well. Every possible combination would take far too
|
| 6 |
# long, so we use a representative sample. As well as testing that they work,
|
| 7 |
# we use --disable-shared or --disable-static after the first test (which
|
| 8 |
# builds both) to save a bit of time by building only one version for the
|
| 9 |
# subsequent tests.
|
| 10 |
|
| 11 |
# Some of the tests have to be skipped when PCRE is built with non-Unix newline
|
| 12 |
# recognition. I am planning to reduce this as much as possible in due course.
|
| 13 |
|
| 14 |
# This is in case the caller has set aliases (as I do - PH)
|
| 15 |
|
| 16 |
unset cp ls mv rm
|
| 17 |
|
| 18 |
# Use -v to make the output more verbose
|
| 19 |
|
| 20 |
verbose=0
|
| 21 |
if [ "$1" = "-v" ] ; then verbose=1; fi
|
| 22 |
|
| 23 |
# The first (empty) configuration builds with all the default settings.
|
| 24 |
|
| 25 |
for opts in \
|
| 26 |
"" \
|
| 27 |
"--enable-utf8 --disable-static" \
|
| 28 |
"--enable-unicode-properties --disable-shared" \
|
| 29 |
"--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \
|
| 30 |
"--enable-unicode-properties --disable-cpp --with-link-size=3 --disable-shared" \
|
| 31 |
"--enable-rebuild-chartables --disable-shared" \
|
| 32 |
"--enable-newline-is-any --disable-shared" \
|
| 33 |
"--enable-newline-is-cr --disable-shared" \
|
| 34 |
"--enable-newline-is-crlf --disable-shared" \
|
| 35 |
"--enable-utf8 --enable-newline-is-any --enable-unicode-properties --disable-stack-for-recursion --disable-static --disable-cpp"
|
| 36 |
do
|
| 37 |
rm -f *_unittest
|
| 38 |
|
| 39 |
if [ "$opts" = "" ] ; then
|
| 40 |
echo "===> Configuring with: default settings"
|
| 41 |
else
|
| 42 |
olen=`expr length "$opts"`
|
| 43 |
if [ $olen -gt 56 ] ; then
|
| 44 |
echo "===> Configuring with:"
|
| 45 |
echo " $opts"
|
| 46 |
else
|
| 47 |
echo "===> Configuring with: $opts"
|
| 48 |
fi
|
| 49 |
fi
|
| 50 |
|
| 51 |
./configure $opts >/dev/null 2>teststderr
|
| 52 |
if [ $? -ne 0 ]; then
|
| 53 |
echo " "
|
| 54 |
echo "**** Error while configuring ****"
|
| 55 |
cat teststderr
|
| 56 |
exit 1
|
| 57 |
fi
|
| 58 |
|
| 59 |
echo "===> Making"
|
| 60 |
make >/dev/null 2>teststderr
|
| 61 |
if [ $? -ne 0 ]; then
|
| 62 |
echo " "
|
| 63 |
echo "**** Error while making ****"
|
| 64 |
cat teststderr
|
| 65 |
exit 1
|
| 66 |
fi
|
| 67 |
|
| 68 |
if [ $verbose -eq 1 ]; then
|
| 69 |
./pcretest -C
|
| 70 |
fi
|
| 71 |
|
| 72 |
conf=`./pcretest -C`
|
| 73 |
nl=`expr match "$conf" ".*Newline sequence is \([A-Z]*\)"`
|
| 74 |
|
| 75 |
if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
|
| 76 |
echo "===> Running C library tests"
|
| 77 |
./RunTest >teststdout
|
| 78 |
if [ $? -ne 0 ]; then
|
| 79 |
echo " "
|
| 80 |
echo "**** Test failed ****"
|
| 81 |
cat teststdout
|
| 82 |
exit 1
|
| 83 |
fi
|
| 84 |
else
|
| 85 |
echo "===> Skipping C library tests: newline is $nl"
|
| 86 |
fi
|
| 87 |
|
| 88 |
if [ "$nl" = "LF" ]; then
|
| 89 |
echo "===> Running pcregrep tests"
|
| 90 |
./RunGrepTest >teststdout 2>teststderr
|
| 91 |
if [ $? -ne 0 ]; then
|
| 92 |
echo " "
|
| 93 |
echo "**** Test failed ****"
|
| 94 |
cat teststderr
|
| 95 |
cat teststdout
|
| 96 |
exit 1
|
| 97 |
fi
|
| 98 |
else
|
| 99 |
echo "===> Skipping pcregrep tests: newline is $nl"
|
| 100 |
fi
|
| 101 |
|
| 102 |
if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then
|
| 103 |
if [ -f pcrecpp_unittest ] ; then
|
| 104 |
for utest in pcrecpp_unittest \
|
| 105 |
pcre_scanner_unittest \
|
| 106 |
pcre_stringpiece_unittest
|
| 107 |
do
|
| 108 |
echo "===> Running $utest"
|
| 109 |
$utest >teststdout
|
| 110 |
if [ $? -ne 0 ]; then
|
| 111 |
echo " "
|
| 112 |
echo "**** Test failed ****"
|
| 113 |
cat teststdout
|
| 114 |
exit 1
|
| 115 |
fi
|
| 116 |
done
|
| 117 |
fi
|
| 118 |
else
|
| 119 |
echo "===> Skipping C++ tests: newline is $nl"
|
| 120 |
fi
|
| 121 |
|
| 122 |
done
|
| 123 |
echo "===> All done"
|
| 124 |
|
| 125 |
# End
|