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

Diff of /code/trunk/RunTest.bat

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 699 by ph10, Tue Aug 2 11:00:40 2011 UTC revision 700 by ph10, Tue Sep 20 10:51:26 2011 UTC
# Line 1  Line 1 
1  @echo off  @echo off
2  @rem  This file was contributed by Ralf Junker, and touched up by  @rem This file must use CRLF linebreaks to function properly
3  @rem  Daniel Richard G. Tests 10-12 added by Philip H.  @rem and user must have external findstr command
4  @rem  Philip H also changed test 3 to use "wintest" files.  @rem  This file was contributed by Ralf Junker, and touched up by
5  @rem  @rem  Daniel Richard G. Tests 10-12 added by Philip H.
6  @rem  Updated by Tom Fortmann to support explicit test numbers on the command line.  @rem  Philip H also changed test 3 to use "wintest" files.
7  @rem  Added argument validation and added error reporting.  @rem
8  @rem  @rem  Updated by Tom Fortmann to support explicit test numbers on the command line.
9  @rem  MS Windows batch file to run pcretest on testfiles with the correct  @rem  Added argument validation and added error reporting.
10  @rem  options.  @rem
11  @rem  @rem  MS Windows batch file to run pcretest on testfiles with the correct
12  @rem  Output is written to a newly created subfolder named testout.  @rem  options.
13  @rem  @rem
14    @rem Sheri Pierce added logic to skip feature dependent tests
15  setlocal  @rem tests 4 5 8 and 12 require utf8 support
16    @rem tests 6 9 13 require ucp support
17  if [%srcdir%]==[]   set srcdir=.  @rem 10 requires ucp and link size 2
18  if [%pcretest%]==[] set pcretest=pcretest  @rem 14 requires presense of jit support
19    @rem 15 requires absence of jit support
20  if not exist testout md testout  
21    @rem Sheri P also added override tests for study and jit testing
22  set do1=no  @rem Output is written to newly created subfolders named testout testoutstudy and testoutjit.
23  set do2=no  @rem Current dir should be the build dir. The testdata folder should exist in the current dir or in ..
24  set do3=no  @rem Copy RunTest.bat to the build dir manually if necessary.
25  set do4=no  @rem
26  set do5=no  
27  set do6=no  setlocal enabledelayedexpansion
28  set do7=no  
29  set do8=no  if exist testdata set srcdir=.
30  set do9=no  if [%srcdir%]==[]   set srcdir=..
31  set do10=no  if NOT exist %srcdir%\testdata (
32  set do11=no  echo distribution testdata folder not found.
33  set do12=no  exit /b 1
34  set all=yes  goto :eof
35    )
36  setlocal enabledelayedexpansion  if [%pcretest%]==[] set pcretest=pcretest
37  for %%a in (%*) do (  
38    set valid=no  %pcretest% -C |findstr /C:"No UTF-8 support" >NUL
39    for %%v in (1 2 3 4 5 6 7 8 9 10 11 12) do if %%v == %%a set valid=yes  set utf8=%ERRORLEVEL%
40    if "!valid!" == "yes" (  %pcretest% -C |findstr /C:"No Unicode properties support" >NUL
41      set do%%a=yes  set ucp=%ERRORLEVEL%
42      set all=no  %pcretest% -C |findstr /C:"No just-in-time compiler support" >NUL
43    ) else (  set jit=%ERRORLEVEL%
44      echo Invalid test number - %%a!  %pcretest% -C |findstr /C:"Internal link size = 2" >NUL
45          echo Usage: %0 [ test_number ] ...  set link2=%ERRORLEVEL%
46          echo Where test_number is one or more optional test numbers 1 through 12, default is all tests.  
47          exit /b 1  set ucpandlink2=0
48    )  if %ucp% EQU 1 (
49  )   if %link2% EQU 0 set ucpandlink2=1
50    )
51  if "%all%" == "yes" (  
52    set do1=yes  if not exist testout md testout
53    set do2=yes  if not exist testoutstudy md testoutstudy
54    set do3=yes  if not exist testoutjit md testoutjit
55    set do4=yes  
56    set do5=yes  set do1=no
57    set do6=yes  set do2=no
58    set do7=yes  set do3=no
59    set do8=yes  set do4=no
60    set do9=yes  set do5=no
61    set do10=yes  set do6=no
62    set do11=yes  set do7=no
63    set do12=yes  set do8=no
64  )  set do9=no
65    set do10=no
66  if "%do1%" == "yes" (  set do11=no
67    call :runtest 1 "Main functionality - Compatible with Perl 5.8 and above" -q  set do12=no
68    if errorlevel 1 exit /b 1  set do13=no
69  )  set do14=no
70    set do15=no
71  if "%do2%" == "yes" (  set all=yes
72    call :runtest 2 "API, errors, internals, and non-Perl stuff" -q  
73    if errorlevel 1 exit /b 1  for %%a in (%*) do (
74  )    set valid=no
75      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
76  if "%do3%" == "yes" (    if "!valid!" == "yes" (
77    call :runtest 3 "Locale-specific features" -q      set do%%a=yes
78    if errorlevel 1 exit /b 1      set all=no
79  )  ) else (
80        echo Invalid test number - %%a!
81  if "%do4%" == "yes" (          echo Usage %0 [ test_number ] ...
82    call :runtest 4 "UTF-8 support - Compatible with Perl 5.8 and above" -q          echo Where test_number is one or more optional test numbers 1 through 15, default is all tests.
83    if errorlevel 1 exit /b 1          exit /b 1
84  )  )
85    )
86  if "%do5%" == "yes" (  if "%all%" == "yes" (
87    call :runtest 5 "API, internals, and non-Perl stuff for UTF-8 support" -q    set do1=yes
88    if errorlevel 1 exit /b 1    set do2=yes
89  )    set do3=yes
90      set do4=yes
91  if "%do6%" == "yes" (    set do5=yes
92    call :runtest 6 "Unicode property support - Compatible with Perl 5.10 and above" -q    set do6=yes
93    if errorlevel 1 exit /b 1    set do7=yes
94  )    set do8=yes
95      set do9=yes
96  if "%do7%" == "yes" (    set do10=yes
97    call :runtest 7 "DFA matching" -q -dfa    set do11=yes
98    if errorlevel 1 exit /b 1    set do12=yes
99  )    set do13=yes
100      set do14=yes
101  if "%do8%" == "yes" (    set do15=yes
102    call :runtest 8 "DFA matching with UTF-8" -q -dfa  )
103    if errorlevel 1 exit /b 1  
104  )  if "%do1%" == "yes" call :do1
105    if "%do2%" == "yes" call :do2
106  if "%do9%" == "yes" (  if "%do3%" == "yes" call :do3
107    call :runtest 9 "DFA matching with Unicode properties" -q -dfa  if "%do4%" == "yes" call :do4
108    if errorlevel 1 exit /b 1  if "%do5%" == "yes" call :do5
109  )  if "%do6%" == "yes" call :do6
110    if "%do7%" == "yes" call :do7
111  if "%do10%" == "yes" (  if "%do8%" == "yes" call :do8
112    call :runtest 10 "Internal offsets and code size tests" -q  if "%do9%" == "yes" call :do9
113    if errorlevel 1 exit /b 1  if "%do10%" == "yes" call :do10
114  )  if "%do11%" == "yes" call :do11
115    if "%do12%" == "yes" call :do12
116  if "%do11%" == "yes" (  if "%do13%" == "yes" call :do13
117    call :runtest 11 "Features from Perl 5.10 and above" -q  if "%do14%" == "yes" call :do14
118    if errorlevel 1 exit /b 1  if "%do15%" == "yes" call :do15
119  )  goto :eof
120    
121  if "%do12%" == "yes" (  :runsub
122    call :runtest 12 "API, internals, and non-Perl stuff for Unicode property support" -q  @rem Function to execute pcretest and compare the output
123    if errorlevel 1 exit /b 1  @rem Arguments are as follows:
124  )  @rem
125    @rem       1 = test number
126  exit /b 0  @rem       2 = outputdir
127    @rem       3 = test name use double quotes
128    @rem   4 - 9 = pcretest options
129  @rem Function to execute pcretest and compare the output  
130  @rem Arguments are as follows:  if [%1] == [] (
131  @rem    echo Missing test number argument!
132  @rem       1 = test number    exit /b 1
133  @rem       2 = test name (use double quotes)  )
134  @rem   3 - 9 = pcretest options  
135    if [%2] == [] (
136  :runtest    echo Missing outputdir!
137      exit /b 1
138  if [%1] == [] (  )
139    echo Missing test number argument!  
140    exit /b 1  if [%3] == [] (
141  )    echo Missing test name argument!
142      exit /b 1
143  if [%2] == [] (  )
144    echo Missing test name argument!  
145    exit /b 1  set testinput=testinput%1
146  )  set testoutput=testoutput%1
147    if exist %srcdir%\testdata\win%testinput% (
148  set testinput=testinput%1    set testinput=wintestinput%1
149  set testoutput=testoutput%1    set testoutput=wintestoutput%1
150  if exist %srcdir%\testdata\win%testinput% (  )
151    set testinput=wintestinput%1  
152    set testoutput=wintestoutput%1  echo.
153  )  echo Test %1: %3
154    %pcretest% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput%>%2\%testoutput%
155  echo.  if errorlevel 1 (
156  echo Test %1: %2    echo Test %1: pcretest failed!
157      goto :eof
158  %pcretest% %3 %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% > testout\%testoutput%  )
159  if errorlevel 1 (  
160    echo Test %1: %pcretest% failed!  fc /n %srcdir%\testdata\%testoutput% %2\%testoutput%
161    exit /b 1  if errorlevel 1 (
162  )    echo Test %1: file compare failed!
163      goto :eof
164  fc /n %srcdir%\testdata\%testoutput% testout\%testoutput%  )
165  if errorlevel 1 (  
166    echo Test %1: file compare failed!  echo Test %1: Passed.
167    exit /b 1  echo.
168  )  goto :eof
169    
170  echo Test %1: Passed.  :do1
171  echo.  call :runsub 1 testout "Main functionality - Compatible with Perl 5.8 and above" -q
172  exit /b 0  call :runsub 1 testoutstudy "Test with Study Override" -q -s
173    if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -s+
174    goto :eof
175    
176    :do2
177      call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
178      call :runsub 2 testoutstudy "Test with Study Override" -q -s
179      if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -s+
180    goto :eof
181    
182    :do3
183      call :runsub 3 testout "Locale-specific features" -q
184      call :runsub 3 testoutstudy "Test with Study Override" -q -s
185      if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -s+
186    goto :eof
187    
188    :do4
189      if %utf8% EQU 0 (
190      echo Test 4 Skipped due to absence of UTF-8 support.
191      goto :eof
192    )
193      call :runsub 4 testout "UTF-8 support - Compatible with Perl 5.8 and above" -q
194      call :runsub 4 testoutstudy "Test with Study Override" -q -s
195      if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
196    goto :eof
197    
198    :do5
199      if %utf8% EQU 0 (
200      echo Test 5 Skipped due to absence of UTF-8 support.
201      goto :eof
202    )
203      call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-8 support" -q
204      call :runsub 5 testoutstudy "Test with Study Override" -q -s
205      if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
206    goto :eof
207    
208    :do6
209    if %ucp% EQU 0 (
210      echo Test 6 Skipped due to absence of ucp support.
211      goto :eof
212    )
213      call :runsub 6 testout "Unicode property support - Compatible with Perl 5.10 and above" -q
214      call :runsub 6 testoutstudy "Test with Study Override" -q -s
215      if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
216    goto :eof
217    
218    :do7
219      call :runsub 7 testout "DFA matching" -q -dfa
220      call :runsub 7 testoutstudy "Test with Study Override" -q -dfa -s
221      if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -dfa -s+
222    goto :eof
223    
224    :do8
225      if %utf8% EQU 0 (
226      echo Test 8 Skipped due to absence of UTF-8 support.
227      goto :eof
228    )
229      call :runsub 8 testout "DFA matching with UTF-8" -q -dfa
230      call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
231      if %jit% EQU 1 call :runsub 8 testoutjit "Test with JIT Override" -q -dfa -s+
232      goto :eof
233    
234    :do9
235      if %ucp% EQU 0 (
236      echo Test 9 Skipped due to absence of ucp support.
237      goto :eof
238    )
239      call :runsub 9 testout "DFA matching with Unicode properties" -q -dfa
240      call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
241      if %jit% EQU 1 call :runsub 9 testoutjit "Test with JIT Override" -q -dfa -s+
242    goto :eof
243    
244    :do10
245      if %ucpandlink2% EQU 0 (
246      echo Test 10 Skipped due to requirements of ucp support AND link size 2.
247      goto :eof
248    )
249      call :runsub 10 testout "Internal offsets and code size tests" -q
250      call :runsub 10 testoutstudy "Test with Study Override" -q -s
251      if %jit% EQU 1 call :runsub 10 testoutjit "Test with JIT Override" -q -s+
252    goto :eof
253    
254    :do11
255      call :runsub 11 testout "Features from Perl 5.10 and above" -q
256      call :runsub 11 testoutstudy "Test with Study Override" -q -s
257      if %jit% EQU 1 call :runsub 11 testoutjit "Test with JIT Override" -q -s+
258    goto :eof
259    
260    :do12
261      if %utf8% EQU 0 (
262      echo Test 12 Skipped due to absence of UTF-8 support.
263      goto :eof
264    )
265      call :runsub 12 testout "Features from Perl 5.10 and above w UTF-8" -q
266      call :runsub 12 testoutstudy "Test with Study Override" -q -s
267      if %jit% EQU 1 call :runsub 12 testoutjit "Test with JIT Override" -q -s+
268    goto :eof
269    
270    :do13
271      if %ucp% EQU 0 (
272      echo Test 13 Skipped due to absence of ucp support.
273      goto :eof
274    )
275    call :runsub 13 testout "API internals and non-Perl stuff for Unicode property support" -q
276    call :runsub 13 testoutstudy "Test with Study Override" -q -s
277    if %jit% EQU 1 call :runsub 13 testoutjit "Test with JIT Override" -q -s+
278    goto :eof
279    
280    :do14
281    if %jit% EQU 0 (
282      echo Test 14 Skipped due to absence of JIT support.
283      goto :eof
284    )
285      call :runsub 14 testout "JIT-specific features - have JIT" -q
286      call :runsub 14 testoutstudy "Test with Study Override" -q -s
287      call :runsub 14 testoutjit "Test with JIT Override" -q -s+
288    goto :eof
289    
290    :do15
291      if %jit% EQU 1 (
292      echo Test 15 Skipped due to presence of JIT support.
293      goto :eof
294    )
295      call :runsub 15 testout "JIT-specific features - no JIT" -q
296      call :runsub 15 testoutstudy "Test with Study Override" -q -s
297    goto :eof

Legend:
Removed from v.699  
changed lines
  Added in v.700

webmaster@exim.org
ViewVC Help
Powered by ViewVC 1.1.12