Revision: 622
http://vcs.pcre.org/viewvc?view=rev&revision=622
Author: ph10
Date: 2011-07-18 11:46:51 +0100 (Mon, 18 Jul 2011)
Log Message:
-----------
Updated RunTest.bat to Tom Fortmann's improved version.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/RunTest.bat
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2011-07-18 10:14:09 UTC (rev 621)
+++ code/trunk/ChangeLog 2011-07-18 10:46:51 UTC (rev 622)
@@ -144,6 +144,11 @@
group 1 called group 2 while simultaneously a separate group 2 called group
1). A stack overflow occurred in this case. I have fixed this by limiting
the recursion depth to 10.
+
+26. Updated RunTest.bat in the distribution to the version supplied by Tom
+ Fortmann. This supports explicit test numbers on the command line, and has
+ argument validation and error reporting.
+
Version 8.12 15-Jan-2011
Modified: code/trunk/RunTest.bat
===================================================================
--- code/trunk/RunTest.bat 2011-07-18 10:14:09 UTC (rev 621)
+++ code/trunk/RunTest.bat 2011-07-18 10:46:51 UTC (rev 622)
@@ -1,3 +1,4 @@
+@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.
@@ -2,6 +3,10 @@
@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 "testdata".
+@rem Output is written to a newly created subfolder named testout.
+@rem
@@ -14,30 +19,155 @@
if not exist testout md testout
-%pcretest% -q %srcdir%\testdata\testinput1 > testout\testoutput1
-%pcretest% -q %srcdir%\testdata\testinput2 > testout\testoutput2
-@rem %pcretest% -q %srcdir%\testdata\testinput3 > testout\testoutput3
-%pcretest% -q %srcdir%\testdata\wintestinput3 > testout\wintestoutput3
-%pcretest% -q %srcdir%\testdata\testinput4 > testout\testoutput4
-%pcretest% -q %srcdir%\testdata\testinput5 > testout\testoutput5
-%pcretest% -q %srcdir%\testdata\testinput6 > testout\testoutput6
-%pcretest% -q -dfa %srcdir%\testdata\testinput7 > testout\testoutput7
-%pcretest% -q -dfa %srcdir%\testdata\testinput8 > testout\testoutput8
-%pcretest% -q -dfa %srcdir%\testdata\testinput9 > testout\testoutput9
-%pcretest% -q %srcdir%\testdata\testinput10 > testout\testoutput10
-%pcretest% -q %srcdir%\testdata\testinput11 > testout\testoutput11
-%pcretest% -q %srcdir%\testdata\testinput12 > testout\testoutput12
+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
-fc /n %srcdir%\testdata\testoutput1 testout\testoutput1
-fc /n %srcdir%\testdata\testoutput2 testout\testoutput2
-rem fc /n %srcdir%\testdata\testoutput3 testout\testoutput3
-fc /n %srcdir%\testdata\wintestoutput3 testout\wintestoutput3
-fc /n %srcdir%\testdata\testoutput4 testout\testoutput4
-fc /n %srcdir%\testdata\testoutput5 testout\testoutput5
-fc /n %srcdir%\testdata\testoutput6 testout\testoutput6
-fc /n %srcdir%\testdata\testoutput7 testout\testoutput7
-fc /n %srcdir%\testdata\testoutput8 testout\testoutput8
-fc /n %srcdir%\testdata\testoutput9 testout\testoutput9
-fc /n %srcdir%\testdata\testoutput10 testout\testoutput10
-fc /n %srcdir%\testdata\testoutput11 testout\testoutput11
-fc /n %srcdir%\testdata\testoutput12 testout\testoutput12
+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
+