diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-09-09 10:34:57 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-09-09 10:34:57 +0000 |
commit | 2b89a6e5545b5e03927262b30350854493aec272 (patch) | |
tree | 3a2658f8608ee3acca08a32a987490e03fa4f5c1 /RunTest | |
parent | 41d771a6026f926ffa918476af5c451ee9cc0c35 (diff) | |
download | pcre-2b89a6e5545b5e03927262b30350854493aec272.tar.gz |
Patch to RunTest for use with simulations; further JIT code/test tidies.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@689 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'RunTest')
-rwxr-xr-x | RunTest | 119 |
1 files changed, 60 insertions, 59 deletions
@@ -18,47 +18,14 @@ # two tests for JIT-specific features, one to be run when JIT support is # available, and one when it is not. -valgrind= - -# Set up a suitable "diff" command for comparison. Some systems -# have a diff that lacks a -u option. Try to deal with this. - -if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi - -# Find the test data - -testdata=testdata -if [ -n "$srcdir" -a -d "$srcdir" ] ; then - testdata="$srcdir/testdata" -fi - -# Find which optional facilities are available - -case `./pcretest -C | ./pcregrep 'Internal link size'` in - *2) link_size=2;; - *3) link_size=3;; - *4) link_size=4;; - *) echo "Failed to find internal link size"; exit 1;; -esac - -./pcretest -C | ./pcregrep 'No UTF-8 support' >/dev/null -utf8=$? - -./pcretest -C | ./pcregrep 'No Unicode properties support' >/dev/null -ucp=$? - -jitopt= -./pcretest -C | ./pcregrep \ - 'No Just-in-time compiler support|this architecture is unsupported' \ - >/dev/null -jit=$? -if [ $jit -ne 0 ] ; then - jitopt=-s+ -else - ./pcretest -C | ./pcregrep 'this architecture is unsupported' >/dev/null - jitnotcompiled=$? -fi +# The arguments for this script can be individual test numbers, or the word +# "valgrind", or "sim" followed by an argument to run cross-compiled +# executables under a simulator, for example: +# +# RunTest 3 sim "qemu-arm -s 8388608" +valgrind= +sim= # Select which tests to run; for those that are explicitly requested, check # that the necessary optional facilities are available. @@ -97,11 +64,47 @@ while [ $# -gt 0 ] ; do 14) do14=yes;; 15) do15=yes;; valgrind) valgrind="valgrind -q --smc-check=all";; + sim) shift; sim=$1;; *) echo "Unknown test number $1"; exit 1;; esac shift done +# Set up a suitable "diff" command for comparison. Some systems +# have a diff that lacks a -u option. Try to deal with this. + +if diff -u /dev/null /dev/null; then cf="diff -u"; else cf="diff"; fi + +# Find the test data + +testdata=testdata +if [ -n "$srcdir" -a -d "$srcdir" ] ; then + testdata="$srcdir/testdata" +fi + +# Find which optional facilities are available + +case `$sim ./pcretest -C | $sim ./pcregrep 'Internal link size'` in + *2) link_size=2;; + *3) link_size=3;; + *4) link_size=4;; + *) echo "Failed to find internal link size"; exit 1;; +esac + +$sim ./pcretest -C | $sim ./pcregrep 'No UTF-8 support' >/dev/null +utf8=$? + +$sim ./pcretest -C | $sim ./pcregrep 'No Unicode properties support' >/dev/null +ucp=$? + +jitopt= +$sim ./pcretest -C | $sim ./pcregrep 'No just-in-time compiler support' \ + >/dev/null +jit=$? +if [ $jit -ne 0 ] ; then + jitopt=-s+ +fi + if [ $utf8 -eq 0 ] ; then if [ $do4 = yes ] ; then echo "Can't run test 4 because UTF-8 support is not configured" @@ -194,7 +197,7 @@ echo PCRE C library tests if [ $do1 = yes ] ; then echo "Test 1: main functionality (Compatible with Perl >= 5.8)" for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $testdata/testinput1 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput1 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput1 testtry if [ $? != 0 ] ; then exit 1; fi @@ -212,7 +215,7 @@ fi if [ $do2 = yes ] ; then echo "Test 2: API, errors, internals, and non-Perl stuff" for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $testdata/testinput2 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput2 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput2 testtry if [ $? != 0 ] ; then exit 1; fi @@ -258,7 +261,7 @@ if [ $do3 = yes ] ; then if [ "$locale" != "" ] ; then echo "Test 3: locale-specific features (using '$locale' locale)" for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $infile testtry + $sim $valgrind ./pcretest -q $opt $infile testtry if [ $? = 0 ] ; then $cf $outfile testtry if [ $? != 0 ] ; then @@ -292,7 +295,7 @@ if [ $do4 = yes ] ; then echo " Skipped because UTF-8 support is not available" else for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $testdata/testinput4 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput4 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput4 testtry if [ $? != 0 ] ; then exit 1; fi @@ -312,7 +315,7 @@ if [ $do5 = yes ] ; then echo " Skipped because UTF-8 support is not available" else for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $testdata/testinput5 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput5 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput5 testtry if [ $? != 0 ] ; then exit 1; fi @@ -332,7 +335,7 @@ if [ $do6 = yes ] ; then echo " Skipped because Unicode property support is not available" else for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $testdata/testinput6 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput6 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput6 testtry if [ $? != 0 ] ; then exit 1; fi @@ -351,7 +354,7 @@ fi if [ $do7 = yes ] ; then echo "Test 7: DFA matching" for opt in "" "-s"; do - $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry + $sim $valgrind ./pcretest -q $opt -dfa $testdata/testinput7 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput7 testtry if [ $? != 0 ] ; then exit 1; fi @@ -367,7 +370,7 @@ if [ $do8 = yes ] ; then echo " Skipped because UTF-8 support is not available" else for opt in "" "-s"; do - $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry + $sim $valgrind ./pcretest -q $opt -dfa $testdata/testinput8 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput8 testtry if [ $? != 0 ] ; then exit 1; fi @@ -384,7 +387,7 @@ if [ $do9 = yes ] ; then echo " Skipped because Unicode property support is not available" else for opt in "" "-s"; do - $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry + $sim $valgrind ./pcretest -q $opt -dfa $testdata/testinput9 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput9 testtry if [ $? != 0 ] ; then exit 1; fi @@ -409,7 +412,7 @@ if [ $do10 = yes ] ; then echo " Skipped because Unicode property support is not available" else for opt in "" "-s"; do - $valgrind ./pcretest -q $opt $testdata/testinput10 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput10 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput10 testtry if [ $? != 0 ] ; then exit 1; fi @@ -425,7 +428,7 @@ fi if [ $do11 = yes ] ; then echo "Test 11: Features from Perl >= 5.10 without UTF8 support" for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $testdata/testinput11 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput11 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput11 testtry if [ $? != 0 ] ; then exit 1; fi @@ -446,7 +449,7 @@ if [ $do12 = yes ] ; then echo " Skipped because UTF-8 support is not available" else for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $testdata/testinput12 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput12 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput12 testtry if [ $? != 0 ] ; then exit 1; fi @@ -468,7 +471,7 @@ if [ $do13 = yes ] ; then echo " Skipped because Unicode property support is not available" else for opt in "" "-s" $jitopt; do - $valgrind ./pcretest -q $opt $testdata/testinput13 testtry + $sim $valgrind ./pcretest -q $opt $testdata/testinput13 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput13 testtry if [ $? != 0 ] ; then exit 1; fi @@ -485,11 +488,11 @@ fi # Test JIT-specific features when JIT is available if [ $do14 = yes ] ; then - echo "Test 14: JIT-specific features (JIT available and usable)" + echo "Test 14: JIT-specific features (JIT available)" if [ $jit -eq 0 ] ; then echo " Skipped because JIT is not available or not usable" else - $valgrind ./pcretest -q $testdata/testinput14 testtry + $sim $valgrind ./pcretest -q $testdata/testinput14 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput14 testtry if [ $? != 0 ] ; then exit 1; fi @@ -502,13 +505,11 @@ fi # Test JIT-specific features when JIT is not available if [ $do15 = yes ] ; then - echo "Test 15: JIT-specific features (JIT not available or not usable)" + echo "Test 15: JIT-specific features (JIT not available)" if [ $jit -ne 0 ] ; then echo " Skipped because JIT is available" - elif [ $jitnotcompiled -eq 0 ] ; then - echo " Skipped because JIT does not support this architecture" else - $valgrind ./pcretest -q $testdata/testinput15 testtry + $sim $valgrind ./pcretest -q $testdata/testinput15 testtry if [ $? = 0 ] ; then $cf $testdata/testoutput15 testtry if [ $? != 0 ] ; then exit 1; fi |