78 Commits

Author SHA1 Message Date
Isaac Oscar Gariano
0288afe12c Print pcre2test output in colour. (#811)
* Add a --colour flag to pcre2test to colourise the output.
* Comments from the inputfile are in grey (but not those entered in
  interactively)
* All other input is in green
* Messages related to PCRE2 api errors are in magenta
* Messages related to errors with using pcre2test itself are in red
* Timing and memory usage information is in blue
* Normal output is in your terminal's default foreground colour

---------

Co-authored-by: Nicholas Wilson <nicholas@nicholaswilson.me.uk>
2025-10-12 09:52:34 +01:00
Isaac Oscar Gariano
b88fc1139c Fixed a memory leak in pcre2_substitute.
This also makes RunTest check for memory leaks when using -valgrind.

(cherry picked from commit ab94f42009)
2025-09-29 09:54:50 +00:00
Nicholas Wilson
07e1dea8fa Chip away at more coverage gaps (#799) 2025-09-26 07:23:58 +01:00
Nicholas Wilson
dd0697f705 Small codecov fix related to the large pcre2test PR 2025-09-21 07:25:16 +01:00
Nicholas Wilson
379123db61 Improvements to CI code coverage (#796)
- Add maint/RunCoverage script to allow gathering Clang coverage locally more easily
- Add LCOV exclusion comments to unreachable code
- Add a filtering script so that the CI job respects LCOV_EXCL_* comments
2025-09-20 15:10:48 +01:00
Carlo Marcelo Arenas Belón
ec48bfc070 pcre2_config: address inconsistency with the linksize reported in non 8-bit libraries (#775)
pcre2_config: add PCRE2_CONFIG_EFFECTIVE_LINKSIZE

PCRE2_CONFIG_LINKSIZE can be used to determine the linksize that the
library was configured to use, but the actual size (and therefore
the maximum size of patterns that can be processed) is not visible.

Add PCRE2_CONFIG_EFFECTIVE_LINKSIZE to gather that value and use it
in `pcre2test` for reporting `linksize`; move the logic to derive
one from the other out of the API documentation and test scripts to
improve maintainability and while at it enable test8 in Windows for
all link sizes.
2025-08-29 11:37:36 +01:00
Nicholas Wilson
929b7404f9 Build fixes for z/OS (#695)
Fixes to enable the code to build with a simple `CC=xlc ./configure --enable-ebcdic --disable-unicode`.

Fixes to the tests, so that `make check` passes on EBCDIC platforms.

Add a CI job to do z/OS testing.
2025-02-26 22:31:51 +00:00
Nicholas Wilson
500c68b986 Add testing for malloc() failures (#697)
An additional testing argument, `-malloc` is added to pcre2test and to RunTest.

The ManyConfig tests run this now in CI.

We exercise each malloc failure in the core code by counting how many mallocs are done, then repeating compilation and matching with a failure on each successive malloc.
2025-02-23 09:51:32 +00:00
Nicholas Wilson
db3b532aa0 Improve RunTest to continue after a test failure (#696)
This makes it easier to se all the failures at once, rather than
having to fix one at a time. The output is now grouped into
directories.
2025-02-15 11:50:25 +00:00
Nicholas Wilson
0d0ac3aa0f Update EBCDIC support to support testing on normal ASCII systems (#656)
The pcre2test utility needs quite a few changes to accommodate this.
It is simpler to add a new mode to it, than to make it fully
EBCDIC-native. On an ASCII system, pcre2test performs ASCII I/O, but
tranlates the input when passing it to the fully-EBCDIC-supporting
library.
2025-02-12 22:31:00 +00:00
Nicholas Wilson
9a868b0605 Tidy up config.h management (task from README) (#658)
This fortuitously fixes the 16/32-bit 'unity' build.

Also tidy up the ckd_smul macros, for the sake of the Unity build.
2025-01-11 19:01:08 +00:00
Nicholas Wilson
47a09b6372 Add CI for MSYS2 (#660)
Also fix a few minor portability issues.

- The unix "MSYS" environment has an usual (but sane) French locale,
  requiring a test update
- pcre2grep needs a fix to use the WIN32 when both WIN32 and sys/stat.h
  are available

Fixes #127
2025-01-10 07:24:55 +00:00
Nicholas Wilson
23b4df750b Completely redo the substitute-case-callout work (#638)
Fixes #564

The previous API was not extensible to handle multi-character case rules. It required a fair bit of reworking in order to accommodate this. I had to delay the casing transformations to be done later, by buffering up the string to transform, and then allowing the callback to do an in-place transformation on the entire input to be transformed.
2024-12-26 23:46:21 +00:00
Nicholas Wilson
30320bb18d Add test and fix for buffer over-read in pcre2grep (#594)
Found by Clang-Analyze in #576

This test fails without the code fix, which required correcting the way
the pcre2grep tests are run with valgrind.

The new test passes with the code changes made.
2024-12-06 17:18:33 +00:00
Nicholas Wilson
a67878318c Fix PCRE2_DEBUG for multi-configuration builds (#542)
* Add support for Ninja Multi-Config generator on all platforms
* Ensure one build job is using CMake 3.15
* Provide a build type (Debug or RelWithDebInfo) on all CMake builds
* Ensure PCRE2_DEBUG=ON is set for: dev.yml builds which use the
  Release configuration
2024-11-11 13:16:16 +01:00
Carlo Marcelo Arenas Belón
ef11bee735 pcre2_jit_compile: avoid potential wraparound if framesize <= 0 (#531)
Change the minimum framesize value to match what the code can
support, while at it, refactor some of the conditionals used
so that extracting the framesize is more reliable (as the
assert is polymorphic) and update other seemingly unrelated bits
2024-10-21 15:05:07 +01:00
Carlo Marcelo Arenas Belón
a3011c4378 complete update to Unicode 16 (#513)
UCD 16 makes a lot of changes to scripts, so make sure that we have
sufficient coverage by keeping the original autogenerated tests in
addition.

Complete the code updates for changes to ScriptExtensions.txt which
is no longer sorted by script and allow for multiple unicode property
test files, depending on Unicode version.
2024-10-05 12:39:48 +01:00
Philip Hazel
1e78b77382 Code for variable-length lookbehinds 2023-08-06 15:42:55 +01:00
Edward Betts
db53e4007d Correct spelling mistakes (#143) 2022-08-19 08:56:03 +01:00
Philip Hazel
cc5e121c8e Added some special heap tests 2022-07-28 17:58:19 +01:00
Zoltan Herczeg
e7457003cd Auto generate unicode property tests. (#67)
Co-authored-by: Zoltan Herczeg <hzmester@freemail.hu>
2021-12-31 16:47:37 +00:00
Carlo Marcelo Arenas Belón
acc520924c test: avoid failing RunTest if pcre2test -S is not supported (#37)
* test: avoid failing RunTest if pcre2test -S is not supported

If `pcre2test -S` is not supported then then avoid checking for it
in a test.

There is already a conditional check for it to be used when it is
needed and it is available, so adjust that as well.

* pcre2test: update list of platform support for -S

Minix 3 has a BSD userspace and now works fine, but Haiku still
doesn't support stack limits, so update accordingly.
2021-11-09 17:23:02 +00:00
Philip.Hazel
7eb23f423e Final file tidies for 10.36 2020-12-04 14:30:03 +00:00
Philip.Hazel
9e15c97b6d Fix bug in RunTest: not reporting failure in test 2, and fix bugs in RunTest
and RunTest.bat causing test 2 to fail when not building in source directory.
2020-11-22 15:16:05 +00:00
Philip.Hazel
ed63958dad Make RunTest check stack settablility using the -bigstack value. 2018-12-07 16:32:05 +00:00
Philip.Hazel
1c79bdf36f Fix global search/replace in pcre2test and pcre2_substitute() when the pattern
matches an empty string, but never at the starting offset.
2018-07-02 10:54:03 +00:00
Philip.Hazel
fabea723cf Typos in documentation and comments noted by Jason Hood. 2018-06-17 14:13:28 +00:00
Philip.Hazel
810d9b6da5 Code tidies for 10.30-RC1 release candidate. 2017-07-19 16:04:15 +00:00
Philip.Hazel
c4fac10bad Implement PCRE2_LITERAL and REG_NOSPEC. 2017-06-15 16:41:44 +00:00
Philip.Hazel
dfc9712bcd Add additional compile options and PCRE2_EXTRA_ALLOW_SURROGATE_ESCAPES. 2017-05-17 17:55:11 +00:00
Philip.Hazel
ab1e3c9309 Refactor to avoid sanitize warnings when accessing the variable size ovector in
the backtracking frame. Fixes oss-fuzz issue 1465. Also make -bigstack in 
RunTest allocate a 64Mb stack for use with clang sanitizing.
2017-05-10 18:21:03 +00:00
Philip.Hazel
6e943e5f47 Experimental pattern conversion code (no public documentation yet). 2017-05-06 16:19:39 +00:00
Philip.Hazel
14989bd454 Add explicit heap limiting options to pcre2_match(), with associated features
for listing, configuring, etc.
2017-04-11 11:47:25 +00:00
Philip.Hazel
ae37c6e886 Add "framesize" to pcre2test to display pcre2_match() frame size, using the new
PCRE2_INFO_FRAMESIZE option for pcre2_pattern_info().
2017-03-16 17:55:55 +00:00
Philip.Hazel
deee290c39 Remove special stack handling for test 2 - no longer needed. 2017-03-10 17:48:48 +00:00
Philip.Hazel
ca1ecd41a1 File tidies for 10.23-RC1 2017-01-16 17:40:47 +00:00
Philip.Hazel
4c69f50e69 Fix bad behaviour for subroutine call in lookbehind when the called subroutine
contained an option setting such as (?s) and PCRE2_ANCHORED was set.
2016-11-23 17:17:57 +00:00
Philip.Hazel
99264dfc23 Major refactoring of pcre2_compile.c; see ChangeLog and HACKING. 2016-10-02 16:01:01 +00:00
Philip.Hazel
921636f6fc Documentation detrail and make HTML for 10.22-RC1. 2016-06-29 16:52:05 +00:00
Philip.Hazel
b7850e4fca Upgrade RunTest to try test 2 with a large stack if it fails with a smaller one
when running the interpreter.
2016-06-22 19:23:33 +00:00
Philip.Hazel
0a29ecbe02 Return an error code when pcre2_get_error_message() does not recognize an error
code, and add a pcre2test facility for testing this.
2016-06-17 11:30:27 +00:00
Philip.Hazel
96926349bc Implemented pcre2_code_copy(). 2016-02-26 18:26:17 +00:00
Philip.Hazel
f345e7dd9a Update valgrind parameters. 2016-01-30 15:19:48 +00:00
Philip.Hazel
dffd559601 File tidies, version updates, etc. for 10.21-RC1 2015-12-17 18:44:06 +00:00
Philip.Hazel
860b6f228a Run test 8 (sizes and offsets and mode-specific things) for link size 3 and 4
as well as for link size 2, with different output files in each case.
2015-11-14 13:22:34 +00:00
Philip.Hazel
0809e3b81a Fix bug: test 22 not skipped when Unicode not configured. 2015-10-17 18:27:38 +00:00
Philip.Hazel
3263d44b97 Implement --never-backslash-C 2015-10-17 13:50:56 +00:00
Philip.Hazel
297024d65b Create a suppressions file for valgrind with JIT. 2015-09-11 16:56:47 +00:00
Philip.Hazel
bb68c64c40 Implement #newline_default and adjust testdata and scripts to use it. 2015-09-08 17:01:17 +00:00
Philip.Hazel
4378cd97ef Fix typo in new test. 2015-08-18 10:39:59 +00:00