| 1 |
|
@echo off |
| 2 |
@rem This file was contributed by Ralf Junker, and touched up by |
@rem This file was contributed by Ralf Junker, and touched up by |
| 3 |
@rem Daniel Richard G. Tests 10-12 added by Philip H. |
@rem Daniel Richard G. Tests 10-12 added by Philip H. |
| 4 |
@rem Philip H also changed test 3 to use "wintest" files. |
@rem Philip H also changed test 3 to use "wintest" files. |
| 5 |
@rem |
@rem |
| 6 |
|
@rem Updated by Tom Fortmann to support explicit test numbers on the command line. |
| 7 |
|
@rem Added argument validation and added error reporting. |
| 8 |
|
@rem |
| 9 |
@rem MS Windows batch file to run pcretest on testfiles with the correct |
@rem MS Windows batch file to run pcretest on testfiles with the correct |
| 10 |
@rem options. |
@rem options. |
| 11 |
@rem |
@rem |
| 12 |
@rem Output is written to a newly created subfolder named "testdata". |
@rem Output is written to a newly created subfolder named testout. |
| 13 |
|
@rem |
| 14 |
|
|
| 15 |
setlocal |
setlocal |
| 16 |
|
|
| 19 |
|
|
| 20 |
if not exist testout md testout |
if not exist testout md testout |
| 21 |
|
|
| 22 |
%pcretest% -q %srcdir%\testdata\testinput1 > testout\testoutput1 |
set do1=no |
| 23 |
%pcretest% -q %srcdir%\testdata\testinput2 > testout\testoutput2 |
set do2=no |
| 24 |
@rem %pcretest% -q %srcdir%\testdata\testinput3 > testout\testoutput3 |
set do3=no |
| 25 |
%pcretest% -q %srcdir%\testdata\wintestinput3 > testout\wintestoutput3 |
set do4=no |
| 26 |
%pcretest% -q %srcdir%\testdata\testinput4 > testout\testoutput4 |
set do5=no |
| 27 |
%pcretest% -q %srcdir%\testdata\testinput5 > testout\testoutput5 |
set do6=no |
| 28 |
%pcretest% -q %srcdir%\testdata\testinput6 > testout\testoutput6 |
set do7=no |
| 29 |
%pcretest% -q -dfa %srcdir%\testdata\testinput7 > testout\testoutput7 |
set do8=no |
| 30 |
%pcretest% -q -dfa %srcdir%\testdata\testinput8 > testout\testoutput8 |
set do9=no |
| 31 |
%pcretest% -q -dfa %srcdir%\testdata\testinput9 > testout\testoutput9 |
set do10=no |
| 32 |
%pcretest% -q %srcdir%\testdata\testinput10 > testout\testoutput10 |
set do11=no |
| 33 |
%pcretest% -q %srcdir%\testdata\testinput11 > testout\testoutput11 |
set do12=no |
| 34 |
%pcretest% -q %srcdir%\testdata\testinput12 > testout\testoutput12 |
set all=yes |
| 35 |
|
|
| 36 |
fc /n %srcdir%\testdata\testoutput1 testout\testoutput1 |
setlocal enabledelayedexpansion |
| 37 |
fc /n %srcdir%\testdata\testoutput2 testout\testoutput2 |
for %%a in (%*) do ( |
| 38 |
rem fc /n %srcdir%\testdata\testoutput3 testout\testoutput3 |
set valid=no |
| 39 |
fc /n %srcdir%\testdata\wintestoutput3 testout\wintestoutput3 |
for %%v in (1 2 3 4 5 6 7 8 9 10 11 12) do if %%v == %%a set valid=yes |
| 40 |
fc /n %srcdir%\testdata\testoutput4 testout\testoutput4 |
if "!valid!" == "yes" ( |
| 41 |
fc /n %srcdir%\testdata\testoutput5 testout\testoutput5 |
set do%%a=yes |
| 42 |
fc /n %srcdir%\testdata\testoutput6 testout\testoutput6 |
set all=no |
| 43 |
fc /n %srcdir%\testdata\testoutput7 testout\testoutput7 |
) else ( |
| 44 |
fc /n %srcdir%\testdata\testoutput8 testout\testoutput8 |
echo Invalid test number - %%a! |
| 45 |
fc /n %srcdir%\testdata\testoutput9 testout\testoutput9 |
echo Usage: %0 [ test_number ] ... |
| 46 |
fc /n %srcdir%\testdata\testoutput10 testout\testoutput10 |
echo Where test_number is one or more optional test numbers 1 through 12, default is all tests. |
| 47 |
fc /n %srcdir%\testdata\testoutput11 testout\testoutput11 |
exit /b 1 |
| 48 |
fc /n %srcdir%\testdata\testoutput12 testout\testoutput12 |
) |
| 49 |
|
) |
| 50 |
|
|
| 51 |
|
if "%all%" == "yes" ( |
| 52 |
|
set do1=yes |
| 53 |
|
set do2=yes |
| 54 |
|
set do3=yes |
| 55 |
|
set do4=yes |
| 56 |
|
set do5=yes |
| 57 |
|
set do6=yes |
| 58 |
|
set do7=yes |
| 59 |
|
set do8=yes |
| 60 |
|
set do9=yes |
| 61 |
|
set do10=yes |
| 62 |
|
set do11=yes |
| 63 |
|
set do12=yes |
| 64 |
|
) |
| 65 |
|
|
| 66 |
|
if "%do1%" == "yes" ( |
| 67 |
|
call :runtest 1 "Main functionality - Compatible with Perl 5.8 and above" -q |
| 68 |
|
if errorlevel 1 exit /b 1 |
| 69 |
|
) |
| 70 |
|
|
| 71 |
|
if "%do2%" == "yes" ( |
| 72 |
|
call :runtest 2 "API, errors, internals, and non-Perl stuff" -q |
| 73 |
|
if errorlevel 1 exit /b 1 |
| 74 |
|
) |
| 75 |
|
|
| 76 |
|
if "%do3%" == "yes" ( |
| 77 |
|
call :runtest 3 "Locale-specific features" -q |
| 78 |
|
if errorlevel 1 exit /b 1 |
| 79 |
|
) |
| 80 |
|
|
| 81 |
|
if "%do4%" == "yes" ( |
| 82 |
|
call :runtest 4 "UTF-8 support - Compatible with Perl 5.8 and above" -q |
| 83 |
|
if errorlevel 1 exit /b 1 |
| 84 |
|
) |
| 85 |
|
|
| 86 |
|
if "%do5%" == "yes" ( |
| 87 |
|
call :runtest 5 "API, internals, and non-Perl stuff for UTF-8 support" -q |
| 88 |
|
if errorlevel 1 exit /b 1 |
| 89 |
|
) |
| 90 |
|
|
| 91 |
|
if "%do6%" == "yes" ( |
| 92 |
|
call :runtest 6 "Unicode property support - Compatible with Perl 5.10 and above" -q |
| 93 |
|
if errorlevel 1 exit /b 1 |
| 94 |
|
) |
| 95 |
|
|
| 96 |
|
if "%do7%" == "yes" ( |
| 97 |
|
call :runtest 7 "DFA matching" -q -dfa |
| 98 |
|
if errorlevel 1 exit /b 1 |
| 99 |
|
) |
| 100 |
|
|
| 101 |
|
if "%do8%" == "yes" ( |
| 102 |
|
call :runtest 8 "DFA matching with UTF-8" -q -dfa |
| 103 |
|
if errorlevel 1 exit /b 1 |
| 104 |
|
) |
| 105 |
|
|
| 106 |
|
if "%do9%" == "yes" ( |
| 107 |
|
call :runtest 9 "DFA matching with Unicode properties" -q -dfa |
| 108 |
|
if errorlevel 1 exit /b 1 |
| 109 |
|
) |
| 110 |
|
|
| 111 |
|
if "%do10%" == "yes" ( |
| 112 |
|
call :runtest 10 "Internal offsets and code size tests" -q |
| 113 |
|
if errorlevel 1 exit /b 1 |
| 114 |
|
) |
| 115 |
|
|
| 116 |
|
if "%do11%" == "yes" ( |
| 117 |
|
call :runtest 11 "Features from Perl 5.10 and above" -q |
| 118 |
|
if errorlevel 1 exit /b 1 |
| 119 |
|
) |
| 120 |
|
|
| 121 |
|
if "%do12%" == "yes" ( |
| 122 |
|
call :runtest 12 "API, internals, and non-Perl stuff for Unicode property support" -q |
| 123 |
|
if errorlevel 1 exit /b 1 |
| 124 |
|
) |
| 125 |
|
|
| 126 |
|
exit /b 0 |
| 127 |
|
|
| 128 |
|
|
| 129 |
|
@rem Function to execute pcretest and compare the output |
| 130 |
|
@rem Arguments are as follows: |
| 131 |
|
@rem |
| 132 |
|
@rem 1 = test number |
| 133 |
|
@rem 2 = test name (use double quotes) |
| 134 |
|
@rem 3 - 9 = pcretest options |
| 135 |
|
|
| 136 |
|
:runtest |
| 137 |
|
|
| 138 |
|
if [%1] == [] ( |
| 139 |
|
echo Missing test number argument! |
| 140 |
|
exit /b 1 |
| 141 |
|
) |
| 142 |
|
|
| 143 |
|
if [%2] == [] ( |
| 144 |
|
echo Missing test name argument! |
| 145 |
|
exit /b 1 |
| 146 |
|
) |
| 147 |
|
|
| 148 |
|
set testinput=testinput%1 |
| 149 |
|
set testoutput=testoutput%1 |
| 150 |
|
if exist %srcdir%\testdata\win%testinput% ( |
| 151 |
|
set testinput=wintestinput%1 |
| 152 |
|
set testoutput=wintestoutput%1 |
| 153 |
|
) |
| 154 |
|
|
| 155 |
|
echo. |
| 156 |
|
echo Test %1: %2 |
| 157 |
|
|
| 158 |
|
%pcretest% %3 %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% > testout\%testoutput% |
| 159 |
|
if errorlevel 1 ( |
| 160 |
|
echo Test %1: %pcretest% failed! |
| 161 |
|
exit /b 1 |
| 162 |
|
) |
| 163 |
|
|
| 164 |
|
fc /n %srcdir%\testdata\%testoutput% testout\%testoutput% |
| 165 |
|
if errorlevel 1 ( |
| 166 |
|
echo Test %1: file compare failed! |
| 167 |
|
exit /b 1 |
| 168 |
|
) |
| 169 |
|
|
| 170 |
|
echo Test %1: Passed. |
| 171 |
|
echo. |
| 172 |
|
exit /b 0 |
| 173 |
|
|