| 1 |
@echo off
|
| 2 |
@rem This file must use CRLF linebreaks to function properly
|
| 3 |
@rem and user must have external findstr command
|
| 4 |
@rem This file was contributed by Ralf Junker, and touched up by
|
| 5 |
@rem Daniel Richard G. Tests 10-12 added by Philip H.
|
| 6 |
@rem Philip H also changed test 3 to use "wintest" files.
|
| 7 |
@rem
|
| 8 |
@rem Updated by Tom Fortmann to support explicit test numbers on the command line.
|
| 9 |
@rem Added argument validation and added error reporting.
|
| 10 |
@rem
|
| 11 |
@rem MS Windows batch file to run pcretest on testfiles with the correct
|
| 12 |
@rem options.
|
| 13 |
@rem
|
| 14 |
@rem Sheri Pierce added logic to skip feature dependent tests
|
| 15 |
@rem tests 4 5 8 and 12 require utf8 support
|
| 16 |
@rem tests 6 9 13 require ucp support
|
| 17 |
@rem 10 requires ucp and link size 2
|
| 18 |
@rem 14 requires presense of jit support
|
| 19 |
@rem 15 requires absence of jit support
|
| 20 |
|
| 21 |
@rem Sheri P also added override tests for study and jit testing
|
| 22 |
@rem Output is written to newly created subfolders named testout testoutstudy and testoutjit.
|
| 23 |
@rem Current dir should be the build dir. The testdata folder should exist in the current dir or in ..
|
| 24 |
@rem Copy RunTest.bat to the build dir manually if necessary.
|
| 25 |
@rem
|
| 26 |
|
| 27 |
setlocal enabledelayedexpansion
|
| 28 |
|
| 29 |
if exist testdata set srcdir=.
|
| 30 |
if [%srcdir%]==[] set srcdir=..
|
| 31 |
if NOT exist %srcdir%\testdata (
|
| 32 |
echo distribution testdata folder not found.
|
| 33 |
exit /b 1
|
| 34 |
goto :eof
|
| 35 |
)
|
| 36 |
if [%pcretest%]==[] set pcretest=pcretest
|
| 37 |
|
| 38 |
%pcretest% -C |findstr /C:"No UTF-8 support" >NUL
|
| 39 |
set utf8=%ERRORLEVEL%
|
| 40 |
%pcretest% -C |findstr /C:"No Unicode properties support" >NUL
|
| 41 |
set ucp=%ERRORLEVEL%
|
| 42 |
%pcretest% -C |findstr /C:"No just-in-time compiler support" >NUL
|
| 43 |
set jit=%ERRORLEVEL%
|
| 44 |
%pcretest% -C |findstr /C:"Internal link size = 2" >NUL
|
| 45 |
set link2=%ERRORLEVEL%
|
| 46 |
|
| 47 |
set ucpandlink2=0
|
| 48 |
if %ucp% EQU 1 (
|
| 49 |
if %link2% EQU 0 set ucpandlink2=1
|
| 50 |
)
|
| 51 |
|
| 52 |
if not exist testout md testout
|
| 53 |
if not exist testoutstudy md testoutstudy
|
| 54 |
if not exist testoutjit md testoutjit
|
| 55 |
|
| 56 |
set do1=no
|
| 57 |
set do2=no
|
| 58 |
set do3=no
|
| 59 |
set do4=no
|
| 60 |
set do5=no
|
| 61 |
set do6=no
|
| 62 |
set do7=no
|
| 63 |
set do8=no
|
| 64 |
set do9=no
|
| 65 |
set do10=no
|
| 66 |
set do11=no
|
| 67 |
set do12=no
|
| 68 |
set do13=no
|
| 69 |
set do14=no
|
| 70 |
set do15=no
|
| 71 |
set all=yes
|
| 72 |
|
| 73 |
for %%a in (%*) do (
|
| 74 |
set valid=no
|
| 75 |
for %%v in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15) do if %%v == %%a set valid=yes
|
| 76 |
if "!valid!" == "yes" (
|
| 77 |
set do%%a=yes
|
| 78 |
set all=no
|
| 79 |
) else (
|
| 80 |
echo Invalid test number - %%a!
|
| 81 |
echo Usage %0 [ test_number ] ...
|
| 82 |
echo Where test_number is one or more optional test numbers 1 through 15, default is all tests.
|
| 83 |
exit /b 1
|
| 84 |
)
|
| 85 |
)
|
| 86 |
if "%all%" == "yes" (
|
| 87 |
set do1=yes
|
| 88 |
set do2=yes
|
| 89 |
set do3=yes
|
| 90 |
set do4=yes
|
| 91 |
set do5=yes
|
| 92 |
set do6=yes
|
| 93 |
set do7=yes
|
| 94 |
set do8=yes
|
| 95 |
set do9=yes
|
| 96 |
set do10=yes
|
| 97 |
set do11=yes
|
| 98 |
set do12=yes
|
| 99 |
set do13=yes
|
| 100 |
set do14=yes
|
| 101 |
set do15=yes
|
| 102 |
)
|
| 103 |
|
| 104 |
if "%do1%" == "yes" call :do1
|
| 105 |
if "%do2%" == "yes" call :do2
|
| 106 |
if "%do3%" == "yes" call :do3
|
| 107 |
if "%do4%" == "yes" call :do4
|
| 108 |
if "%do5%" == "yes" call :do5
|
| 109 |
if "%do6%" == "yes" call :do6
|
| 110 |
if "%do7%" == "yes" call :do7
|
| 111 |
if "%do8%" == "yes" call :do8
|
| 112 |
if "%do9%" == "yes" call :do9
|
| 113 |
if "%do10%" == "yes" call :do10
|
| 114 |
if "%do11%" == "yes" call :do11
|
| 115 |
if "%do12%" == "yes" call :do12
|
| 116 |
if "%do13%" == "yes" call :do13
|
| 117 |
if "%do14%" == "yes" call :do14
|
| 118 |
if "%do15%" == "yes" call :do15
|
| 119 |
goto :eof
|
| 120 |
|
| 121 |
:runsub
|
| 122 |
@rem Function to execute pcretest and compare the output
|
| 123 |
@rem Arguments are as follows:
|
| 124 |
@rem
|
| 125 |
@rem 1 = test number
|
| 126 |
@rem 2 = outputdir
|
| 127 |
@rem 3 = test name use double quotes
|
| 128 |
@rem 4 - 9 = pcretest options
|
| 129 |
|
| 130 |
if [%1] == [] (
|
| 131 |
echo Missing test number argument!
|
| 132 |
exit /b 1
|
| 133 |
)
|
| 134 |
|
| 135 |
if [%2] == [] (
|
| 136 |
echo Missing outputdir!
|
| 137 |
exit /b 1
|
| 138 |
)
|
| 139 |
|
| 140 |
if [%3] == [] (
|
| 141 |
echo Missing test name argument!
|
| 142 |
exit /b 1
|
| 143 |
)
|
| 144 |
|
| 145 |
set testinput=testinput%1
|
| 146 |
set testoutput=testoutput%1
|
| 147 |
if exist %srcdir%\testdata\win%testinput% (
|
| 148 |
set testinput=wintestinput%1
|
| 149 |
set testoutput=wintestoutput%1
|
| 150 |
)
|
| 151 |
|
| 152 |
echo.
|
| 153 |
echo Test %1: %3
|
| 154 |
%pcretest% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput%>%2\%testoutput%
|
| 155 |
if errorlevel 1 (
|
| 156 |
echo Test %1: pcretest failed!
|
| 157 |
goto :eof
|
| 158 |
)
|
| 159 |
|
| 160 |
fc /n %srcdir%\testdata\%testoutput% %2\%testoutput%
|
| 161 |
if errorlevel 1 (
|
| 162 |
echo Test %1: file compare failed!
|
| 163 |
goto :eof
|
| 164 |
)
|
| 165 |
|
| 166 |
echo Test %1: Passed.
|
| 167 |
echo.
|
| 168 |
goto :eof
|
| 169 |
|
| 170 |
:do1
|
| 171 |
call :runsub 1 testout "Main functionality - Compatible with Perl 5.8 and above" -q
|
| 172 |
call :runsub 1 testoutstudy "Test with Study Override" -q -s
|
| 173 |
if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -s+
|
| 174 |
goto :eof
|
| 175 |
|
| 176 |
:do2
|
| 177 |
call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
|
| 178 |
call :runsub 2 testoutstudy "Test with Study Override" -q -s
|
| 179 |
if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -s+
|
| 180 |
goto :eof
|
| 181 |
|
| 182 |
:do3
|
| 183 |
call :runsub 3 testout "Locale-specific features" -q
|
| 184 |
call :runsub 3 testoutstudy "Test with Study Override" -q -s
|
| 185 |
if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -s+
|
| 186 |
goto :eof
|
| 187 |
|
| 188 |
:do4
|
| 189 |
if %utf8% EQU 0 (
|
| 190 |
echo Test 4 Skipped due to absence of UTF-8 support.
|
| 191 |
goto :eof
|
| 192 |
)
|
| 193 |
call :runsub 4 testout "UTF-8 support - Compatible with Perl 5.8 and above" -q
|
| 194 |
call :runsub 4 testoutstudy "Test with Study Override" -q -s
|
| 195 |
if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
|
| 196 |
goto :eof
|
| 197 |
|
| 198 |
:do5
|
| 199 |
if %utf8% EQU 0 (
|
| 200 |
echo Test 5 Skipped due to absence of UTF-8 support.
|
| 201 |
goto :eof
|
| 202 |
)
|
| 203 |
call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-8 support" -q
|
| 204 |
call :runsub 5 testoutstudy "Test with Study Override" -q -s
|
| 205 |
if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
|
| 206 |
goto :eof
|
| 207 |
|
| 208 |
:do6
|
| 209 |
if %ucp% EQU 0 (
|
| 210 |
echo Test 6 Skipped due to absence of ucp support.
|
| 211 |
goto :eof
|
| 212 |
)
|
| 213 |
call :runsub 6 testout "Unicode property support - Compatible with Perl 5.10 and above" -q
|
| 214 |
call :runsub 6 testoutstudy "Test with Study Override" -q -s
|
| 215 |
if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
|
| 216 |
goto :eof
|
| 217 |
|
| 218 |
:do7
|
| 219 |
call :runsub 7 testout "DFA matching" -q -dfa
|
| 220 |
call :runsub 7 testoutstudy "Test with Study Override" -q -dfa -s
|
| 221 |
if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -dfa -s+
|
| 222 |
goto :eof
|
| 223 |
|
| 224 |
:do8
|
| 225 |
if %utf8% EQU 0 (
|
| 226 |
echo Test 8 Skipped due to absence of UTF-8 support.
|
| 227 |
goto :eof
|
| 228 |
)
|
| 229 |
call :runsub 8 testout "DFA matching with UTF-8" -q -dfa
|
| 230 |
call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
|
| 231 |
if %jit% EQU 1 call :runsub 8 testoutjit "Test with JIT Override" -q -dfa -s+
|
| 232 |
goto :eof
|
| 233 |
|
| 234 |
:do9
|
| 235 |
if %ucp% EQU 0 (
|
| 236 |
echo Test 9 Skipped due to absence of ucp support.
|
| 237 |
goto :eof
|
| 238 |
)
|
| 239 |
call :runsub 9 testout "DFA matching with Unicode properties" -q -dfa
|
| 240 |
call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
|
| 241 |
if %jit% EQU 1 call :runsub 9 testoutjit "Test with JIT Override" -q -dfa -s+
|
| 242 |
goto :eof
|
| 243 |
|
| 244 |
:do10
|
| 245 |
if %ucpandlink2% EQU 0 (
|
| 246 |
echo Test 10 Skipped due to requirements of ucp support AND link size 2.
|
| 247 |
goto :eof
|
| 248 |
)
|
| 249 |
call :runsub 10 testout "Internal offsets and code size tests" -q
|
| 250 |
call :runsub 10 testoutstudy "Test with Study Override" -q -s
|
| 251 |
if %jit% EQU 1 call :runsub 10 testoutjit "Test with JIT Override" -q -s+
|
| 252 |
goto :eof
|
| 253 |
|
| 254 |
:do11
|
| 255 |
call :runsub 11 testout "Features from Perl 5.10 and above" -q
|
| 256 |
call :runsub 11 testoutstudy "Test with Study Override" -q -s
|
| 257 |
if %jit% EQU 1 call :runsub 11 testoutjit "Test with JIT Override" -q -s+
|
| 258 |
goto :eof
|
| 259 |
|
| 260 |
:do12
|
| 261 |
if %utf8% EQU 0 (
|
| 262 |
echo Test 12 Skipped due to absence of UTF-8 support.
|
| 263 |
goto :eof
|
| 264 |
)
|
| 265 |
call :runsub 12 testout "Features from Perl 5.10 and above w UTF-8" -q
|
| 266 |
call :runsub 12 testoutstudy "Test with Study Override" -q -s
|
| 267 |
if %jit% EQU 1 call :runsub 12 testoutjit "Test with JIT Override" -q -s+
|
| 268 |
goto :eof
|
| 269 |
|
| 270 |
:do13
|
| 271 |
if %ucp% EQU 0 (
|
| 272 |
echo Test 13 Skipped due to absence of ucp support.
|
| 273 |
goto :eof
|
| 274 |
)
|
| 275 |
call :runsub 13 testout "API internals and non-Perl stuff for Unicode property support" -q
|
| 276 |
call :runsub 13 testoutstudy "Test with Study Override" -q -s
|
| 277 |
if %jit% EQU 1 call :runsub 13 testoutjit "Test with JIT Override" -q -s+
|
| 278 |
goto :eof
|
| 279 |
|
| 280 |
:do14
|
| 281 |
if %jit% EQU 0 (
|
| 282 |
echo Test 14 Skipped due to absence of JIT support.
|
| 283 |
goto :eof
|
| 284 |
)
|
| 285 |
call :runsub 14 testout "JIT-specific features - have JIT" -q
|
| 286 |
call :runsub 14 testoutstudy "Test with Study Override" -q -s
|
| 287 |
call :runsub 14 testoutjit "Test with JIT Override" -q -s+
|
| 288 |
goto :eof
|
| 289 |
|
| 290 |
:do15
|
| 291 |
if %jit% EQU 1 (
|
| 292 |
echo Test 15 Skipped due to presence of JIT support.
|
| 293 |
goto :eof
|
| 294 |
)
|
| 295 |
call :runsub 15 testout "JIT-specific features - no JIT" -q
|
| 296 |
call :runsub 15 testoutstudy "Test with Study Override" -q -s
|
| 297 |
goto :eof
|