summaryrefslogtreecommitdiff
path: root/RunTest
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-08-23 11:17:49 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-08-23 11:17:49 +0000
commit1d802a43983c10a4874fc5f014dec121722ad5f8 (patch)
tree391638d458cdb1cf430539578727f4906c5eceea /RunTest
parenta5f6af34b843babdc621c9e7a6398fe82dabf08f (diff)
downloadpcre-1d802a43983c10a4874fc5f014dec121722ad5f8.tar.gz
Refactor RunTest and add JIT-specific tests.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@671 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'RunTest')
-rwxr-xr-xRunTest329
1 files changed, 212 insertions, 117 deletions
diff --git a/RunTest b/RunTest
index 175be07..e3164b0 100755
--- a/RunTest
+++ b/RunTest
@@ -1,14 +1,22 @@
#! /bin/sh
-# Run the PCRE tests using the pcretest program. All tests are now run both
-# with and without -s, to ensure that everything is tested with and without
-# studying. However, there are some tests that produce different output after
-# studying, typically when we are tracing the actual matching process (for
-# example, using auto-callouts). In these few cases, the tests are duplicated
-# in the files, one with /S to force studying always, and one with /SS to force
-# *not* studying always. The use of -s doesn't then make any difference to
-# their output. There is also one test which compiles invalid UTF-8 with the
-# UTF-8 check turned off for which studying is disabled with /SS.
+# Run the PCRE tests using the pcretest program. The appropriate tests are
+# selected, depending on which build-time options were used.
+
+# All tests are now run both with and without -s, to ensure that everything is
+# tested with and without studying. However, there are some tests that produce
+# different output after studying, typically when we are tracing the actual
+# matching process (for example, using auto-callouts). In these few cases, the
+# tests are duplicated in the files, one with /S to force studying always, and
+# one with /SS to force *not* studying always. The use of -s doesn't then make
+# any difference to their output. There is also one test which compiles invalid
+# UTF-8 with the UTF-8 check turned off; for this, studying must also be
+# disabled with /SS.
+
+# When JIT support is available, all the tests are also run with -s+ to test
+# (again, almost) everything with studying and the JIT option. There are also
+# two tests for JIT-specific features, one to be run when JIT support is
+# available, and one when it is not.
valgrind=
@@ -62,6 +70,8 @@ do10=no
do11=no
do12=no
do13=no
+do14=no
+do15=no
while [ $# -gt 0 ] ; do
case $1 in
@@ -78,6 +88,8 @@ while [ $# -gt 0 ] ; do
11) do11=yes;;
12) do12=yes;;
13) do13=yes;;
+ 14) do14=yes;;
+ 15) do15=yes;;
valgrind) valgrind="valgrind -q --smc-check=all";;
*) echo "Unknown test number $1"; exit 1;;
esac
@@ -129,25 +141,40 @@ if [ $link_size -ne 2 ] ; then
fi
fi
-# If no specific tests were requested, select all that are relevant.
+if [ $jit -eq 0 ] ; then
+ if [ $do14 = "yes" ] ; then
+ echo "Can't run test 14 because JIT support is not configured"
+ exit 1
+ fi
+else
+ if [ $do15 = "yes" ] ; then
+ echo "Can't run test 15 because JIT support is configured"
+ exit 1
+ fi
+fi
-if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
- $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
- $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
- $do13 = no ] ; then
+# If no specific tests were requested, select all. Those that are not
+# relevant will be skipped.
+
+if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
+ $do5 = no -a $do6 = no -a $do7 = no -a $do8 = no -a \
+ $do9 = no -a $do10 = no -a $do11 = no -a $do12 = no -a \
+ $do13 = no -a $do14 = no -a $do15 = no ] ; then
do1=yes
do2=yes
do3=yes
- if [ $utf8 -ne 0 ] ; then do4=yes; fi
- if [ $utf8 -ne 0 ] ; then do5=yes; fi
- if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do6=yes; fi
+ do4=yes
+ do5=yes
+ do6=yes
do7=yes
- if [ $utf8 -ne 0 ] ; then do8=yes; fi
- if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do9=yes; fi
- if [ $link_size -eq 2 -a $ucp -ne 0 ] ; then do10=yes; fi
+ do8=yes
+ do9=yes
+ do10=yes
do11=yes
- if [ $utf8 -ne 0 ] ; then do12=yes; fi
- if [ $utf8 -ne 0 -a $ucp -ne 0 ] ; then do13=yes; fi
+ do12=yes
+ do13=yes
+ do14=yes
+ do15=yes
fi
# Show which release
@@ -167,9 +194,9 @@ if [ $do1 = yes ] ; then
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
fi
done
fi
@@ -192,9 +219,9 @@ if [ $do2 = yes ] ; then
echo " "
exit 1
fi
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
fi
done
fi
@@ -235,9 +262,9 @@ if [ $do3 = yes ] ; then
echo "settings rather than a bug in PCRE."
break;
else
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
fi
fi
else exit 1
@@ -255,50 +282,62 @@ fi
if [ $do4 = yes ] ; then
echo "Test 4: UTF-8 support (Compatible with Perl >= 5.8)"
- for opt in "" "-s" $jitopt; do
- $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
- if [ $? = 0 ] ; then
- $cf $testdata/testoutput4 testtry
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
- fi
- done
+ if [ $utf8 -eq 0 ] ; then
+ echo " Skipped because UTF-8 support is not available"
+ else
+ for opt in "" "-s" $jitopt; do
+ $valgrind ./pcretest -q $opt $testdata/testinput4 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput4 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
+ fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
+ fi
+ done
+ fi
fi
if [ $do5 = yes ] ; then
echo "Test 5: API, internals, and non-Perl stuff for UTF-8 support"
- for opt in "" "-s" $jitopt; do
- $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
- if [ $? = 0 ] ; then
- $cf $testdata/testoutput5 testtry
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
- fi
- done
+ if [ $utf8 -eq 0 ] ; then
+ echo " Skipped because UTF-8 support is not available"
+ else
+ for opt in "" "-s" $jitopt; do
+ $valgrind ./pcretest -q $opt $testdata/testinput5 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput5 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
+ fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
+ fi
+ done
+ fi
fi
if [ $do6 = yes ] ; then
echo "Test 6: Unicode property support (Compatible with Perl >= 5.10)"
- for opt in "" "-s" $jitopt; do
- $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
- if [ $? = 0 ] ; then
- $cf $testdata/testoutput6 testtry
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
- fi
- done
+ if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
+ echo " Skipped because Unicode property support is not available"
+ else
+ for opt in "" "-s" $jitopt; do
+ $valgrind ./pcretest -q $opt $testdata/testinput6 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput6 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
+ fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
+ fi
+ done
+ fi
fi
# Tests for DFA matching support
@@ -312,34 +351,42 @@ if [ $do7 = yes ] ; then
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
- if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
done
fi
if [ $do8 = yes ] ; then
echo "Test 8: DFA matching with UTF-8"
- for opt in "" "-s"; do
- $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
- if [ $? = 0 ] ; then
- $cf $testdata/testoutput8 testtry
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
- done
+ if [ $utf8 -eq 0 ] ; then
+ echo " Skipped because UTF-8 support is not available"
+ else
+ for opt in "" "-s"; do
+ $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput8 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
+ fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
+ done
+ fi
fi
if [ $do9 = yes ] ; then
echo "Test 9: DFA matching with Unicode properties"
- for opt in "" "-s"; do
- $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
- if [ $? = 0 ] ; then
- $cf $testdata/testoutput9 testtry
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
- done
+ if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
+ echo " Skipped because Unicode property support is not available"
+ else
+ for opt in "" "-s"; do
+ $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput9 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
+ fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
+ done
+ fi
fi
# Test of internal offsets and code sizes. This test is run only when there
@@ -350,15 +397,21 @@ fi
if [ $do10 = yes ] ; then
echo "Test 10: Internal offsets and code size tests"
- for opt in "" "-s"; do
- $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
- if [ $? = 0 ] ; then
- $cf $testdata/testoutput10 testtry
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- if [ "$opt" = "-s" ] ; then echo "OK with study" ; else echo "OK"; fi
- done
+ if [ $link_size -ne 2 ] ; then
+ echo " Skipped because link size is not 2"
+ elif [ $ucp -eq 0 ] ; then
+ echo " Skipped because Unicode property support is not available"
+ else
+ for opt in "" "-s"; do
+ $valgrind ./pcretest -q $opt $testdata/testinput10 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput10 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
+ fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study" ; else echo " OK"; fi
+ done
+ fi
fi
# Test of Perl >= 5.10 features without UTF8 support
@@ -372,9 +425,9 @@ if [ $do11 = yes ] ; then
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
fi
done
fi
@@ -383,36 +436,78 @@ fi
if [ $do12 = yes ] ; then
echo "Test 12: Features from Perl >= 5.10 with UTF8 support"
- for opt in "" "-s" $jitopt; do
- $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
- if [ $? = 0 ] ; then
- $cf $testdata/testoutput12 testtry
- if [ $? != 0 ] ; then exit 1; fi
- else exit 1
- fi
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
- fi
- done
+ if [ $utf8 -eq 0 ] ; then
+ echo " Skipped because UTF-8 support is not available"
+ else
+ for opt in "" "-s" $jitopt; do
+ $valgrind ./pcretest -q $opt $testdata/testinput12 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput12 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
+ fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
+ fi
+ done
+ fi
fi
# Test non-Perl-compatible Unicode property support
if [ $do13 = yes ] ; then
echo "Test 13: API, internals, and non-Perl stuff for Unicode property support"
- for opt in "" "-s" $jitopt; do
- $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
+ if [ $utf8 -eq 0 -o $ucp -eq 0 ] ; then
+ echo " Skipped because Unicode property support is not available"
+ else
+ for opt in "" "-s" $jitopt; do
+ $valgrind ./pcretest -q $opt $testdata/testinput13 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput13 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
+ fi
+ if [ "$opt" = "-s" ] ; then echo " OK with study"
+ elif [ "$opt" = "-s+" ] ; then echo " OK with JIT study"
+ else echo " OK"
+ fi
+ done
+ fi
+fi
+
+# Test JIT-specific features when JIT is available
+
+if [ $do14 = yes ] ; then
+ echo "Test 14: JIT-specific features (JIT available)"
+ if [ $jit -eq 0 ] ; then
+ echo " Skipped because JIT is not available"
+ else
+ $valgrind ./pcretest -q $testdata/testinput14 testtry
if [ $? = 0 ] ; then
- $cf $testdata/testoutput13 testtry
+ $cf $testdata/testoutput14 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
- if [ "$opt" = "-s" ] ; then echo "OK with study"
- elif [ "$opt" = "-s+" ] ; then echo "OK with JIT study"
- else echo "OK"
+ echo " OK"
+ fi
+fi
+
+# Test JIT-specific features when JIT is not available
+
+if [ $do15 = yes ] ; then
+ echo "Test 15: JIT-specific features (JIT not available)"
+ if [ $jit -ne 0 ] ; then
+ echo " Skipped because JIT is available"
+ else
+ $valgrind ./pcretest -q $testdata/testinput15 testtry
+ if [ $? = 0 ] ; then
+ $cf $testdata/testoutput15 testtry
+ if [ $? != 0 ] ; then exit 1; fi
+ else exit 1
fi
- done
+ echo " OK"
+ fi
fi
# End