/[pcre]/code/trunk/RunTest.bat
ViewVC logotype

Contents of /code/trunk/RunTest.bat

Parent Directory Parent Directory | Revision Log Revision Log


Revision 719 - (show annotations) (download)
Fri Oct 7 11:41:05 2011 UTC (2 years, 11 months ago) by ph10
File MIME type: text/plain
File size: 11010 byte(s)
Another improved RunTest.bat and also CMakeLists.txt provided by Sheri P.

1 @echo off
2 @rem This file must use CRLF linebreaks to function properly
3 @rem and requires both pcretest and pcregrep
4 @rem This file was originally 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 @rem Sheri P also added override tests for study and jit testing
21
22 setlocal enabledelayedexpansion
23 if [%srcdir%]==[] (
24 if exist testdata\ set srcdir=.)
25 if [%srcdir%]==[] (
26 if exist ..\testdata\ set srcdir=..)
27 if [%srcdir%]==[] (
28 if exist ..\..\testdata\ set srcdir=..\..)
29 if NOT exist "%srcdir%\testdata\" (
30 Error: echo distribution testdata folder not found.
31 call :conferror
32 exit /b 1
33 goto :eof
34 )
35
36 if "%pcregrep%"=="" set pcregrep=.\pcregrep.exe
37 if "%pcretest%"=="" set pcretest=.\pcretest.exe
38
39 echo source dir is %srcdir%
40 echo pcretest=%pcretest%
41 echo pcregrep=%pcregrep%
42
43 if NOT exist "%pcregrep%" (
44 echo Error: "%pcregrep%" not found.
45 echo.
46 call :conferror
47 exit /b 1
48 )
49
50 if NOT exist "%pcretest%" (
51 echo Error: "%pcretest%" not found.
52 echo.
53 call :conferror
54 exit /b 1
55 )
56
57 "%pcretest%" -C|"%pcregrep%" --no-jit "No UTF-8 support">NUL
58 set utf8=%ERRORLEVEL%
59 "%pcretest%" -C|"%pcregrep%" --no-jit "No Unicode properties support">NUL
60 set ucp=%ERRORLEVEL%
61 "%pcretest%" -C|"%pcregrep%" --no-jit "No just-in-time compiler support">NUL
62 set jit=%ERRORLEVEL%
63 "%pcretest%" -C|"%pcregrep%" --no-jit "Internal link size = 2">NUL
64 set link2=%ERRORLEVEL%
65 set ucpandlink2=0
66 if %ucp% EQU 1 (
67 if %link2% EQU 0 set ucpandlink2=1
68 )
69
70 if not exist testout md testout
71 if not exist testoutstudy md testoutstudy
72 if not exist testoutjit md testoutjit
73
74 set do1=no
75 set do2=no
76 set do3=no
77 set do4=no
78 set do5=no
79 set do6=no
80 set do7=no
81 set do8=no
82 set do9=no
83 set do10=no
84 set do11=no
85 set do12=no
86 set do13=no
87 set do14=no
88 set do15=no
89 set all=yes
90
91 for %%a in (%*) do (
92 set valid=no
93 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
94 if "!valid!" == "yes" (
95 set do%%a=yes
96 set all=no
97 ) else (
98 echo Invalid test number - %%a!
99 echo Usage %0 [ test_number ] ...
100 echo Where test_number is one or more optional test numbers 1 through 15, default is all tests.
101 exit /b 1
102 )
103 )
104 set failed="no"
105
106 if "%all%" == "yes" (
107 set do1=yes
108 set do2=yes
109 set do3=yes
110 set do4=yes
111 set do5=yes
112 set do6=yes
113 set do7=yes
114 set do8=yes
115 set do9=yes
116 set do10=yes
117 set do11=yes
118 set do12=yes
119 set do13=yes
120 set do14=yes
121 set do15=yes
122 )
123
124 @echo RunTest.bat's pcretest output is written to newly created subfolders named
125 @echo testout, testoutstudy and testoutjit.
126 @echo.
127 if "%do1%" == "yes" call :do1
128 if "%do2%" == "yes" call :do2
129 if "%do3%" == "yes" call :do3
130 if "%do4%" == "yes" call :do4
131 if "%do5%" == "yes" call :do5
132 if "%do6%" == "yes" call :do6
133 if "%do7%" == "yes" call :do7
134 if "%do8%" == "yes" call :do8
135 if "%do9%" == "yes" call :do9
136 if "%do10%" == "yes" call :do10
137 if "%do11%" == "yes" call :do11
138 if "%do12%" == "yes" call :do12
139 if "%do13%" == "yes" call :do13
140 if "%do14%" == "yes" call :do14
141 if "%do15%" == "yes" call :do15
142 if %failed% == "yes" (
143 echo In above output, one or more of the various tests failed!
144 exit /b 1
145 )
146 echo All OK
147 goto :eof
148
149 :runsub
150 @rem Function to execute pcretest and compare the output
151 @rem Arguments are as follows:
152 @rem
153 @rem 1 = test number
154 @rem 2 = outputdir
155 @rem 3 = test name use double quotes
156 @rem 4 - 9 = pcretest options
157
158 if [%1] == [] (
159 echo Missing test number argument!
160 exit /b 1
161 )
162
163 if [%2] == [] (
164 echo Missing outputdir!
165 exit /b 1
166 )
167
168 if [%3] == [] (
169 echo Missing test name argument!
170 exit /b 1
171 )
172
173 set testinput=testinput%1
174 set testoutput=testoutput%1
175 if exist %srcdir%\testdata\win%testinput% (
176 set testinput=wintestinput%1
177 set testoutput=wintestoutput%1
178 )
179
180 echo Test %1: %3
181 "%pcretest%" %4 %5 %6 %7 %8 %9 "%srcdir%\testdata\%testinput%">%2\%testoutput%
182 if errorlevel 1 (
183 echo. failed executing command-line:
184 echo. "%pcretest%" %4 %5 %6 %7 %8 %9 "%srcdir%\testdata\%testinput%"^>%2\%testoutput%
185 set failed="yes"
186 goto :eof
187 )
188
189 fc /n "%srcdir%\testdata\%testoutput%" "%2\%testoutput%">NUL
190 if errorlevel 1 (
191 echo. failed comparison: fc /n "%srcdir%\testdata\%testoutput%" "%2\%testoutput%"
192 set failed="yes"
193 if [%1]==[2] (
194 echo.
195 echo ** Test 2 requires a lot of stack. PCRE can be configured to
196 echo ** use heap for recursion. Otherwise, to pass Test 2
197 echo ** you generally need to allocate 8 mb stack to PCRE.
198 echo ** See the 'pcrestack' page for a discussion of PCRE's
199 echo ** stack usage.
200 echo.
201 )
202 if [%1]==[3] (
203 echo.
204 echo ** Test 3 failure usually means french locale is not
205 echo ** available on the system, rather than a bug or problem with PCRE.
206 echo.
207 )
208
209 goto :eof
210 )
211
212 echo. Passed.
213 goto :eof
214
215 :do1
216 call :runsub 1 testout "Main functionality - Compatible with Perl 5.8 and above" -q
217 call :runsub 1 testoutstudy "Test with Study Override" -q -s
218 if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -s+
219 goto :eof
220
221 :do2
222 call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
223 call :runsub 2 testoutstudy "Test with Study Override" -q -s
224 if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -s+
225 goto :eof
226
227 :do3
228 call :runsub 3 testout "Locale-specific features" -q
229 call :runsub 3 testoutstudy "Test with Study Override" -q -s
230 if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -s+
231 goto :eof
232
233 :do4
234 if %utf8% EQU 0 (
235 echo Test 4 Skipped due to absence of UTF-8 support.
236 goto :eof
237 )
238 call :runsub 4 testout "UTF-8 support - Compatible with Perl 5.8 and above" -q
239 call :runsub 4 testoutstudy "Test with Study Override" -q -s
240 if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
241 goto :eof
242
243 :do5
244 if %utf8% EQU 0 (
245 echo Test 5 Skipped due to absence of UTF-8 support.
246 goto :eof
247 )
248 call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-8 support" -q
249 call :runsub 5 testoutstudy "Test with Study Override" -q -s
250 if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
251 goto :eof
252
253 :do6
254 if %ucp% EQU 0 (
255 echo Test 6 Skipped due to absence of ucp support.
256 goto :eof
257 )
258 call :runsub 6 testout "Unicode property support - Compatible with Perl 5.10 and above" -q
259 call :runsub 6 testoutstudy "Test with Study Override" -q -s
260 if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
261 goto :eof
262
263 :do7
264 call :runsub 7 testout "DFA matching" -q -dfa
265 call :runsub 7 testoutstudy "Test with Study Override" -q -dfa -s
266 if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -dfa -s+
267 goto :eof
268
269 :do8
270 if %utf8% EQU 0 (
271 echo Test 8 Skipped due to absence of UTF-8 support.
272 goto :eof
273 )
274 call :runsub 8 testout "DFA matching with UTF-8" -q -dfa
275 call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
276 if %jit% EQU 1 call :runsub 8 testoutjit "Test with JIT Override" -q -dfa -s+
277 goto :eof
278
279 :do9
280 if %ucp% EQU 0 (
281 echo Test 9 Skipped due to absence of ucp support.
282 goto :eof
283 )
284 call :runsub 9 testout "DFA matching with Unicode properties" -q -dfa
285 call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
286 if %jit% EQU 1 call :runsub 9 testoutjit "Test with JIT Override" -q -dfa -s+
287 goto :eof
288
289 :do10
290 if %ucpandlink2% EQU 0 (
291 echo Test 10 Skipped due to requirements of ucp support AND link size 2.
292 goto :eof
293 )
294 call :runsub 10 testout "Internal offsets and code size tests" -q
295 call :runsub 10 testoutstudy "Test with Study Override" -q -s
296 if %jit% EQU 1 call :runsub 10 testoutjit "Test with JIT Override" -q -s+
297 goto :eof
298
299 :do11
300 call :runsub 11 testout "Features from Perl 5.10 and above" -q
301 call :runsub 11 testoutstudy "Test with Study Override" -q -s
302 if %jit% EQU 1 call :runsub 11 testoutjit "Test with JIT Override" -q -s+
303 goto :eof
304
305 :do12
306 if %utf8% EQU 0 (
307 echo Test 12 Skipped due to absence of UTF-8 support.
308 goto :eof
309 )
310 call :runsub 12 testout "Features from Perl 5.10 and above w UTF-8" -q
311 call :runsub 12 testoutstudy "Test with Study Override" -q -s
312 if %jit% EQU 1 call :runsub 12 testoutjit "Test with JIT Override" -q -s+
313 goto :eof
314
315 :do13
316 if %ucp% EQU 0 (
317 echo Test 13 Skipped due to absence of ucp support.
318 goto :eof
319 )
320 call :runsub 13 testout "API internals and non-Perl stuff for Unicode property support" -q
321 call :runsub 13 testoutstudy "Test with Study Override" -q -s
322 if %jit% EQU 1 call :runsub 13 testoutjit "Test with JIT Override" -q -s+
323 goto :eof
324
325 :do14
326 if %jit% EQU 0 (
327 echo Test 14 Skipped due to absence of JIT support.
328 goto :eof
329 )
330 call :runsub 14 testout "JIT-specific features - have JIT" -q
331 call :runsub 14 testoutstudy "Test with Study Override" -q -s
332 call :runsub 14 testoutjit "Test with JIT Override" -q -s+
333 goto :eof
334
335 :do15
336 if %jit% EQU 1 (
337 echo Test 15 Skipped due to presence of JIT support.
338 goto :eof
339 )
340 call :runsub 15 testout "JIT-specific features - no JIT" -q
341 call :runsub 15 testoutstudy "Test with Study Override" -q -s
342 goto :eof
343
344 :conferror
345 @echo Configuration error.
346 @echo.
347 @echo If configured with cmake and executed via "make test" or the MSVC "RUN_TESTS"
348 @echo project, pcre_test.bat defines variables and automatically calls RunTest.bat.
349 @echo For manual testing of all available features, after configuring with cmake
350 @echo and building, you can run the built pcre_test.bat. For best results with
351 @echo cmake builds and tests avoid directories with full path names that include
352 @echo spaces for source or build.
353 @echo.
354 @echo Otherwise, if the build dir is in a subdir of the source dir, testdata needed
355 @echo for input and verification should be found automatically when (from the
356 @echo location of the the built exes) you call RunTest.bat. By default RunTest.bat
357 @echo runs all tests compatible with the linked pcre library but it can be given
358 @echo a test number as an argument.
359 @echo.
360 @echo If the build dir is not under the source dir you can either copy your exes
361 @echo to the source folder or copy RunTest.bat and the testdata folder to the
362 @echo location of your built exes and then run RunTest.bat.
363 @echo.
364 goto :eof

Properties

Name Value
svn:keywords "Author Date Id Revision Url"

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12