Work on the tests for JIT.

This commit is contained in:
Philip.Hazel 2014-10-06 17:28:42 +00:00
parent 4bdfd990af
commit 2148a4093e
14 changed files with 771 additions and 819 deletions

143
RunTest
View File

@ -64,15 +64,13 @@ title10="Test 10: Specials for the 8-bit library with UTF-8 and UCP support"
title11="Test 11: Specials for the basic 16-bit and 32-bit libraries"
title12="Test 12: Specials for the 16-bit and 32-bit libraries UTF and UCP support"
title13="Test 13: DFA specials for the basic 16-bit and 32-bit libraries"
title14="Test 14: JIT-specific features (when JIT is not available)"
title15="Test 15: JIT-specific features (when JIT is available)"
title16="Test 16: Tests of the POSIX interface, excluding UTF/UCP"
title17="Test 17: Tests of the POSIX interface with UTF/UCP"
title14="Test 14: Non-JIT limits tests"
title15="Test 15: JIT-specific features when JIT is not available"
title16="Test 16: JIT-specific features when JIT is available"
title17="Test 17: Tests of the POSIX interface, excluding UTF/UCP"
title18="Test 18: Tests of the POSIX interface with UTF/UCP"
#title21="Test 21: Reloads for the basic 16/32-bit library"
#title22="Test 22: Reloads for the 16/32-bit library with UTF-16/32 support"
maxtest=17
maxtest=18
if [ $# -eq 1 -a "$1" = "list" ]; then
echo $title1
@ -92,11 +90,7 @@ if [ $# -eq 1 -a "$1" = "list" ]; then
echo $title15
echo $title16
echo $title17
# echo $title18
# echo $title19
# echo $title20
# echo $title21
# echo $title22
echo $title18
exit 0
fi
@ -181,11 +175,7 @@ do14=no
do15=no
do16=no
do17=no
#do18=no
#do19=no
#do20=no
#do21=no
#do22=no
do18=no
while [ $# -gt 0 ] ; do
case $1 in
@ -206,11 +196,7 @@ while [ $# -gt 0 ] ; do
15) do15=yes;;
16) do16=yes;;
17) do17=yes;;
# 18) do18=yes;;
# 19) do19=yes;;
# 20) do20=yes;;
# 21) do21=yes;;
# 22) do22=yes;;
18) do18=yes;;
-8) arg8=yes;;
-16) arg16=yes;;
-32) arg32=yes;;
@ -335,11 +321,8 @@ 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 -a $do16 = no -a \
$do17 = no \
$do17 = no -a $do18 = no \
]; then
# -a $do18 = no -a $do19 = no -a $do20 = no -a \
# $do21 = no -a $do22 = no
do1=yes
do2=yes
do3=yes
@ -357,11 +340,7 @@ if [ $do1 = no -a $do2 = no -a $do3 = no -a $do4 = no -a \
do15=yes
do16=yes
do17=yes
# do18=yes
# do19=yes
# do20=yes
# do21=yes
# do22=yes
do18=yes
fi
# Handle any explicit skips at this stage, so that an argument list may consist
@ -696,29 +675,25 @@ if [ $do13 = yes ] ; then
fi
fi
# Test JIT-specific features when JIT is not available
# Test non-JIT match and recursion limits
if [ $do14 = yes ] ; then
echo $title14
if [ $jit -ne 0 ] ; then
echo " Skipped because JIT is available"
else
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput14 testtry
if [ $? = 0 ] ; then
$cf $testdata/testoutput14 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
echo " OK"
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput14 testtry
if [ $? = 0 ] ; then
$cf $testdata/testoutput14 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
echo " OK"
fi
# Test JIT-specific features when JIT is available
# Test JIT-specific features when JIT is not available
if [ $do15 = yes ] ; then
echo $title15
if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
echo " Skipped because JIT is not available or not usable"
if [ $jit -ne 0 ] ; then
echo " Skipped because JIT is available"
else
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput15 testtry
if [ $? = 0 ] ; then
@ -730,12 +705,12 @@ if [ $do15 = yes ] ; then
fi
fi
# Tests for the POSIX interface without UTF/UCP (8-bit only)
# Test JIT-specific features when JIT is available
if [ $do16 = yes ] ; then
echo $title16
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
echo " Skipped when running 16/32-bit tests"
if [ $jit -eq 0 -o "$nojit" = "yes" ] ; then
echo " Skipped because JIT is not available or not usable"
else
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput16 testtry
if [ $? = 0 ] ; then
@ -747,14 +722,12 @@ if [ $do16 = yes ] ; then
fi
fi
# Tests for the POSIX interface with UTF/UCP (8-bit only)
# Tests for the POSIX interface without UTF/UCP (8-bit only)
if [ $do17 = yes ] ; then
echo $title17
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
echo " Skipped when running 16/32-bit tests"
elif [ $utf -eq 0 ] ; then
echo " Skipped because UTF-$bits support is not available"
else
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput17 testtry
if [ $? = 0 ] ; then
@ -766,54 +739,24 @@ if [ $do17 = yes ] ; then
fi
fi
## Tests for reloads with 16/32-bit library
#
#if [ $do21 = yes ] ; then
# echo $title21
# if [ "$bits" = "8" ] ; then
# echo " Skipped when running 8-bit tests"
# elif [ $link_size -ne 2 ] ; then
# echo " Skipped because link size is not 2"
# else
# cp -f $testdata/saved8 testsaved8
# cp -f $testdata/saved16LE-1 testsaved16LE-1
# cp -f $testdata/saved16BE-1 testsaved16BE-1
# cp -f $testdata/saved32LE-1 testsaved32LE-1
# cp -f $testdata/saved32BE-1 testsaved32BE-1
# $sim $valgrind ./pcre2test -q $bmode $testdata/testinput21 testtry
# if [ $? = 0 ] ; then
# $cf $testdata/testoutput21-$bits testtry
# if [ $? != 0 ] ; then exit 1; fi
# else exit 1
# fi
# echo " OK"
# fi
#fi
#
## Tests for reloads with 16/32-bit library (UTF-16 support)
#
#if [ $do22 = yes ] ; then
# echo $title22
# if [ "$bits" = "8" ] ; then
# echo " Skipped when running 8-bit tests"
# elif [ $utf -eq 0 ] ; then
# echo " Skipped because UTF-$bits support is not available"
# elif [ $link_size -ne 2 ] ; then
# echo " Skipped because link size is not 2"
# else
# cp -f $testdata/saved16LE-2 testsaved16LE-2
# cp -f $testdata/saved16BE-2 testsaved16BE-2
# cp -f $testdata/saved32LE-2 testsaved32LE-2
# cp -f $testdata/saved32BE-2 testsaved32BE-2
# $sim $valgrind ./pcre2test -q $bmode $testdata/testinput22 testtry
# if [ $? = 0 ] ; then
# $cf $testdata/testoutput22-$bits testtry
# if [ $? != 0 ] ; then exit 1; fi
# else exit 1
# fi
# echo " OK"
# fi
#fi
# Tests for the POSIX interface with UTF/UCP (8-bit only)
if [ $do18 = yes ] ; then
echo $title18
if [ "$bits" = "16" -o "$bits" = "32" ] ; then
echo " Skipped when running 16/32-bit tests"
elif [ $utf -eq 0 ] ; then
echo " Skipped because UTF-$bits support is not available"
else
$sim $valgrind ./pcre2test -q $bmode $testdata/testinput18 testtry
if [ $? = 0 ] ; then
$cf $testdata/testoutput18 testtry
if [ $? != 0 ] ; then exit 1; fi
else exit 1
fi
echo " OK"
fi
fi
# End of loop for 8/16/32-bit tests
done

View File

@ -6606,7 +6606,6 @@ else
mb->offset_end = ocount;
mb->offset_max = (2*ocount)/3;
mb->capture_last = 0;
/* Reset the working variable associated with each extraction. These should
never be used unless previously set, but they get saved and restored, and so we
@ -6673,6 +6672,7 @@ the loop runs just once. */
for(;;)
{
PCRE2_SPTR new_start_match;
mb->capture_last = 0;
/* ----------------- Start of match optimizations ---------------- */

85
testdata/testinput14 vendored
View File

@ -1,9 +1,84 @@
# This test is run only when JIT support is not available. It checks that an
# attempt to use it has the expected behaviour. It also tests things that
# are different without JIT.
# These are tests of the match-limiting features. The results are different for
# interpretive or JIT matching, so this test should not be run with JIT. The
# same tests are run using JIT in test 16.
/abc/I,jit,jitverify
/(a+)*zz/I
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\=find_limits
aaaaaaaaaaaaaz\=find_limits
/a*/I
!((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)!I
/* this is a C style comment */\=find_limits
/^(?>a)++/
aa\=find_limits
aaaaaaaaa\=find_limits
/(a)(?1)++/
aa\=find_limits
aaaaaaaaa\=find_limits
/a(?:.)*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
/a(?:.(*THEN))*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
/a(?:.(*THEN:ABC))*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
/^(?>a+)(?>b+)(?>c+)(?>d+)(?>e+)/
aabbccddee\=find_limits
/^(?>(a+))(?>(b+))(?>(c+))(?>(d+))(?>(e+))/
aabbccddee\=find_limits
/^(?>(a+))(?>b+)(?>(c+))(?>d+)(?>(e+))/
aabbccddee\=find_limits
/(*LIMIT_MATCH=12bc)abc/
/(*LIMIT_MATCH=4294967290)abc/
/(*LIMIT_RECURSION=4294967280)abc/I
/(a+)*zz/
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=match_limit=3000
/(a+)*zz/
aaaaaaaaaaaaaz\=recursion_limit=10
/(*LIMIT_MATCH=3000)(a+)*zz/I
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=match_limit=60000
/(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I
aaaaaaaaaaaaaz
/(*LIMIT_MATCH=60000)(a+)*zz/I
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=match_limit=3000
/(*LIMIT_RECURSION=10)(a+)*zz/I
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=recursion_limit=1000
/(*LIMIT_RECURSION=10)(*LIMIT_RECURSION=1000)(a+)*zz/I
aaaaaaaaaaaaaz
/(*LIMIT_RECURSION=1000)(a+)*zz/I
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=recursion_limit=10
# These three have infinitely nested recursions.
/((?2))((?1))/
abc
/((?(R2)a+|(?1)b))/
aaaabcde
/(?(R)a*(?1)|((?R))b)/
aaaabcde
# End of testinput14

88
testdata/testinput15 vendored
View File

@ -1,87 +1,9 @@
# This test is run only when JIT support is available. It checks for a
# successful and an unsuccessful JIT compile, and a couple of things that are
# different with JIT.
# This test is run only when JIT support is not available. It checks that an
# attempt to use it has the expected behaviour. It also tests things that
# are different without JIT.
/abc/I,jit
/(?(?C1)(?=a)a)/I,jit
/(?(?C1)(?=a)a)/I
/abc/I,jit,jitverify
/a*/I
/(?(R)a*(?1)|((?R))b)/jit
aaaabcde
# Test various compile modes
#pattern jit,jitverify
/abcd/
abcd
xyz
/abcd/
abcd
ab\=ps
ab\=ph
xyz
/abcd/
abcd
ab\=ps
ab\=ph
xyz
/abcd/jit=1
abcd
ab\=ps
ab\=ph
xyz
xyz\=ps
/abcd/jit=2
abcd
ab\=ps
ab\=ph
xyz
/abcd/jit=3
abcd
ab\=ps
ab\=ph
xyz
/abcd/jit=4
abcd
ab\=ps
ab\=ph
xyz
/abcd/jit=5
abcd
ab\=ps
ab\=ph
xyz
/abcd/jit=6
abcd
ab\=ps
ab\=ph
xyz
/abcd/jit=7
abcd
ab\=ps
ab\=ph
xyz
/abcd/I,jit=2
/(*NO_START_OPT)a(*:m)b/mark
a
/^12345678abcd/m
12345678abcd
# End of testinput15
# End of testinput14

130
testdata/testinput16 vendored
View File

@ -1,81 +1,87 @@
# This set of tests is run only with the 8-bit library. It tests the POSIX
# interface, which is supported only with the 8-bit library. This test should
# not be run with JIT (which is not available for the POSIX interface).
#forbid_utf
#pattern posix
# This test is run only when JIT support is available. It checks for a
# successful and an unsuccessful JIT compile, and a couple of things that are
# different with JIT.
/abc/
abc
*** Failers
/abc/I,jit
/^abc|def/
abcdef
abcdef\=notbol
/(?(?C1)(?=a)a)/I,jit
/.*((abc)$|(def))/
defabc
defabc\=noteol
/(?(?C1)(?=a)a)/I
/the quick brown fox/
the quick brown fox
*** Failers
The Quick Brown Fox
/a*/I
/the quick brown fox/i
the quick brown fox
The Quick Brown Fox
/(?(R)a*(?1)|((?R))b)/jit
aaaabcde
/abc.def/
*** Failers
abc\ndef
# Test various compile modes
/abc$/
abc
abc\n
#pattern jit,jitverify
/(abc)\2/
/abcd/
abcd
xyz
/(abc\1)/
abc
/abcd/
abcd
ab\=ps
ab\=ph
xyz
/a*(b+)(z)(z)/
aaaabbbbzzzz
aaaabbbbzzzz\=ovector=0
aaaabbbbzzzz\=ovector=1
aaaabbbbzzzz\=ovector=2
/abcd/
abcd
ab\=ps
ab\=ph
xyz
/ab.cd/
ab-cd
ab=cd
** Failers
ab\ncd
/abcd/jit=1
abcd
ab\=ps
ab\=ph
xyz
xyz\=ps
/ab.cd/s
ab-cd
ab=cd
ab\ncd
/abcd/jit=2
abcd
ab\=ps
ab\=ph
xyz
/a(b)c/no_auto_capture
abc
/abcd/jit=3
abcd
ab\=ps
ab\=ph
xyz
/a(?P<name>b)c/no_auto_capture
abc
/abcd/jit=4
abcd
ab\=ps
ab\=ph
xyz
/a?|b?/
abc
** Failers
ddd\=notempty
/abcd/jit=5
abcd
ab\=ps
ab\=ph
xyz
/\w+A/
CDAAAAB
/abcd/jit=6
abcd
ab\=ps
ab\=ph
xyz
/\w+A/ungreedy
CDAAAAB
/\Biss\B/I,aftertext
Mississippi
/abcd/jit=7
abcd
ab\=ps
ab\=ph
xyz
/abc/\
/abcd/I,jit=2
# End of testdata/testinput16
/(*NO_START_OPT)a(*:m)b/mark
a
/^12345678abcd/m
12345678abcd
# End of testinput15

86
testdata/testinput17 vendored
View File

@ -1,17 +1,81 @@
# This set of tests is run only with the 8-bit library. It tests the POSIX
# interface with UTF/UCP support, which is supported only with the 8-bit
# library. This test should not be run with JIT (which is not available for the
# POSIX interface).
# interface, which is supported only with the 8-bit library. This test should
# not be run with JIT (which is not available for the POSIX interface).
#forbid_utf
#pattern posix
/a\x{1234}b/utf
a\x{1234}b
/abc/
abc
*** Failers
/\w/
+++\x{c2}
/^abc|def/
abcdef
abcdef\=notbol
/\w/ucp
+++\x{c2}
# End of testdata/testinput17
/.*((abc)$|(def))/
defabc
defabc\=noteol
/the quick brown fox/
the quick brown fox
*** Failers
The Quick Brown Fox
/the quick brown fox/i
the quick brown fox
The Quick Brown Fox
/abc.def/
*** Failers
abc\ndef
/abc$/
abc
abc\n
/(abc)\2/
/(abc\1)/
abc
/a*(b+)(z)(z)/
aaaabbbbzzzz
aaaabbbbzzzz\=ovector=0
aaaabbbbzzzz\=ovector=1
aaaabbbbzzzz\=ovector=2
/ab.cd/
ab-cd
ab=cd
** Failers
ab\ncd
/ab.cd/s
ab-cd
ab=cd
ab\ncd
/a(b)c/no_auto_capture
abc
/a(?P<name>b)c/no_auto_capture
abc
/a?|b?/
abc
** Failers
ddd\=notempty
/\w+A/
CDAAAAB
/\w+A/ungreedy
CDAAAAB
/\Biss\B/I,aftertext
Mississippi
/abc/\
# End of testdata/testinput16

17
testdata/testinput18 vendored Normal file
View File

@ -0,0 +1,17 @@
# This set of tests is run only with the 8-bit library. It tests the POSIX
# interface with UTF/UCP support, which is supported only with the 8-bit
# library. This test should not be run with JIT (which is not available for the
# POSIX interface).
#pattern posix
/a\x{1234}b/utf
a\x{1234}b
/\w/
+++\x{c2}
/\w/ucp
+++\x{c2}
# End of testdata/testinput17

79
testdata/testinput2 vendored
View File

@ -1220,10 +1220,6 @@
/(a)(?P<named>bc)/IB,no_auto_capture
/(a+)*zz/I
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\=find_limits
aaaaaaaaaaaaaz\=find_limits
/(aaa(?C1)bbb|ab)/I
aaabbb
aaabbb\=callout_data=0
@ -1584,9 +1580,6 @@ a random value. /Ix
abc\rdef
abc\r\ndef
!((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)!I
/* this is a C style comment */\=find_limits
/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
/()()()()()()()()()()()()()()()()()()()()
@ -3274,14 +3267,6 @@ a random value. /Ix
/(abc)(?1)/I
/^(?>a)++/
aa\=find_limits
aaaaaaaaa\=find_limits
/(a)(?1)++/
aa\=find_limits
aaaaaaaaa\=find_limits
/(?:(foo)|(bar)|(baz))X/allcaptures
bazfooX
foobazbarX
@ -3317,15 +3302,6 @@ a random value. /Ix
/[:a[:abc]b:]/B
/((?2))((?1))/
abc
/((?(R2)a+|(?1)b))/
aaaabcde
/(?(R)a*(?1)|((?R))b)/
aaaabcde
/(a+|(?R)b)/
/^(a(*:A)(d|e(*:B))z|aeq)/auto_callout
@ -3357,15 +3333,6 @@ a random value. /Ix
/z(*ACCEPT)a/I,aftertext
baxzbx
/a(?:.)*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
/a(?:.(*THEN))*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
/a(?:.(*THEN:ABC))*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
/^(?>a+)(?>(z+))\w/B
aaaazzzzb
** Failers
@ -3384,15 +3351,6 @@ a random value. /Ix
/(a\1z)/B
/^(?>a+)(?>b+)(?>c+)(?>d+)(?>e+)/
aabbccddee\=find_limits
/^(?>(a+))(?>(b+))(?>(c+))(?>(d+))(?>(e+))/
aabbccddee\=find_limits
/^(?>(a+))(?>b+)(?>(c+))(?>d+)(?>(e+))/
aabbccddee\=find_limits
/^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
aAz
*** Failers
@ -3741,43 +3699,6 @@ a random value. /Ix
/(?=b(*THEN)a|)bn|bnn/
bnn
# ---------------------
/(*LIMIT_MATCH=12bc)abc/
/(*LIMIT_MATCH=4294967290)abc/
/(*LIMIT_RECURSION=4294967280)abc/I
/(a+)*zz/
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=match_limit=3000
/(a+)*zz/
aaaaaaaaaaaaaz\=recursion_limit=10
/(*LIMIT_MATCH=3000)(a+)*zz/I
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=match_limit=60000
/(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I
aaaaaaaaaaaaaz
/(*LIMIT_MATCH=60000)(a+)*zz/I
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=match_limit=3000
/(*LIMIT_RECURSION=10)(a+)*zz/I
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=recursion_limit=1000
/(*LIMIT_RECURSION=10)(*LIMIT_RECURSION=1000)(a+)*zz/I
aaaaaaaaaaaaaz
/(*LIMIT_RECURSION=1000)(a+)*zz/I
aaaaaaaaaaaaaz
aaaaaaaaaaaaaz\=recursion_limit=10
# This test causes a segfault with Perl 5.18.0
/^(?=(a)){0}b(?1)/

196
testdata/testoutput14 vendored
View File

@ -1,17 +1,195 @@
# This test is run only when JIT support is not available. It checks that an
# attempt to use it has the expected behaviour. It also tests things that
# are different without JIT.
# These are tests of the match-limiting features. The results are different for
# interpretive or JIT matching, so this test should not be run with JIT. The
# same tests are run using JIT in test 16.
/abc/I,jit,jitverify
/(a+)*zz/I
Capturing subpattern count = 1
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\=find_limits
Minimum match limit = 8
Minimum recursion limit = 6
0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazz
1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaz\=find_limits
Minimum match limit = 32768
Minimum recursion limit = 29
No match
!((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)!I
Capturing subpattern count = 1
May match empty string
Subject length lower bound = 0
/* this is a C style comment */\=find_limits
Minimum match limit = 120
Minimum recursion limit = 6
0: /* this is a C style comment */
1: /* this is a C style comment */
/^(?>a)++/
aa\=find_limits
Minimum match limit = 5
Minimum recursion limit = 2
0: aa
aaaaaaaaa\=find_limits
Minimum match limit = 12
Minimum recursion limit = 2
0: aaaaaaaaa
/(a)(?1)++/
aa\=find_limits
Minimum match limit = 7
Minimum recursion limit = 4
0: aa
1: a
aaaaaaaaa\=find_limits
Minimum match limit = 21
Minimum recursion limit = 4
0: aaaaaaaaa
1: a
/a(?:.)*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
Minimum match limit = 65
Minimum recursion limit = 2
0: abbbbbbbbbbbbbbbbbbbbba
/a(?:.(*THEN))*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
Minimum match limit = 86
Minimum recursion limit = 45
0: abbbbbbbbbbbbbbbbbbbbba
/a(?:.(*THEN:ABC))*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
Minimum match limit = 86
Minimum recursion limit = 45
0: abbbbbbbbbbbbbbbbbbbbba
/^(?>a+)(?>b+)(?>c+)(?>d+)(?>e+)/
aabbccddee\=find_limits
Minimum match limit = 7
Minimum recursion limit = 2
0: aabbccddee
/^(?>(a+))(?>(b+))(?>(c+))(?>(d+))(?>(e+))/
aabbccddee\=find_limits
Minimum match limit = 17
Minimum recursion limit = 16
0: aabbccddee
1: aa
2: bb
3: cc
4: dd
5: ee
/^(?>(a+))(?>b+)(?>(c+))(?>d+)(?>(e+))/
aabbccddee\=find_limits
Minimum match limit = 13
Minimum recursion limit = 10
0: aabbccddee
1: aa
2: cc
3: ee
/(*LIMIT_MATCH=12bc)abc/
Failed: error 160 at offset 0: (*VERB) not recognized or malformed
/(*LIMIT_MATCH=4294967290)abc/
Failed: error 160 at offset 0: (*VERB) not recognized or malformed
/(*LIMIT_RECURSION=4294967280)abc/I
Capturing subpattern count = 0
Recursion limit = 4294967280
First code unit = 'a'
Last code unit = 'c'
Subject length lower bound = 3
JIT support is not available in this version of PCRE2
/a*/I
Capturing subpattern count = 0
May match empty string
Subject length lower bound = 0
/(a+)*zz/
aaaaaaaaaaaaaz
No match
aaaaaaaaaaaaaz\=match_limit=3000
Failed: error -45: match limit exceeded
/(a+)*zz/
aaaaaaaaaaaaaz\=recursion_limit=10
Failed: error -50: recursion limit exceeded
/(*LIMIT_MATCH=3000)(a+)*zz/I
Capturing subpattern count = 1
Match limit = 3000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
Failed: error -45: match limit exceeded
aaaaaaaaaaaaaz\=match_limit=60000
Failed: error -45: match limit exceeded
/(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I
Capturing subpattern count = 1
Match limit = 3000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
Failed: error -45: match limit exceeded
/(*LIMIT_MATCH=60000)(a+)*zz/I
Capturing subpattern count = 1
Match limit = 60000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
No match
aaaaaaaaaaaaaz\=match_limit=3000
Failed: error -45: match limit exceeded
/(*LIMIT_RECURSION=10)(a+)*zz/I
Capturing subpattern count = 1
Recursion limit = 10
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
Failed: error -50: recursion limit exceeded
aaaaaaaaaaaaaz\=recursion_limit=1000
Failed: error -50: recursion limit exceeded
/(*LIMIT_RECURSION=10)(*LIMIT_RECURSION=1000)(a+)*zz/I
Capturing subpattern count = 1
Recursion limit = 1000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
No match
/(*LIMIT_RECURSION=1000)(a+)*zz/I
Capturing subpattern count = 1
Recursion limit = 1000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
No match
aaaaaaaaaaaaaz\=recursion_limit=10
Failed: error -50: recursion limit exceeded
# These three have infinitely nested recursions.
/((?2))((?1))/
abc
Failed: error -49: nested recursion at the same subject position
/((?(R2)a+|(?1)b))/
aaaabcde
Failed: error -49: nested recursion at the same subject position
/(?(R)a*(?1)|((?R))b)/
aaaabcde
Failed: error -49: nested recursion at the same subject position
# End of testinput14

163
testdata/testoutput15 vendored
View File

@ -1,164 +1,17 @@
# This test is run only when JIT support is available. It checks for a
# successful and an unsuccessful JIT compile, and a couple of things that are
# different with JIT.
# This test is run only when JIT support is not available. It checks that an
# attempt to use it has the expected behaviour. It also tests things that
# are different without JIT.
/abc/I,jit
/abc/I,jit,jitverify
Capturing subpattern count = 0
No options
First code unit = 'a'
Need char = 'c'
Last code unit = 'c'
Subject length lower bound = 3
No starting char list
JIT study was successful
/(?(?C1)(?=a)a)/I,jit
Capturing subpattern count = 0
May match empty string
No options
No first code unit
No last code unit
Study returned NULL
JIT study was not successful
/(?(?C1)(?=a)a)/I
Capturing subpattern count = 0
May match empty string
No options
No first code unit
No last code unit
Subject length lower bound = -1
No starting char list
JIT study was not successful
JIT support is not available in this version of PCRE2
/a*/I
Capturing subpattern count = 0
May match empty string
No options
No first code unit
No last code unit
Study returned NULL
Subject length lower bound = 0
/(?(R)a*(?1)|((?R))b)/S+
aaaabcde
Error -27 (JIT stack limit reached)
# Test various compile modes
#pattern jit,jitverify
/abcd/
abcd
0: abcd (JIT)
xyz
No match (JIT)
/abcd/
abcd
0: abcd (JIT)
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab (JIT)
xyz
No match (JIT)
/abcd/
abcd
0: abcd (JIT)
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab (JIT)
xyz
No match (JIT)
/abcd/jit=1
abcd
0: abcd (JIT)
ab\P
Partial match: ab
ab\P\P
Partial match: ab
xyz
No match (JIT)
xyz\P
No match
/abcd/jit=2
abcd
0: abcd
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab
xyz
No match
/abcd/jit=3
abcd
0: abcd (JIT)
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab
xyz
No match (JIT)
/abcd/jit=4
abcd
0: abcd
ab\P
Partial match: ab
ab\P\P
Partial match: ab (JIT)
xyz
No match
/abcd/jit=5
abcd
0: abcd (JIT)
ab\P
Partial match: ab
ab\P\P
Partial match: ab (JIT)
xyz
No match (JIT)
/abcd/jit=6
abcd
0: abcd
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab (JIT)
xyz
No match
/abcd/jit=7
abcd
0: abcd (JIT)
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab (JIT)
xyz
No match (JIT)
/abcd/I,jit=2
Capturing subpattern count = 0
No options
First code unit = 'a'
Last code unit = 'd'
Subject length lower bound = 4
No starting char list
JIT study was successful
/(*NO_START_OPT)a(*:m)b/mark
a
No match, mark = m (JIT)
/^12345678abcd/m
12345678abcd
0: 12345678abcd (JIT)
# End of testinput15
# End of testinput14

254
testdata/testoutput16 vendored
View File

@ -1,128 +1,164 @@
# This set of tests is run only with the 8-bit library. It tests the POSIX
# interface, which is supported only with the 8-bit library. This test should
# not be run with JIT (which is not available for the POSIX interface).
#forbid_utf
#pattern posix
# This test is run only when JIT support is available. It checks for a
# successful and an unsuccessful JIT compile, and a couple of things that are
# different with JIT.
/abc/
abc
0: abc
*** Failers
No match: POSIX code 17: match failed
/abc/I,jit
Capturing subpattern count = 0
No options
First code unit = 'a'
Need char = 'c'
Subject length lower bound = 3
No starting char list
JIT study was successful
/^abc|def/
abcdef
0: abc
abcdef\=notbol
0: def
/(?(?C1)(?=a)a)/I,jit
Capturing subpattern count = 0
May match empty string
No options
No first code unit
No last code unit
Study returned NULL
JIT study was not successful
/.*((abc)$|(def))/
defabc
0: defabc
1: abc
2: abc
defabc\=noteol
0: def
1: def
3: def
/(?(?C1)(?=a)a)/I
Capturing subpattern count = 0
May match empty string
No options
No first code unit
No last code unit
Subject length lower bound = -1
No starting char list
JIT study was not successful
/the quick brown fox/
the quick brown fox
0: the quick brown fox
*** Failers
No match: POSIX code 17: match failed
The Quick Brown Fox
No match: POSIX code 17: match failed
/a*/I
Capturing subpattern count = 0
May match empty string
No options
No first code unit
No last code unit
Study returned NULL
/the quick brown fox/i
the quick brown fox
0: the quick brown fox
The Quick Brown Fox
0: The Quick Brown Fox
/(?(R)a*(?1)|((?R))b)/S+
aaaabcde
Error -27 (JIT stack limit reached)
/abc.def/
*** Failers
No match: POSIX code 17: match failed
abc\ndef
No match: POSIX code 17: match failed
# Test various compile modes
/abc$/
abc
0: abc
abc\n
0: abc
#pattern jit,jitverify
/(abc)\2/
Failed: POSIX code 15: bad back reference at offset 7
/abcd/
abcd
0: abcd (JIT)
xyz
No match (JIT)
/(abc\1)/
abc
No match: POSIX code 17: match failed
/abcd/
abcd
0: abcd (JIT)
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab (JIT)
xyz
No match (JIT)
/a*(b+)(z)(z)/
aaaabbbbzzzz
0: aaaabbbbzz
1: bbbb
2: z
3: z
aaaabbbbzzzz\=ovector=0
Matched without capture
aaaabbbbzzzz\=ovector=1
0: aaaabbbbzz
aaaabbbbzzzz\=ovector=2
0: aaaabbbbzz
1: bbbb
/abcd/
abcd
0: abcd (JIT)
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab (JIT)
xyz
No match (JIT)
/ab.cd/
ab-cd
0: ab-cd
ab=cd
0: ab=cd
** Failers
No match: POSIX code 17: match failed
ab\ncd
No match: POSIX code 17: match failed
/abcd/jit=1
abcd
0: abcd (JIT)
ab\P
Partial match: ab
ab\P\P
Partial match: ab
xyz
No match (JIT)
xyz\P
No match
/ab.cd/s
ab-cd
0: ab-cd
ab=cd
0: ab=cd
ab\ncd
0: ab\x0acd
/abcd/jit=2
abcd
0: abcd
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab
xyz
No match
/a(b)c/no_auto_capture
abc
Matched with REG_NOSUB
/abcd/jit=3
abcd
0: abcd (JIT)
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab
xyz
No match (JIT)
/a(?P<name>b)c/no_auto_capture
abc
Matched with REG_NOSUB
/abcd/jit=4
abcd
0: abcd
ab\P
Partial match: ab
ab\P\P
Partial match: ab (JIT)
xyz
No match
/a?|b?/
abc
0: a
** Failers
0:
ddd\=notempty
No match: POSIX code 17: match failed
/abcd/jit=5
abcd
0: abcd (JIT)
ab\P
Partial match: ab
ab\P\P
Partial match: ab (JIT)
xyz
No match (JIT)
/\w+A/
CDAAAAB
0: CDAAAA
/abcd/jit=6
abcd
0: abcd
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab (JIT)
xyz
No match
/\w+A/ungreedy
CDAAAAB
0: CDA
/\Biss\B/I,aftertext
** Ignored with POSIX interface: info
Mississippi
0: iss
0+ issippi
/abcd/jit=7
abcd
0: abcd (JIT)
ab\P
Partial match: ab (JIT)
ab\P\P
Partial match: ab (JIT)
xyz
No match (JIT)
/abc/\
Failed: POSIX code 9: bad escape sequence at offset 4
/abcd/I,jit=2
Capturing subpattern count = 0
No options
First code unit = 'a'
Last code unit = 'd'
Subject length lower bound = 4
No starting char list
JIT study was successful
# End of testdata/testinput16
/(*NO_START_OPT)a(*:m)b/mark
a
No match, mark = m (JIT)
/^12345678abcd/m
12345678abcd
0: 12345678abcd (JIT)
# End of testinput15

136
testdata/testoutput17 vendored
View File

@ -1,20 +1,128 @@
# This set of tests is run only with the 8-bit library. It tests the POSIX
# interface with UTF/UCP support, which is supported only with the 8-bit
# library. This test should not be run with JIT (which is not available for the
# POSIX interface).
# interface, which is supported only with the 8-bit library. This test should
# not be run with JIT (which is not available for the POSIX interface).
#forbid_utf
#pattern posix
/a\x{1234}b/utf
a\x{1234}b
0: a\x{1234}b
/\w/
+++\x{c2}
/abc/
abc
0: abc
*** Failers
No match: POSIX code 17: match failed
/\w/ucp
+++\x{c2}
0: \xc2
# End of testdata/testinput17
/^abc|def/
abcdef
0: abc
abcdef\=notbol
0: def
/.*((abc)$|(def))/
defabc
0: defabc
1: abc
2: abc
defabc\=noteol
0: def
1: def
3: def
/the quick brown fox/
the quick brown fox
0: the quick brown fox
*** Failers
No match: POSIX code 17: match failed
The Quick Brown Fox
No match: POSIX code 17: match failed
/the quick brown fox/i
the quick brown fox
0: the quick brown fox
The Quick Brown Fox
0: The Quick Brown Fox
/abc.def/
*** Failers
No match: POSIX code 17: match failed
abc\ndef
No match: POSIX code 17: match failed
/abc$/
abc
0: abc
abc\n
0: abc
/(abc)\2/
Failed: POSIX code 15: bad back reference at offset 7
/(abc\1)/
abc
No match: POSIX code 17: match failed
/a*(b+)(z)(z)/
aaaabbbbzzzz
0: aaaabbbbzz
1: bbbb
2: z
3: z
aaaabbbbzzzz\=ovector=0
Matched without capture
aaaabbbbzzzz\=ovector=1
0: aaaabbbbzz
aaaabbbbzzzz\=ovector=2
0: aaaabbbbzz
1: bbbb
/ab.cd/
ab-cd
0: ab-cd
ab=cd
0: ab=cd
** Failers
No match: POSIX code 17: match failed
ab\ncd
No match: POSIX code 17: match failed
/ab.cd/s
ab-cd
0: ab-cd
ab=cd
0: ab=cd
ab\ncd
0: ab\x0acd
/a(b)c/no_auto_capture
abc
Matched with REG_NOSUB
/a(?P<name>b)c/no_auto_capture
abc
Matched with REG_NOSUB
/a?|b?/
abc
0: a
** Failers
0:
ddd\=notempty
No match: POSIX code 17: match failed
/\w+A/
CDAAAAB
0: CDAAAA
/\w+A/ungreedy
CDAAAAB
0: CDA
/\Biss\B/I,aftertext
** Ignored with POSIX interface: info
Mississippi
0: iss
0+ issippi
/abc/\
Failed: POSIX code 9: bad escape sequence at offset 4
# End of testdata/testinput16

20
testdata/testoutput18 vendored Normal file
View File

@ -0,0 +1,20 @@
# This set of tests is run only with the 8-bit library. It tests the POSIX
# interface with UTF/UCP support, which is supported only with the 8-bit
# library. This test should not be run with JIT (which is not available for the
# POSIX interface).
#pattern posix
/a\x{1234}b/utf
a\x{1234}b
0: a\x{1234}b
/\w/
+++\x{c2}
No match: POSIX code 17: match failed
/\w/ucp
+++\x{c2}
0: \xc2
# End of testdata/testinput17

191
testdata/testoutput2 vendored
View File

@ -4303,21 +4303,6 @@ First code unit = 'a'
Last code unit = 'c'
Subject length lower bound = 3
/(a+)*zz/I
Capturing subpattern count = 1
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazzbbbbbb\=find_limits
Minimum match limit = 8
Minimum recursion limit = 6
0: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaazz
1: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaz\=find_limits
Minimum match limit = 32768
Minimum recursion limit = 29
No match
/(aaa(?C1)bbb|ab)/I
Capturing subpattern count = 1
First code unit = 'a'
@ -6143,16 +6128,6 @@ Subject length lower bound = 5
1: \x0d
2: \x0a
!((?:\s|//.*\\n|/[*](?:\\n|.)*?[*]/)*)!I
Capturing subpattern count = 1
May match empty string
Subject length lower bound = 0
/* this is a C style comment */\=find_limits
Minimum match limit = 120
Minimum recursion limit = 6
0: /* this is a C style comment */
1: /* this is a C style comment */
/(?P<B>25[0-5]|2[0-4]\d|[01]?\d?\d)(?:\.(?P>B)){3}/I
Capturing subpattern count = 1
Named capturing subpatterns:
@ -10876,28 +10851,6 @@ First code unit = 'a'
Last code unit = 'c'
Subject length lower bound = 6
/^(?>a)++/
aa\=find_limits
Minimum match limit = 5
Minimum recursion limit = 2
0: aa
aaaaaaaaa\=find_limits
Minimum match limit = 12
Minimum recursion limit = 2
0: aaaaaaaaa
/(a)(?1)++/
aa\=find_limits
Minimum match limit = 7
Minimum recursion limit = 4
0: aa
1: a
aaaaaaaaa\=find_limits
Minimum match limit = 21
Minimum recursion limit = 4
0: aaaaaaaaa
1: a
/(?:(foo)|(bar)|(baz))X/allcaptures
bazfooX
0: fooX
@ -10931,7 +10884,6 @@ Matched, but too many substrings
Matched, but too many substrings
0: fooX
bazfooX\=ovector=2
Matched, but too many substrings
0: fooX
1: foo
bazfooX\=ovector=3
@ -11097,18 +11049,6 @@ Matched, but too many substrings
End
------------------------------------------------------------------
/((?2))((?1))/
abc
Failed: error -49: nested recursion at the same subject position
/((?(R2)a+|(?1)b))/
aaaabcde
Failed: error -49: nested recursion at the same subject position
/(?(R)a*(?1)|((?R))b)/
aaaabcde
Failed: error -49: nested recursion at the same subject position
/(a+|(?R)b)/
Failed: error 140 at offset 7: recursion could loop indefinitely
@ -11227,24 +11167,6 @@ Subject length lower bound = 0
0: z
0+ bx
/a(?:.)*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
Minimum match limit = 65
Minimum recursion limit = 2
0: abbbbbbbbbbbbbbbbbbbbba
/a(?:.(*THEN))*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
Minimum match limit = 86
Minimum recursion limit = 45
0: abbbbbbbbbbbbbbbbbbbbba
/a(?:.(*THEN:ABC))*?a/ims
abbbbbbbbbbbbbbbbbbbbba\=find_limits
Minimum match limit = 86
Minimum recursion limit = 45
0: abbbbbbbbbbbbbbbbbbbbba
/^(?>a+)(?>(z+))\w/B
------------------------------------------------------------------
Bra
@ -11311,32 +11233,6 @@ No match
End
------------------------------------------------------------------
/^(?>a+)(?>b+)(?>c+)(?>d+)(?>e+)/
aabbccddee\=find_limits
Minimum match limit = 7
Minimum recursion limit = 2
0: aabbccddee
/^(?>(a+))(?>(b+))(?>(c+))(?>(d+))(?>(e+))/
aabbccddee\=find_limits
Minimum match limit = 17
Minimum recursion limit = 16
0: aabbccddee
1: aa
2: bb
3: cc
4: dd
5: ee
/^(?>(a+))(?>b+)(?>(c+))(?>d+)(?>(e+))/
aabbccddee\=find_limits
Minimum match limit = 13
Minimum recursion limit = 10
0: aabbccddee
1: aa
2: cc
3: ee
/^a\x41z/alt_bsux,allow_empty_class,match_unset_backref,dupnames
aAz
0: aAz
@ -12080,93 +11976,6 @@ No match
bnn
0: bn
# ---------------------
/(*LIMIT_MATCH=12bc)abc/
Failed: error 160 at offset 0: (*VERB) not recognized or malformed
/(*LIMIT_MATCH=4294967290)abc/
Failed: error 160 at offset 0: (*VERB) not recognized or malformed
/(*LIMIT_RECURSION=4294967280)abc/I
Capturing subpattern count = 0
Recursion limit = 4294967280
First code unit = 'a'
Last code unit = 'c'
Subject length lower bound = 3
/(a+)*zz/
aaaaaaaaaaaaaz
No match
aaaaaaaaaaaaaz\=match_limit=3000
Failed: error -45: match limit exceeded
/(a+)*zz/
aaaaaaaaaaaaaz\=recursion_limit=10
Failed: error -50: recursion limit exceeded
/(*LIMIT_MATCH=3000)(a+)*zz/I
Capturing subpattern count = 1
Match limit = 3000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
Failed: error -45: match limit exceeded
aaaaaaaaaaaaaz\=match_limit=60000
Failed: error -45: match limit exceeded
/(*LIMIT_MATCH=60000)(*LIMIT_MATCH=3000)(a+)*zz/I
Capturing subpattern count = 1
Match limit = 3000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
Failed: error -45: match limit exceeded
/(*LIMIT_MATCH=60000)(a+)*zz/I
Capturing subpattern count = 1
Match limit = 60000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
No match
aaaaaaaaaaaaaz\=match_limit=3000
Failed: error -45: match limit exceeded
/(*LIMIT_RECURSION=10)(a+)*zz/I
Capturing subpattern count = 1
Recursion limit = 10
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
Failed: error -50: recursion limit exceeded
aaaaaaaaaaaaaz\=recursion_limit=1000
Failed: error -50: recursion limit exceeded
/(*LIMIT_RECURSION=10)(*LIMIT_RECURSION=1000)(a+)*zz/I
Capturing subpattern count = 1
Recursion limit = 1000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
No match
/(*LIMIT_RECURSION=1000)(a+)*zz/I
Capturing subpattern count = 1
Recursion limit = 1000
Starting code units: a z
Last code unit = 'z'
Subject length lower bound = 2
aaaaaaaaaaaaaz
No match
aaaaaaaaaaaaaz\=recursion_limit=10
Failed: error -50: recursion limit exceeded
# This test causes a segfault with Perl 5.18.0
/^(?=(a)){0}b(?1)/