Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions RunTest
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 15 additions & 4 deletions src/pcre2test_inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Comment thread
NWilson marked this conversation as resolved.
{
/* Condition FALSE - skip this line and everything until #endif. */
yield = PR_ENDIF;
}

inside_if = TRUE;
break;
Expand Down
10 changes: 10 additions & 0 deletions testdata/testinput17
Original file line number Diff line number Diff line change
Expand Up @@ -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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a cunning (?) thing I added. We have many test files... but not for the case must-support-JTI AND must-support-Unicode.

Instead of making a new file for every combination of conditions, I'm starting to make the tests use conditional constructs.


/\b/B,utf,ucp,jit=1
\xff\x00\x00\=offset=2,ps

#endif

# End of testinput17
17 changes: 17 additions & 0 deletions testdata/testoutput17
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading