| 1 |
@echo off
|
| 2 |
@rem This file was contributed by Ralf Junker, and touched up by
|
| 3 |
@rem Daniel Richard G. Tests 10-12 added by Philip H.
|
| 4 |
@rem Philip H also changed test 3 to use "wintest" files.
|
| 5 |
@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
|
| 10 |
@rem options.
|
| 11 |
@rem
|
| 12 |
@rem Output is written to a newly created subfolder named testout.
|
| 13 |
@rem
|
| 14 |
|
| 15 |
setlocal
|
| 16 |
|
| 17 |
if [%srcdir%]==[] set srcdir=.
|
| 18 |
if [%pcretest%]==[] set pcretest=pcretest
|
| 19 |
|
| 20 |
if not exist testout md testout
|
| 21 |
|
| 22 |
set do1=no
|
| 23 |
set do2=no
|
| 24 |
set do3=no
|
| 25 |
set do4=no
|
| 26 |
set do5=no
|
| 27 |
set do6=no
|
| 28 |
set do7=no
|
| 29 |
set do8=no
|
| 30 |
set do9=no
|
| 31 |
set do10=no
|
| 32 |
set do11=no
|
| 33 |
set do12=no
|
| 34 |
set all=yes
|
| 35 |
|
| 36 |
setlocal enabledelayedexpansion
|
| 37 |
for %%a in (%*) do (
|
| 38 |
set valid=no
|
| 39 |
for %%v in (1 2 3 4 5 6 7 8 9 10 11 12) do if %%v == %%a set valid=yes
|
| 40 |
if "!valid!" == "yes" (
|
| 41 |
set do%%a=yes
|
| 42 |
set all=no
|
| 43 |
) else (
|
| 44 |
echo Invalid test number - %%a!
|
| 45 |
echo Usage: %0 [ test_number ] ...
|
| 46 |
echo Where test_number is one or more optional test numbers 1 through 12, default is all tests.
|
| 47 |
exit /b 1
|
| 48 |
)
|
| 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 |
|