diff --git a/RunTest b/RunTest index 57a03455a..306427b66 100755 --- a/RunTest +++ b/RunTest @@ -175,9 +175,12 @@ checkresult() *) with="";; esac cf_out="$testdata/testoutput$2" - if [ $ebcdic -eq 1 ] ; then - # We currently only use the #if ... #endif support in pcre2test for EBCDIC - # testing. Run in "preprocess-only" mode (-E) on the testoutput file to trim + if [ $ebcdic -eq 1 ] || [ $utf -eq 0 ]; then + # We currently only use the #if ... #endif support in pcre2test for tests + # which are excluded in certain builds: + # - EBCDIC + # - No-UTF + # Run in "preprocess-only" mode (-E) on the testoutput file to trim # the output lines matching the input lines which are discarded. $sim $pcre2test -q -E "$cf_out" >testoutput$bits$3/testoutput$2-expected cf_out=testoutput$bits$3/testoutput$2-expected diff --git a/src/pcre2test_inc.h b/src/pcre2test_inc.h index a74e33684..72767916e 100644 --- a/src/pcre2test_inc.h +++ b/src/pcre2test_inc.h @@ -1712,7 +1712,7 @@ process_command(void) FILE *f; PCRE2_SIZE serial_size; size_t i; -int rc, cmd, yield; +int rc, cmd, yield, config_value; uint16_t first_listed_newline; const char *cmdname; size_t cmdlen; @@ -1980,7 +1980,7 @@ switch(cmd) { size_t optlen = strlen(coptlist[i].name); const uint8_t *argptr_trail; - if (coptlist[i].type != CONF_FIX) + if (coptlist[i].type != CONF_FIX && coptlist[i].type != CONF_INT) continue; if (strncmp((const char*)argptr, coptlist[i].name, optlen) != 0) continue; @@ -1995,9 +1995,20 @@ switch(cmd) return PR_ABEND; } - /* Condition FALSE - skip this line and everything until #endif. */ - if ((coptlist[i].value != 0) == if_inverted) + if (coptlist[i].type == CONF_FIX) + { + config_value = coptlist[i].value; + } + else /* if (coptlist[i].type == CONF_INT) */ + { + (void)pcre2_config(coptlist[i].value, &config_value); + } + + if ((config_value != 0) == if_inverted) + { + /* Condition FALSE - skip this line and everything until #endif. */ yield = PR_ENDIF; + } inside_if = TRUE; break; diff --git a/testdata/testinput17 b/testdata/testinput17 index 9d7289657..e6dbbe424 100644 --- a/testdata/testinput17 +++ b/testdata/testinput17 @@ -336,4 +336,14 @@ zabcz\=callout_error=1 zabcz\=callout_error=1,substitute_matched +# Check UTF validation when falling back from a partially-compiled JIT pattern +# to the interpreter + +#if unicode + +/\b/B,utf,ucp,jit=1 + \xff\x00\x00\=offset=2,ps + +#endif + # End of testinput17 diff --git a/testdata/testoutput17 b/testdata/testoutput17 index 773ec18a8..11f032d8a 100644 --- a/testdata/testoutput17 +++ b/testdata/testoutput17 @@ -603,4 +603,21 @@ Failed: error -37: callout error code 1 ^ a Failed: error -37: callout error code +# Check UTF validation when falling back from a partially-compiled JIT pattern +# to the interpreter + +#if unicode + +/\b/B,utf,ucp,jit=1 +------------------------------------------------------------------ + Bra + \b (ucp) + Ket + End +------------------------------------------------------------------ + \xff\x00\x00\=offset=2,ps +Partial match: + +#endif + # End of testinput17