Add RunTest.bat for testing under Windows, with appropriate test files.
This commit is contained in:
parent
438e51958a
commit
20c75b2f42
|
@ -90,6 +90,10 @@ of PCRE2 sources, which caused a failure to build pcre2test.
|
|||
18. Fixed typo in pcre2_serialize.c (DECL instead of DEFN) that causes problems
|
||||
only on Windows.
|
||||
|
||||
19. Use binary input when reading back saved serialized patterns in pcre2test.
|
||||
|
||||
20. Added RunTest.bat for running the tests under Windows.
|
||||
|
||||
|
||||
Version 10.00 05-January-2015
|
||||
-----------------------------
|
||||
|
|
|
@ -541,8 +541,7 @@ endif # WITH_GCOV
|
|||
TESTS += RunTest
|
||||
dist_noinst_SCRIPTS += RunTest
|
||||
|
||||
# FIXME when somebody updates RunTest.bat
|
||||
#EXTRA_DIST += RunTest.bat
|
||||
EXTRA_DIST += RunTest.bat
|
||||
|
||||
## When the 8-bit library is configured, pcre2grep will have been built.
|
||||
|
||||
|
@ -612,6 +611,8 @@ EXTRA_DIST += \
|
|||
testdata/testoutput18 \
|
||||
testdata/testoutput19 \
|
||||
testdata/testoutputEBC \
|
||||
testdata/wintestinput3 \
|
||||
testdata/wintestoutput3 \
|
||||
perltest.sh
|
||||
|
||||
# RunTest and RunGrepTest should clean up after themselves, but just in case
|
||||
|
|
|
@ -20,10 +20,6 @@ This document contains the following sections:
|
|||
|
||||
GENERAL
|
||||
|
||||
I (Philip Hazel) have no experience of Windows or VMS sytems and how their
|
||||
libraries work. The items in the PCRE2 distribution and Makefile that relate to
|
||||
anything other than Linux systems are untested by me.
|
||||
|
||||
The basic PCRE2 library consists entirely of code written in Standard C, and so
|
||||
should compile successfully on any system that has a Standard C compiler and
|
||||
library.
|
||||
|
@ -186,9 +182,12 @@ The default processor stack size of 1Mb in some Windows environments is too
|
|||
small for matching patterns that need much recursion. In particular, test 2 may
|
||||
fail because of this. Normally, running out of stack causes a crash, but there
|
||||
have been cases where the test program has just died silently. See your linker
|
||||
documentation for how to increase stack size if you experience problems. The
|
||||
Linux default of 8Mb is a reasonable choice for the stack, though even that can
|
||||
be too small for some pattern/subject combinations.
|
||||
documentation for how to increase stack size if you experience problems. If you
|
||||
are using CMake (see "BUILDING PCRE2 ON WINDOWS WITH CMAKE" below) and the gcc
|
||||
compiler, you can increase the stack size for pcre2test and pcre2grep by
|
||||
setting the CMAKE_EXE_LINKER_FLAGS variable to "-Wl,--stack,8388608" (for
|
||||
example). The Linux default of 8Mb is a reasonable choice for the stack, though
|
||||
even that can be too small for some pattern/subject combinations.
|
||||
|
||||
PCRE2 has a compile configuration option to disable the use of stack for
|
||||
recursion so that heap is used instead. However, pattern matching is
|
||||
|
@ -330,22 +329,19 @@ cache can be deleted by selecting "File > Delete Cache".
|
|||
|
||||
12. If during configuration with cmake-gui you've elected to build the test
|
||||
programs, you can execute them by building the test project. E.g., for
|
||||
MinGW: "make check"; for Visual Studio build the RUN_TESTS project. The
|
||||
MinGW: "make test"; for Visual Studio build the RUN_TESTS project. The
|
||||
most recent build configuration is targeted by the tests. A summary of
|
||||
test results is presented. Complete test output is subsequently
|
||||
available for review in Testing\Temporary under your build dir.
|
||||
|
||||
|
||||
TESTING WITH RUNTEST.BAT IS NOT YET TESTED/UPDATED
|
||||
TESTING WITH RUNTEST.BAT
|
||||
|
||||
If configured with CMake, building the test project ("make check" or building
|
||||
If configured with CMake, building the test project ("make test" or building
|
||||
ALL_TESTS in Visual Studio) creates (and runs) pcre2_test.bat (and depending
|
||||
on your configuration options, possibly other test programs) in the build
|
||||
directory. Pcre_test.bat runs RunTest.Bat with correct source and exe paths.
|
||||
|
||||
INCOMPLETE: Nobody has yet provided a RunTest.Bat for PCRE2 and I have no means
|
||||
of doing so. These instructions are those for PCRE1, left here in the hope that
|
||||
one day they will be usable.
|
||||
directory. The pcre2_test.bat script runs RunTest.bat with correct source and
|
||||
exe paths.
|
||||
|
||||
For manual testing with RunTest.bat, provided the build dir is a subdirectory
|
||||
of the source directory: Open command shell window. Chdir to the location
|
||||
|
@ -392,4 +388,4 @@ The site currently has ports for PCRE1 releases, but PCRE2 should follow in due
|
|||
course.
|
||||
|
||||
=============================
|
||||
Last Updated: 19 January 2015
|
||||
Last Updated: 25 February 2015
|
||||
|
|
|
@ -0,0 +1,463 @@
|
|||
@echo off
|
||||
@rem
|
||||
@rem MS Windows batch file to run pcre2test on testfiles with the correct
|
||||
@rem options. This file must use CRLF linebreaks to function properly,
|
||||
@rem and requires both pcre2test and pcre2grep.
|
||||
@rem
|
||||
@rem ------------------------ HISTORY ----------------------------------
|
||||
@rem This file was originally contributed to PCRE1 by Ralf Junker, and touched
|
||||
@rem up by Daniel Richard G. Tests 10-12 added by Philip H.
|
||||
@rem Philip H also changed test 3 to use "wintest" files.
|
||||
@rem
|
||||
@rem Updated by Tom Fortmann to support explicit test numbers on the command
|
||||
@rem line. Added argument validation and added error reporting.
|
||||
@rem
|
||||
@rem Sheri Pierce added logic to skip feature dependent tests
|
||||
@rem tests 4 5 9 15 and 18 require utf support
|
||||
@rem tests 6 7 10 16 and 19 require ucp support
|
||||
@rem 11 requires ucp and link size 2
|
||||
@rem 12 requires presence of jit support
|
||||
@rem 13 requires absence of jit support
|
||||
@rem Sheri P also added override tests for study and jit testing
|
||||
@rem Zoltan Herczeg added libpcre16 support
|
||||
@rem Zoltan Herczeg added libpcre32 support
|
||||
@rem -------------------------------------------------------------------
|
||||
@rem
|
||||
@rem The file was converted for PCRE2 by PH, February 2015.
|
||||
|
||||
|
||||
setlocal enabledelayedexpansion
|
||||
if [%srcdir%]==[] (
|
||||
if exist testdata\ set srcdir=.)
|
||||
if [%srcdir%]==[] (
|
||||
if exist ..\testdata\ set srcdir=..)
|
||||
if [%srcdir%]==[] (
|
||||
if exist ..\..\testdata\ set srcdir=..\..)
|
||||
if NOT exist %srcdir%\testdata\ (
|
||||
Error: echo distribution testdata folder not found!
|
||||
call :conferror
|
||||
exit /b 1
|
||||
goto :eof
|
||||
)
|
||||
|
||||
if [%pcre2test%]==[] set pcre2test=.\pcre2test.exe
|
||||
|
||||
echo source dir is %srcdir%
|
||||
echo pcre2test=%pcre2test%
|
||||
|
||||
if NOT exist %pcre2test% (
|
||||
echo Error: %pcre2test% not found!
|
||||
echo.
|
||||
call :conferror
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%pcre2test% -C linksize >NUL
|
||||
set link_size=%ERRORLEVEL%
|
||||
%pcre2test% -C pcre2-8 >NUL
|
||||
set support8=%ERRORLEVEL%
|
||||
%pcre2test% -C pcre2-16 >NUL
|
||||
set support16=%ERRORLEVEL%
|
||||
%pcre2test% -C pcre2-32 >NUL
|
||||
set support32=%ERRORLEVEL%
|
||||
%pcre2test% -C unicode >NUL
|
||||
set unicode=%ERRORLEVEL%
|
||||
%pcre2test% -C jit >NUL
|
||||
set jit=%ERRORLEVEL%
|
||||
|
||||
if %support8% EQU 1 (
|
||||
if not exist testout8 md testout8
|
||||
if not exist testoutjit8 md testoutjit8
|
||||
)
|
||||
|
||||
if %support16% EQU 1 (
|
||||
if not exist testout16 md testout16
|
||||
if not exist testoutjit16 md testoutjit16
|
||||
)
|
||||
|
||||
if %support16% EQU 1 (
|
||||
if not exist testout32 md testout32
|
||||
if not exist testoutjit32 md testoutjit32
|
||||
)
|
||||
|
||||
set do1=no
|
||||
set do2=no
|
||||
set do3=no
|
||||
set do4=no
|
||||
set do5=no
|
||||
set do6=no
|
||||
set do7=no
|
||||
set do8=no
|
||||
set do9=no
|
||||
set do10=no
|
||||
set do11=no
|
||||
set do12=no
|
||||
set do13=no
|
||||
set do14=no
|
||||
set do15=no
|
||||
set do16=no
|
||||
set do17=no
|
||||
set do18=no
|
||||
set do19=no
|
||||
set all=yes
|
||||
|
||||
for %%a in (%*) do (
|
||||
set valid=no
|
||||
for %%v in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19) do if %%v == %%a set valid=yes
|
||||
if "!valid!" == "yes" (
|
||||
set do%%a=yes
|
||||
set all=no
|
||||
) else (
|
||||
echo Invalid test number - %%a!
|
||||
echo Usage %0 [ test_number ] ...
|
||||
echo Where test_number is one or more optional test numbers 1 through 19, default is all tests.
|
||||
exit /b 1
|
||||
)
|
||||
)
|
||||
set failed="no"
|
||||
|
||||
if "%all%" == "yes" (
|
||||
set do1=yes
|
||||
set do2=yes
|
||||
set do3=yes
|
||||
set do4=yes
|
||||
set do5=yes
|
||||
set do6=yes
|
||||
set do7=yes
|
||||
set do8=yes
|
||||
set do9=yes
|
||||
set do10=yes
|
||||
set do11=yes
|
||||
set do12=yes
|
||||
set do13=yes
|
||||
set do14=yes
|
||||
set do15=yes
|
||||
set do16=yes
|
||||
set do17=yes
|
||||
set do18=yes
|
||||
set do19=yes
|
||||
)
|
||||
|
||||
@echo RunTest.bat's pcre2test output is written to newly created subfolders
|
||||
@echo named testout{8,16,32} and testoutjit{8,16,32}.
|
||||
@echo.
|
||||
|
||||
set mode=
|
||||
set bits=8
|
||||
|
||||
:nextMode
|
||||
if "%mode%" == "" (
|
||||
if %support8% EQU 0 goto modeSkip
|
||||
echo.
|
||||
echo ---- Testing 8-bit library ----
|
||||
echo.
|
||||
)
|
||||
if "%mode%" == "-16" (
|
||||
if %support16% EQU 0 goto modeSkip
|
||||
echo.
|
||||
echo ---- Testing 16-bit library ----
|
||||
echo.
|
||||
)
|
||||
if "%mode%" == "-32" (
|
||||
if %support32% EQU 0 goto modeSkip
|
||||
echo.
|
||||
echo ---- Testing 32-bit library ----
|
||||
echo.
|
||||
)
|
||||
if "%do1%" == "yes" call :do1
|
||||
if "%do2%" == "yes" call :do2
|
||||
if "%do3%" == "yes" call :do3
|
||||
if "%do4%" == "yes" call :do4
|
||||
if "%do5%" == "yes" call :do5
|
||||
if "%do6%" == "yes" call :do6
|
||||
if "%do7%" == "yes" call :do7
|
||||
if "%do8%" == "yes" call :do8
|
||||
if "%do9%" == "yes" call :do9
|
||||
if "%do10%" == "yes" call :do10
|
||||
if "%do11%" == "yes" call :do11
|
||||
if "%do12%" == "yes" call :do12
|
||||
if "%do13%" == "yes" call :do13
|
||||
if "%do14%" == "yes" call :do14
|
||||
if "%do15%" == "yes" call :do15
|
||||
if "%do16%" == "yes" call :do16
|
||||
if "%do17%" == "yes" call :do17
|
||||
if "%do18%" == "yes" call :do18
|
||||
if "%do19%" == "yes" call :do19
|
||||
:modeSkip
|
||||
if "%mode%" == "" (
|
||||
set mode=-16
|
||||
set bits=16
|
||||
goto nextMode
|
||||
)
|
||||
if "%mode%" == "-16" (
|
||||
set mode=-32
|
||||
set bits=32
|
||||
goto nextMode
|
||||
)
|
||||
|
||||
@rem If mode is -32, testing is finished
|
||||
if %failed% == "yes" (
|
||||
echo In above output, one or more of the various tests failed!
|
||||
exit /b 1
|
||||
)
|
||||
echo All OK
|
||||
goto :eof
|
||||
|
||||
:runsub
|
||||
@rem Function to execute pcre2test and compare the output
|
||||
@rem Arguments are as follows:
|
||||
@rem
|
||||
@rem 1 = test number
|
||||
@rem 2 = outputdir
|
||||
@rem 3 = test name use double quotes
|
||||
@rem 4 - 9 = pcre2test options
|
||||
|
||||
if [%1] == [] (
|
||||
echo Missing test number argument!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if [%2] == [] (
|
||||
echo Missing outputdir!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if [%3] == [] (
|
||||
echo Missing test name argument!
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set testinput=testinput%1
|
||||
set testoutput=testoutput%1
|
||||
if exist %srcdir%\testdata\win%testinput% (
|
||||
set testinput=wintestinput%1
|
||||
set testoutput=wintestoutput%1
|
||||
)
|
||||
|
||||
echo Test %1: %3
|
||||
%pcre2test% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% >%2%bits%\%testoutput%
|
||||
if errorlevel 1 (
|
||||
echo. failed executing command-line:
|
||||
echo. %pcre2test% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% ^>%2%bits%\%testoutput%
|
||||
set failed="yes"
|
||||
goto :eof
|
||||
)
|
||||
|
||||
set type=
|
||||
if [%1]==[8] (
|
||||
set type=-%bits%
|
||||
)
|
||||
if [%1]==[11] (
|
||||
set type=-%bits%
|
||||
)
|
||||
if [%1]==[12] (
|
||||
set type=-%bits%
|
||||
)
|
||||
|
||||
fc /n %srcdir%\testdata\%testoutput%%type% %2%bits%\%testoutput% >NUL
|
||||
|
||||
if errorlevel 1 (
|
||||
echo. failed comparison: fc /n %srcdir%\testdata\%testoutput% %2%bits%\%testoutput%
|
||||
if [%1]==[2] (
|
||||
echo.
|
||||
echo ** Test 2 requires a lot of stack. PCRE2 can be configured to
|
||||
echo ** use heap for recursion. Otherwise, to pass Test 2
|
||||
echo ** you generally need to allocate 8 mb stack to PCRE2.
|
||||
echo ** See the 'pcre2stack' page for a discussion of PCRE2's
|
||||
echo ** stack usage.
|
||||
echo.
|
||||
)
|
||||
if [%1]==[3] (
|
||||
echo.
|
||||
echo ** Test 3 failure usually means french locale is not
|
||||
echo ** available on the system, rather than a bug or problem with PCRE2.
|
||||
echo.
|
||||
goto :eof
|
||||
)
|
||||
|
||||
set failed="yes"
|
||||
goto :eof
|
||||
)
|
||||
|
||||
echo. Passed.
|
||||
goto :eof
|
||||
|
||||
:do1
|
||||
call :runsub 1 testout "Main non-UTF, non-UCP functionality (Compatible with Perl >= 5.10)" -q
|
||||
if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do2
|
||||
call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
|
||||
if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do3
|
||||
call :runsub 3 testout "Locale-specific features" -q
|
||||
if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do4
|
||||
if %unicode% EQU 0 (
|
||||
echo Test 4 Skipped due to absence of Unicode support.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 4 testout "UTF-%bits% and Unicode property support - (Compatible with Perl >= 5.10)" -q
|
||||
if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do5
|
||||
if %unicode% EQU 0 (
|
||||
echo Test 5 Skipped due to absence of Unicode support.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-%bits% and UCP" -q
|
||||
if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do6
|
||||
call :runsub 6 testout "DFA matching main non-UTF, non-UCP functionality" -q -dfa
|
||||
goto :eof
|
||||
|
||||
:do7
|
||||
if %unicode% EQU 0 (
|
||||
echo Test 7 Skipped due to absence of Unicode support.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 7 testout "DFA matching with UTF-%bits% and Unicode property support" -q -dfa
|
||||
goto :eof
|
||||
|
||||
:do8
|
||||
if NOT %link_size% EQU 2 (
|
||||
echo Test 8 Skipped because link size is not 2.
|
||||
goto :eof
|
||||
)
|
||||
if %unicode% EQU 0 (
|
||||
echo Test 8 Skipped due to absence of Unicode support.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 8 testout "Internal offsets and code size tests" -q
|
||||
goto :eof
|
||||
|
||||
:do9
|
||||
if NOT %bits% EQU 8 (
|
||||
echo Test 9 Skipped when running 16/32-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 9 testout "Specials for the basic 8-bit library" -q
|
||||
if %jit% EQU 1 call :runsub 9 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do10
|
||||
if NOT %bits% EQU 8 (
|
||||
echo Test 10 Skipped when running 16/32-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
if %unicode% EQU 0 (
|
||||
echo Test 10 Skipped due to absence of Unicode support.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 10 testout "Specials for the 8-bit library with Unicode support" -q
|
||||
if %jit% EQU 1 call :runsub 10 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do11
|
||||
if %bits% EQU 8 (
|
||||
echo Test 11 Skipped when running 8-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 11 testout "Specials for the basic 16/32-bit library" -q
|
||||
if %jit% EQU 1 call :runsub 11 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do12
|
||||
if %bits% EQU 8 (
|
||||
echo Test 12 Skipped when running 8-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
if %unicode% EQU 0 (
|
||||
echo Test 12 Skipped due to absence of Unicode support.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 12 testout "Specials for the 16/32-bit library with Unicode support" -q
|
||||
if %jit% EQU 1 call :runsub 12 testoutjit "Test with JIT Override" -q -jit
|
||||
goto :eof
|
||||
|
||||
:do13
|
||||
if %bits% EQU 8 (
|
||||
echo Test 13 Skipped when running 8-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 13 testout "DFA specials for the basic 16/32-bit library" -q -dfa
|
||||
goto :eof
|
||||
|
||||
:do14
|
||||
call :runsub 14 testout "Non-JIT limits and other non_JIT tests" -q
|
||||
goto :eof
|
||||
|
||||
:do15
|
||||
if %jit% EQU 1 (
|
||||
echo Test 15 Skipped due to presence of JIT support.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 15 testout "JIT-specific features when JIT is not available" -q
|
||||
goto :eof
|
||||
|
||||
:do16
|
||||
if %jit% EQU 0 (
|
||||
echo Test 16 Skipped due to absence of JIT support.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 16 testout "JIT-specific features when JIT is available" -q
|
||||
goto :eof
|
||||
|
||||
:do17
|
||||
if %bits% EQU 16 (
|
||||
echo Test 17 Skipped when running 16-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
if %bits% EQU 32 (
|
||||
echo Test 17 Skipped when running 32-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 17 testout "POSIX interface, excluding UTF-8 and UCP" -q
|
||||
goto :eof
|
||||
|
||||
:do18
|
||||
if %bits% EQU 16 (
|
||||
echo Test 18 Skipped when running 16-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
if %bits% EQU 32 (
|
||||
echo Test 18 Skipped when running 32-bit tests.
|
||||
goto :eof
|
||||
)
|
||||
call :runsub 1 testout "POSIX interface with UTF-8 and UCP" -q
|
||||
goto :eof
|
||||
|
||||
:do19
|
||||
call :runsub 1 testout "Serialization tests" -q
|
||||
goto :eof
|
||||
|
||||
:conferror
|
||||
@echo.
|
||||
@echo Either your build is incomplete or you have a configuration error.
|
||||
@echo.
|
||||
@echo If configured with cmake and executed via "make test" or the MSVC "RUN_TESTS"
|
||||
@echo project, pcre2_test.bat defines variables and automatically calls RunTest.bat.
|
||||
@echo For manual testing of all available features, after configuring with cmake
|
||||
@echo and building, you can run the built pcre2_test.bat. For best results with
|
||||
@echo cmake builds and tests avoid directories with full path names that include
|
||||
@echo spaces for source or build.
|
||||
@echo.
|
||||
@echo Otherwise, if the build dir is in a subdir of the source dir, testdata needed
|
||||
@echo for input and verification should be found automatically when (from the
|
||||
@echo location of the the built exes) you call RunTest.bat. By default RunTest.bat
|
||||
@echo runs all tests compatible with the linked pcre2 library but it can be given
|
||||
@echo a test number as an argument.
|
||||
@echo.
|
||||
@echo If the build dir is not under the source dir you can either copy your exes
|
||||
@echo to the source folder or copy RunTest.bat and the testdata folder to the
|
||||
@echo location of your built exes and then run RunTest.bat.
|
||||
@echo.
|
||||
goto :eof
|
|
@ -100,15 +100,18 @@ required for different environments. */
|
|||
input and output without "b"; then I was told that "b" was needed in some
|
||||
environments, so it was added for release 5.0 to both the input and output. (It
|
||||
makes no difference on Unix-like systems.) Later I was told that it is wrong
|
||||
for the input on Windows. I've now abstracted the modes into two macros that
|
||||
are set here, to make it easier to fiddle with them, and removed "b" from the
|
||||
input mode under Windows. */
|
||||
for the input on Windows. I've now abstracted the modes into macros that are
|
||||
set here, to make it easier to fiddle with them, and removed "b" from the input
|
||||
mode under Windows. The BINARY versions are used when saving/restoring compiled
|
||||
patterns. */
|
||||
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
#include <io.h> /* For _setmode() */
|
||||
#include <fcntl.h> /* For _O_BINARY */
|
||||
#define INPUT_MODE "r"
|
||||
#define OUTPUT_MODE "wb"
|
||||
#define INPUT_MODE "r"
|
||||
#define OUTPUT_MODE "wb"
|
||||
#define BINARY_INPUT_MODE "rb"
|
||||
#define BINARY_OUTPUT_MODE "wb"
|
||||
|
||||
#ifndef isatty
|
||||
#define isatty _isatty /* This is what Windows calls them, I'm told, */
|
||||
|
@ -132,9 +135,13 @@ input mode under Windows. */
|
|||
#if defined NATIVE_ZOS /* z/OS uses non-binary I/O */
|
||||
#define INPUT_MODE "r"
|
||||
#define OUTPUT_MODE "w"
|
||||
#define BINARY_INPUT_MODE "rb"
|
||||
#define BINARY_OUTPUT_MODE "wb"
|
||||
#else
|
||||
#define INPUT_MODE "rb"
|
||||
#define OUTPUT_MODE "wb"
|
||||
#define INPUT_MODE "rb"
|
||||
#define OUTPUT_MODE "wb"
|
||||
#define BINARY_INPUT_MODE "rb"
|
||||
#define BINARY_OUTPUT_MODE "wb"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -3964,7 +3971,7 @@ switch(cmd)
|
|||
return PR_OK;
|
||||
}
|
||||
|
||||
rc = open_file(argptr+1, OUTPUT_MODE, &f);
|
||||
rc = open_file(argptr+1, BINARY_OUTPUT_MODE, &f);
|
||||
if (rc != PR_OK) return rc;
|
||||
|
||||
PCRE2_SERIALIZE_ENCODE(rc, patstack, patstacknext, &serial, &serial_size,
|
||||
|
@ -4001,7 +4008,7 @@ switch(cmd)
|
|||
/* Load a set of compiled patterns from a file onto the stack */
|
||||
|
||||
case CMD_LOAD:
|
||||
rc = open_file(argptr+1, INPUT_MODE, &f);
|
||||
rc = open_file(argptr+1, BINARY_INPUT_MODE, &f);
|
||||
if (rc != PR_OK) return rc;
|
||||
|
||||
serial_size = 0;
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
# This set of tests checks local-specific features, using the "fr_FR" locale.
|
||||
# It is not Perl-compatible. When run via RunTest, the locale is edited to
|
||||
# be whichever of "fr_FR", "french", or "fr" is found to exist. There is
|
||||
# different version of this file called wintestinput3 for use on Windows,
|
||||
# where the locale is called "french" and the tests are run using
|
||||
# RunTest.bat.
|
||||
|
||||
#forbid_utf
|
||||
|
||||
/^[\w]+/
|
||||
*** Failers
|
||||
École
|
||||
|
||||
/^[\w]+/locale=french
|
||||
École
|
||||
|
||||
/^[\w]+/
|
||||
*** Failers
|
||||
École
|
||||
|
||||
/^[\W]+/
|
||||
École
|
||||
|
||||
/^[\W]+/locale=french
|
||||
*** Failers
|
||||
École
|
||||
|
||||
/[\b]/
|
||||
\b
|
||||
*** Failers
|
||||
a
|
||||
|
||||
/[\b]/locale=french
|
||||
\b
|
||||
*** Failers
|
||||
a
|
||||
|
||||
/^\w+/
|
||||
*** Failers
|
||||
École
|
||||
|
||||
/^\w+/locale=french
|
||||
École
|
||||
|
||||
/(.+)\b(.+)/
|
||||
École
|
||||
|
||||
/(.+)\b(.+)/locale=french
|
||||
*** Failers
|
||||
École
|
||||
|
||||
/École/i
|
||||
École
|
||||
*** Failers
|
||||
école
|
||||
|
||||
/École/i,locale=french
|
||||
École
|
||||
école
|
||||
|
||||
/\w/I
|
||||
|
||||
/\w/I,locale=french
|
||||
|
||||
# All remaining tests are in the french locale, so set the default.
|
||||
|
||||
#pattern locale=french
|
||||
|
||||
/^[\xc8-\xc9]/i
|
||||
École
|
||||
école
|
||||
|
||||
/^[\xc8-\xc9]/
|
||||
École
|
||||
*** Failers
|
||||
école
|
||||
|
||||
/\W+/
|
||||
>>>\xaa<<<
|
||||
>>>\xba<<<
|
||||
|
||||
/[\W]+/
|
||||
>>>\xaa<<<
|
||||
>>>\xba<<<
|
||||
|
||||
/[^[:alpha:]]+/
|
||||
>>>\xaa<<<
|
||||
>>>\xba<<<
|
||||
|
||||
/\w+/
|
||||
>>>\xaa<<<
|
||||
>>>\xba<<<
|
||||
|
||||
/[\w]+/
|
||||
>>>\xaa<<<
|
||||
>>>\xba<<<
|
||||
|
||||
/[[:alpha:]]+/
|
||||
>>>\xaa<<<
|
||||
>>>\xba<<<
|
||||
|
||||
/[[:alpha:]][[:lower:]][[:upper:]]/IB
|
||||
|
||||
# End of testinput3
|
|
@ -0,0 +1,175 @@
|
|||
# This set of tests checks local-specific features, using the "fr_FR" locale.
|
||||
# It is not Perl-compatible. When run via RunTest, the locale is edited to
|
||||
# be whichever of "fr_FR", "french", or "fr" is found to exist. There is
|
||||
# different version of this file called wintestinput3 for use on Windows,
|
||||
# where the locale is called "french" and the tests are run using
|
||||
# RunTest.bat.
|
||||
|
||||
#forbid_utf
|
||||
|
||||
/^[\w]+/
|
||||
*** Failers
|
||||
No match
|
||||
École
|
||||
No match
|
||||
|
||||
/^[\w]+/locale=french
|
||||
École
|
||||
0: École
|
||||
|
||||
/^[\w]+/
|
||||
*** Failers
|
||||
No match
|
||||
École
|
||||
No match
|
||||
|
||||
/^[\W]+/
|
||||
École
|
||||
0: \xc9
|
||||
|
||||
/^[\W]+/locale=french
|
||||
*** Failers
|
||||
0: ***
|
||||
École
|
||||
No match
|
||||
|
||||
/[\b]/
|
||||
\b
|
||||
0: \x08
|
||||
*** Failers
|
||||
No match
|
||||
a
|
||||
No match
|
||||
|
||||
/[\b]/locale=french
|
||||
\b
|
||||
0: \x08
|
||||
*** Failers
|
||||
No match
|
||||
a
|
||||
No match
|
||||
|
||||
/^\w+/
|
||||
*** Failers
|
||||
No match
|
||||
École
|
||||
No match
|
||||
|
||||
/^\w+/locale=french
|
||||
École
|
||||
0: École
|
||||
|
||||
/(.+)\b(.+)/
|
||||
École
|
||||
0: \xc9cole
|
||||
1: \xc9
|
||||
2: cole
|
||||
|
||||
/(.+)\b(.+)/locale=french
|
||||
*** Failers
|
||||
0: *** Failers
|
||||
1: ***
|
||||
2: Failers
|
||||
École
|
||||
No match
|
||||
|
||||
/École/i
|
||||
École
|
||||
0: \xc9cole
|
||||
*** Failers
|
||||
No match
|
||||
école
|
||||
No match
|
||||
|
||||
/École/i,locale=french
|
||||
École
|
||||
0: École
|
||||
école
|
||||
0: école
|
||||
|
||||
/\w/I
|
||||
Capturing subpattern count = 0
|
||||
Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
|
||||
Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
|
||||
Subject length lower bound = 1
|
||||
|
||||
/\w/I,locale=french
|
||||
Capturing subpattern count = 0
|
||||
Starting code units: 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P
|
||||
Q R S T U V W X Y Z _ a b c d e f g h i j k l m n o p q r s t u v w x y z
|
||||
ƒ Š Œ Ž š œ ž Ÿ ª ² ³ µ ¹ º À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö
|
||||
Ø Ù Ú Û Ü Ý Þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý
|
||||
þ ÿ
|
||||
Subject length lower bound = 1
|
||||
|
||||
# All remaining tests are in the french locale, so set the default.
|
||||
|
||||
#pattern locale=french
|
||||
|
||||
/^[\xc8-\xc9]/i
|
||||
École
|
||||
0: É
|
||||
école
|
||||
0: é
|
||||
|
||||
/^[\xc8-\xc9]/
|
||||
École
|
||||
0: É
|
||||
*** Failers
|
||||
No match
|
||||
école
|
||||
No match
|
||||
|
||||
/\W+/
|
||||
>>>\xaa<<<
|
||||
0: >>>
|
||||
>>>\xba<<<
|
||||
0: >>>
|
||||
|
||||
/[\W]+/
|
||||
>>>\xaa<<<
|
||||
0: >>>
|
||||
>>>\xba<<<
|
||||
0: >>>
|
||||
|
||||
/[^[:alpha:]]+/
|
||||
>>>\xaa<<<
|
||||
0: >>>
|
||||
>>>\xba<<<
|
||||
0: >>>
|
||||
|
||||
/\w+/
|
||||
>>>\xaa<<<
|
||||
0: ª
|
||||
>>>\xba<<<
|
||||
0: º
|
||||
|
||||
/[\w]+/
|
||||
>>>\xaa<<<
|
||||
0: ª
|
||||
>>>\xba<<<
|
||||
0: º
|
||||
|
||||
/[[:alpha:]]+/
|
||||
>>>\xaa<<<
|
||||
0: ª
|
||||
>>>\xba<<<
|
||||
0: º
|
||||
|
||||
/[[:alpha:]][[:lower:]][[:upper:]]/IB
|
||||
------------------------------------------------------------------
|
||||
Bra
|
||||
[A-Za-z\x83\x8a\x8c\x8e\x9a\x9c\x9e\x9f\xaa\xb2\xb3\xb5\xb9\xba\xc0-\xd6\xd8-\xf6\xf8-\xff]
|
||||
[a-z\x83\x9a\x9c\x9e\xaa\xb5\xba\xdf-\xf6\xf8-\xff]
|
||||
[A-Z\x8a\x8c\x8e\x9f\xc0-\xd6\xd8-\xde]
|
||||
Ket
|
||||
End
|
||||
------------------------------------------------------------------
|
||||
Capturing subpattern count = 0
|
||||
Starting code units: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
|
||||
a b c d e f g h i j k l m n o p q r s t u v w x y z ƒ Š Œ Ž š œ ž Ÿ ª ² ³
|
||||
µ ¹ º À Á Â Ã Ä Å Æ Ç È É Ê Ë Ì Í Î Ï Ð Ñ Ò Ó Ô Õ Ö Ø Ù Ú Û Ü Ý Þ ß à á â
|
||||
ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ø ù ú û ü ý þ ÿ
|
||||
Subject length lower bound = 3
|
||||
|
||||
# End of testinput3
|
Loading…
Reference in New Issue