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

Contents of /code/trunk/RunTest.bat

Parent Directory Parent Directory | Revision Log Revision Log


Revision 799 - (hide annotations) (download)
Mon Dec 12 12:07:23 2011 UTC (2 years, 10 months ago) by ph10
File MIME type: text/plain
File size: 10676 byte(s)
A last-minute update to RunTest.bat from Sheri.

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

Properties

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

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12