| 3 |
# This is a script for the use of PCRE maintainers. It configures and rebuilds |
# 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 |
# 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 |
# 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, |
# long, so we use a representative sample. This script should be run in the |
| 7 |
# we use --disable-shared or --disable-static after the first test (which |
# PCRE source directory. |
|
# builds both) to save a bit of time by building only one version for the |
|
|
# subsequent tests. |
|
| 8 |
|
|
| 9 |
# Some of the tests have to be skipped when PCRE is built with non-Unix newline |
# Some of the tests have to be skipped when PCRE is built with non-Unix newline |
| 10 |
# recognition. I am planning to reduce this as much as possible in due course. |
# recognition. I am planning to reduce this as much as possible in due course. |
| 11 |
|
|
| 12 |
|
|
| 13 |
# This is in case the caller has set aliases (as I do - PH) |
# This is in case the caller has set aliases (as I do - PH) |
| 14 |
|
|
| 15 |
unset cp ls mv rm |
unset cp ls mv rm |
| 19 |
verbose=0 |
verbose=0 |
| 20 |
if [ "$1" = "-v" ] ; then verbose=1; fi |
if [ "$1" = "-v" ] ; then verbose=1; fi |
| 21 |
|
|
| 22 |
# The first (empty) configuration builds with all the default settings. |
# This is a temporary directory for testing out-of-line builds |
| 23 |
|
|
| 24 |
for opts in \ |
tmp=/tmp/pcretesting |
| 25 |
"" \ |
|
| 26 |
"--enable-utf8 --disable-static" \ |
|
| 27 |
"--enable-unicode-properties --disable-shared" \ |
# This function runs a single test with the set of configuration options that |
| 28 |
"--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \ |
# are in $opts. The source directory must be set in srcdir. |
| 29 |
"--enable-unicode-properties --disable-cpp --with-link-size=3 --disable-shared" \ |
|
| 30 |
"--enable-rebuild-chartables --disable-shared" \ |
function runtest() |
| 31 |
"--enable-newline-is-any --disable-shared" \ |
{ |
|
"--enable-newline-is-cr --disable-shared" \ |
|
|
"--enable-newline-is-crlf --disable-shared" \ |
|
|
"--enable-utf8 --enable-newline-is-any --enable-unicode-properties --disable-stack-for-recursion --disable-static --disable-cpp" |
|
|
do |
|
| 32 |
rm -f *_unittest |
rm -f *_unittest |
| 33 |
|
|
| 34 |
if [ "$opts" = "" ] ; then |
if [ "$opts" = "" ] ; then |
| 35 |
echo "===> Configuring with: default settings" |
echo "Configuring with: default settings" |
| 36 |
else |
else |
| 37 |
olen=`expr length "$opts"` |
olen=`expr length "$opts"` |
| 38 |
if [ $olen -gt 56 ] ; then |
if [ $olen -gt 53 ] ; then |
| 39 |
echo "===> Configuring with:" |
echo "Configuring with:" |
| 40 |
echo " $opts" |
echo " $opts" |
| 41 |
else |
else |
| 42 |
echo "===> Configuring with: $opts" |
echo "Configuring with: $opts" |
| 43 |
fi |
fi |
| 44 |
fi |
fi |
| 45 |
|
|
| 46 |
./configure $opts >/dev/null 2>teststderr |
$srcdir/configure $opts >/dev/null 2>teststderr |
| 47 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
| 48 |
echo " " |
echo " " |
| 49 |
echo "**** Error while configuring ****" |
echo "**** Error while configuring ****" |
| 51 |
exit 1 |
exit 1 |
| 52 |
fi |
fi |
| 53 |
|
|
| 54 |
echo "===> Making" |
echo "Making" |
| 55 |
make >/dev/null 2>teststderr |
make >/dev/null 2>teststderr |
| 56 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
| 57 |
echo " " |
echo " " |
| 68 |
nl=`expr match "$conf" ".*Newline sequence is \([A-Z]*\)"` |
nl=`expr match "$conf" ".*Newline sequence is \([A-Z]*\)"` |
| 69 |
|
|
| 70 |
if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then |
if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then |
| 71 |
echo "===> Running C library tests" |
echo "Running C library tests" |
| 72 |
./RunTest >teststdout |
$srcdir/RunTest >teststdout |
| 73 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
| 74 |
echo " " |
echo " " |
| 75 |
echo "**** Test failed ****" |
echo "**** Test failed ****" |
| 77 |
exit 1 |
exit 1 |
| 78 |
fi |
fi |
| 79 |
else |
else |
| 80 |
echo "===> Skipping C library tests: newline is $nl" |
echo "Skipping C library tests: newline is $nl" |
| 81 |
fi |
fi |
| 82 |
|
|
| 83 |
if [ "$nl" = "LF" ]; then |
if [ "$nl" = "LF" ]; then |
| 84 |
echo "===> Running pcregrep tests" |
echo "Running pcregrep tests" |
| 85 |
./RunGrepTest >teststdout 2>teststderr |
$srcdir/RunGrepTest >teststdout 2>teststderr |
| 86 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
| 87 |
echo " " |
echo " " |
| 88 |
echo "**** Test failed ****" |
echo "**** Test failed ****" |
| 91 |
exit 1 |
exit 1 |
| 92 |
fi |
fi |
| 93 |
else |
else |
| 94 |
echo "===> Skipping pcregrep tests: newline is $nl" |
echo "Skipping pcregrep tests: newline is $nl" |
| 95 |
fi |
fi |
| 96 |
|
|
| 97 |
if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then |
if [ "$nl" = "LF" -o "$nl" = "ANY" ]; then |
| 100 |
pcre_scanner_unittest \ |
pcre_scanner_unittest \ |
| 101 |
pcre_stringpiece_unittest |
pcre_stringpiece_unittest |
| 102 |
do |
do |
| 103 |
echo "===> Running $utest" |
echo "Running $utest" |
| 104 |
$utest >teststdout |
$utest >teststdout |
| 105 |
if [ $? -ne 0 ]; then |
if [ $? -ne 0 ]; then |
| 106 |
echo " " |
echo " " |
| 109 |
exit 1 |
exit 1 |
| 110 |
fi |
fi |
| 111 |
done |
done |
| 112 |
|
else |
| 113 |
|
echo "Skipping C++ tests: pcrecpp_unittest does not exist" |
| 114 |
fi |
fi |
| 115 |
else |
else |
| 116 |
echo "===> Skipping C++ tests: newline is $nl" |
echo "Skipping C++ tests: newline is $nl" |
| 117 |
fi |
fi |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
|
| 121 |
|
# This set of tests builds PCRE and runs the tests with a variety of configure |
| 122 |
|
# options, in the current (source) directory. The first (empty) configuration |
| 123 |
|
# builds with all the default settings. As well as testing that these options |
| 124 |
|
# work, we use --disable-shared or --disable-static after the first test (which |
| 125 |
|
# builds both) to save a bit of time by building only one version of the |
| 126 |
|
# library for the subsequent tests. |
| 127 |
|
|
| 128 |
|
echo "Tests in the current directory" |
| 129 |
|
srcdir=. |
| 130 |
|
for opts in \ |
| 131 |
|
"" \ |
| 132 |
|
"--enable-utf8 --disable-static" \ |
| 133 |
|
"--enable-unicode-properties --disable-shared" \ |
| 134 |
|
"--enable-unicode-properties --disable-stack-for-recursion --disable-shared" \ |
| 135 |
|
"--enable-unicode-properties --disable-cpp --with-link-size=3 --disable-shared" \ |
| 136 |
|
"--enable-rebuild-chartables --disable-shared" \ |
| 137 |
|
"--enable-newline-is-any --disable-shared" \ |
| 138 |
|
"--enable-newline-is-cr --disable-shared" \ |
| 139 |
|
"--enable-newline-is-crlf --disable-shared" \ |
| 140 |
|
"--enable-utf8 --enable-newline-is-any --enable-unicode-properties --disable-stack-for-recursion --disable-static --disable-cpp" |
| 141 |
|
do |
| 142 |
|
runtest |
| 143 |
done |
done |
| 144 |
echo "===> All done" |
|
| 145 |
|
|
| 146 |
|
# Clean up the distribution and then do at least one build and test in a |
| 147 |
|
# directory other than the source directory. It doesn't work unless the |
| 148 |
|
# source directory is cleaned up first - and anyway, it's best to leave it |
| 149 |
|
# in a clean state after all this reconfiguring. |
| 150 |
|
|
| 151 |
|
if [ -f Makefile ]; then |
| 152 |
|
echo "Running 'make distclean'" |
| 153 |
|
make distclean >/dev/null 2>&1 |
| 154 |
|
if [ $? -ne 0 ]; then |
| 155 |
|
echo "** 'make distclean' failed" |
| 156 |
|
exit 1 |
| 157 |
|
fi |
| 158 |
|
fi |
| 159 |
|
|
| 160 |
|
echo "Tests in the $tmp directory" |
| 161 |
|
srcdir=`pwd` |
| 162 |
|
export srcdir |
| 163 |
|
|
| 164 |
|
if [ ! -e $tmp ]; then |
| 165 |
|
mkdir $tmp |
| 166 |
|
fi |
| 167 |
|
|
| 168 |
|
if [ ! -d $tmp ]; then |
| 169 |
|
echo "** Failed to create $tmp or it is not a directory" |
| 170 |
|
exit 1 |
| 171 |
|
fi |
| 172 |
|
|
| 173 |
|
cd $tmp |
| 174 |
|
if [ $? -ne 0 ]; then |
| 175 |
|
echo "** Failed to cd to $tmp" |
| 176 |
|
exit 1 |
| 177 |
|
fi |
| 178 |
|
|
| 179 |
|
for opts in \ |
| 180 |
|
"--enable-unicode-properties --disable-shared" |
| 181 |
|
do |
| 182 |
|
runtest |
| 183 |
|
done |
| 184 |
|
|
| 185 |
|
echo "Removing $tmp" |
| 186 |
|
|
| 187 |
|
rm -rf $tmp |
| 188 |
|
|
| 189 |
|
echo "All done" |
| 190 |
|
|
| 191 |
# End |
# End |