Revision: 963
http://www.exim.org/viewvc/pcre2?view=rev&revision=963
Author: ph10
Date: 2018-07-14 17:16:51 +0100 (Sat, 14 Jul 2018)
Log Message:
-----------
Update Perl tester to allow for optimization to be turned off. Required moving
some tests out of the Perl-compatible files.
Modified Paths:
--------------
code/trunk/perltest.sh
code/trunk/testdata/testinput1
code/trunk/testdata/testinput2
code/trunk/testdata/testoutput1
code/trunk/testdata/testoutput2
Modified: code/trunk/perltest.sh
===================================================================
--- code/trunk/perltest.sh 2018-07-12 17:04:43 UTC (rev 962)
+++ code/trunk/perltest.sh 2018-07-14 16:16:51 UTC (rev 963)
@@ -45,7 +45,7 @@
# jitstack ignored
# mark show mark information
# no_auto_possess ignored
-# no_start_optimize ignored
+# no_start_optimize insert ({""}) at pattern start (disable Perl optimizing)
# subject_literal does not process subjects for escapes
# ucp sets Perl's /u modifier
# utf invoke UTF-8 functionality
@@ -147,6 +147,7 @@
$pattern =~ /^\s*((.).*\2)(.*)$/s;
$pat = $1;
$mod = $3;
+ $del = $2;
# The private "aftertext" modifier means "print $' afterwards".
@@ -180,11 +181,15 @@
$mod =~ s/ucp,?/u/;
- # Remove "no_auto_possess" and "no_start_optimize" (disable PCRE2 optimizations)
+ # Remove "no_auto_possess".
$mod =~ s/no_auto_possess,?//;
- $mod =~ s/no_start_optimize,?//;
+ # Use no_start_optimize (disable PCRE2 start-up optimization) to disable Perl
+ # optimization by inserting (??{""}) at the start of the pattern.
+
+ if ($mod =~ s/no_start_optimize,?//) { $pat =~ s/$del/$del(??{""})/; }
+
# Add back retained modifiers and check that the pattern is valid.
$mod =~ s/,//g;
Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1 2018-07-12 17:04:43 UTC (rev 962)
+++ code/trunk/testdata/testinput1 2018-07-14 16:16:51 UTC (rev 963)
@@ -5157,14 +5157,6 @@
/A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/x,mark
AAAC
-/a(*PRUNE:X)bc|qq/mark,no_start_optimize
-\= Expect no match
- axy
-
-/a(*THEN:X)bc|qq/mark,no_start_optimize
-\= Expect no match
- axy
-
/(?=a(*MARK:A)b)..x/mark
abxy
\= Expect no match
Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2 2018-07-12 17:04:43 UTC (rev 962)
+++ code/trunk/testdata/testinput2 2018-07-14 16:16:51 UTC (rev 963)
@@ -5440,4 +5440,14 @@
/(?<=(?=.){4,5}x)/B
+# Perl behaves differently with these when optimization is turned off
+
+/a(*PRUNE:X)bc|qq/mark,no_start_optimize
+\= Expect no match
+ axy
+
+/a(*THEN:X)bc|qq/mark,no_start_optimize
+\= Expect no match
+ axy
+
# End of testinput2
Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1 2018-07-12 17:04:43 UTC (rev 962)
+++ code/trunk/testdata/testoutput1 2018-07-14 16:16:51 UTC (rev 963)
@@ -8282,16 +8282,6 @@
AAAC
0: AAC
-/a(*PRUNE:X)bc|qq/mark,no_start_optimize
-\= Expect no match
- axy
-No match, mark = X
-
-/a(*THEN:X)bc|qq/mark,no_start_optimize
-\= Expect no match
- axy
-No match, mark = X
-
/(?=a(*MARK:A)b)..x/mark
abxy
0: abx
Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2 2018-07-12 17:04:43 UTC (rev 962)
+++ code/trunk/testdata/testoutput2 2018-07-14 16:16:51 UTC (rev 963)
@@ -16601,6 +16601,18 @@
End
------------------------------------------------------------------
+# Perl behaves differently with these when optimization is turned off
+
+/a(*PRUNE:X)bc|qq/mark,no_start_optimize
+\= Expect no match
+ axy
+No match, mark = X
+
+/a(*THEN:X)bc|qq/mark,no_start_optimize
+\= Expect no match
+ axy
+No match, mark = X
+
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data