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

Contents of /code/trunk/RunTest.bat

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5