summaryrefslogtreecommitdiff
path: root/RunTest.bat
blob: 8d411f46b08cccd7b843705213a56054be9fc666 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
@echo off
@rem  This file was contributed by Ralf Junker, and touched up by
@rem  Daniel Richard G. Tests 10-12 added by Philip H.
@rem  Philip H also changed test 3 to use "wintest" files.
@rem
@rem  Updated by Tom Fortmann to support explicit test numbers on the command line.
@rem  Added argument validation and added error reporting.
@rem
@rem  MS Windows batch file to run pcretest on testfiles with the correct
@rem  options.
@rem
@rem  Output is written to a newly created subfolder named testout.
@rem

setlocal

if [%srcdir%]==[]   set srcdir=.
if [%pcretest%]==[] set pcretest=pcretest

if not exist testout md testout

set do1=no
set do2=no
set do3=no
set do4=no
set do5=no
set do6=no
set do7=no
set do8=no
set do9=no
set do10=no
set do11=no
set do12=no
set all=yes

setlocal enabledelayedexpansion
for %%a in (%*) do (
  set valid=no
  for %%v in (1 2 3 4 5 6 7 8 9 10 11 12) do if %%v == %%a set valid=yes
  if "!valid!" == "yes" (
    set do%%a=yes
    set all=no
  ) else (
    echo Invalid test number - %%a!
        echo Usage: %0 [ test_number ] ...
        echo Where test_number is one or more optional test numbers 1 through 12, default is all tests.
        exit /b 1
  )
)

if "%all%" == "yes" (
  set do1=yes
  set do2=yes
  set do3=yes
  set do4=yes
  set do5=yes
  set do6=yes
  set do7=yes
  set do8=yes
  set do9=yes
  set do10=yes
  set do11=yes
  set do12=yes
)

if "%do1%" == "yes" (
  call :runtest 1 "Main functionality - Compatible with Perl 5.8 and above" -q
  if errorlevel 1 exit /b 1
)

if "%do2%" == "yes" (
  call :runtest 2 "API, errors, internals, and non-Perl stuff" -q
  if errorlevel 1 exit /b 1
)

if "%do3%" == "yes" (
  call :runtest 3 "Locale-specific features" -q
  if errorlevel 1 exit /b 1
)

if "%do4%" == "yes" (
  call :runtest 4 "UTF-8 support - Compatible with Perl 5.8 and above" -q
  if errorlevel 1 exit /b 1
)

if "%do5%" == "yes" (
  call :runtest 5 "API, internals, and non-Perl stuff for UTF-8 support" -q
  if errorlevel 1 exit /b 1
)

if "%do6%" == "yes" (
  call :runtest 6 "Unicode property support - Compatible with Perl 5.10 and above" -q
  if errorlevel 1 exit /b 1
)

if "%do7%" == "yes" (
  call :runtest 7 "DFA matching" -q -dfa
  if errorlevel 1 exit /b 1
)

if "%do8%" == "yes" (
  call :runtest 8 "DFA matching with UTF-8" -q -dfa
  if errorlevel 1 exit /b 1
)

if "%do9%" == "yes" (
  call :runtest 9 "DFA matching with Unicode properties" -q -dfa
  if errorlevel 1 exit /b 1
)

if "%do10%" == "yes" (
  call :runtest 10 "Internal offsets and code size tests" -q
  if errorlevel 1 exit /b 1
)

if "%do11%" == "yes" (
  call :runtest 11 "Features from Perl 5.10 and above" -q
  if errorlevel 1 exit /b 1
)

if "%do12%" == "yes" (
  call :runtest 12 "API, internals, and non-Perl stuff for Unicode property support" -q
  if errorlevel 1 exit /b 1
)

exit /b 0


@rem Function to execute pcretest and compare the output
@rem Arguments are as follows:
@rem
@rem       1 = test number
@rem       2 = test name (use double quotes)
@rem   3 - 9 = pcretest options

:runtest

if [%1] == [] (
  echo Missing test number argument!
  exit /b 1
)

if [%2] == [] (
  echo Missing test name argument!
  exit /b 1
)

set testinput=testinput%1
set testoutput=testoutput%1
if exist %srcdir%\testdata\win%testinput% (
  set testinput=wintestinput%1
  set testoutput=wintestoutput%1
)

echo.
echo Test %1: %2

%pcretest% %3 %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% > testout\%testoutput%
if errorlevel 1 (
  echo Test %1: %pcretest% failed!
  exit /b 1
)

fc /n %srcdir%\testdata\%testoutput% testout\%testoutput%
if errorlevel 1 (
  echo Test %1: file compare failed!
  exit /b 1
)

echo Test %1: Passed.
echo.
exit /b 0