diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-09-20 10:51:26 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-09-20 10:51:26 +0000 |
commit | 78d769a6c3dda0c35b15b4a66c023ec5b4bd5494 (patch) | |
tree | 1c317ad147400992585dea653d4fb7fc010d0fa8 /RunTest.bat | |
parent | 363c1db3479a98e1a894bcd08d4a568bc208d63f (diff) | |
download | pcre-78d769a6c3dda0c35b15b4a66c023ec5b4bd5494.tar.gz |
New RunTest.bat provided by Sheri Pierce.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@700 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'RunTest.bat')
-rw-r--r-- | RunTest.bat | 470 |
1 files changed, 297 insertions, 173 deletions
diff --git a/RunTest.bat b/RunTest.bat index 8d411f4..d937a6d 100644 --- a/RunTest.bat +++ b/RunTest.bat @@ -1,173 +1,297 @@ -@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 - +@echo off
+@rem This file must use CRLF linebreaks to function properly
+@rem and user must have external findstr command
+@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 Sheri Pierce added logic to skip feature dependent tests
+@rem tests 4 5 8 and 12 require utf8 support
+@rem tests 6 9 13 require ucp support
+@rem 10 requires ucp and link size 2
+@rem 14 requires presense of jit support
+@rem 15 requires absence of jit support
+
+@rem Sheri P also added override tests for study and jit testing
+@rem Output is written to newly created subfolders named testout testoutstudy and testoutjit.
+@rem Current dir should be the build dir. The testdata folder should exist in the current dir or in ..
+@rem Copy RunTest.bat to the build dir manually if necessary.
+@rem
+
+setlocal enabledelayedexpansion
+
+if exist testdata set srcdir=.
+if [%srcdir%]==[] set srcdir=..
+if NOT exist %srcdir%\testdata (
+echo distribution testdata folder not found.
+exit /b 1
+goto :eof
+)
+if [%pcretest%]==[] set pcretest=pcretest
+
+%pcretest% -C |findstr /C:"No UTF-8 support" >NUL
+set utf8=%ERRORLEVEL%
+%pcretest% -C |findstr /C:"No Unicode properties support" >NUL
+set ucp=%ERRORLEVEL%
+%pcretest% -C |findstr /C:"No just-in-time compiler support" >NUL
+set jit=%ERRORLEVEL%
+%pcretest% -C |findstr /C:"Internal link size = 2" >NUL
+set link2=%ERRORLEVEL%
+
+set ucpandlink2=0
+if %ucp% EQU 1 (
+ if %link2% EQU 0 set ucpandlink2=1
+)
+
+if not exist testout md testout
+if not exist testoutstudy md testoutstudy
+if not exist testoutjit md testoutjit
+
+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 do13=no
+set do14=no
+set do15=no
+set all=yes
+
+for %%a in (%*) do (
+ set valid=no
+ 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
+ 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 15, 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
+ set do13=yes
+ set do14=yes
+ set do15=yes
+)
+
+if "%do1%" == "yes" call :do1
+if "%do2%" == "yes" call :do2
+if "%do3%" == "yes" call :do3
+if "%do4%" == "yes" call :do4
+if "%do5%" == "yes" call :do5
+if "%do6%" == "yes" call :do6
+if "%do7%" == "yes" call :do7
+if "%do8%" == "yes" call :do8
+if "%do9%" == "yes" call :do9
+if "%do10%" == "yes" call :do10
+if "%do11%" == "yes" call :do11
+if "%do12%" == "yes" call :do12
+if "%do13%" == "yes" call :do13
+if "%do14%" == "yes" call :do14
+if "%do15%" == "yes" call :do15
+goto :eof
+
+:runsub
+@rem Function to execute pcretest and compare the output
+@rem Arguments are as follows:
+@rem
+@rem 1 = test number
+@rem 2 = outputdir
+@rem 3 = test name use double quotes
+@rem 4 - 9 = pcretest options
+
+if [%1] == [] (
+ echo Missing test number argument!
+ exit /b 1
+)
+
+if [%2] == [] (
+ echo Missing outputdir!
+ exit /b 1
+)
+
+if [%3] == [] (
+ 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: %3
+%pcretest% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput%>%2\%testoutput%
+if errorlevel 1 (
+ echo Test %1: pcretest failed!
+ goto :eof
+)
+
+fc /n %srcdir%\testdata\%testoutput% %2\%testoutput%
+if errorlevel 1 (
+ echo Test %1: file compare failed!
+ goto :eof
+)
+
+echo Test %1: Passed.
+echo.
+goto :eof
+
+:do1
+call :runsub 1 testout "Main functionality - Compatible with Perl 5.8 and above" -q
+call :runsub 1 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do2
+ call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
+ call :runsub 2 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do3
+ call :runsub 3 testout "Locale-specific features" -q
+ call :runsub 3 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do4
+ if %utf8% EQU 0 (
+ echo Test 4 Skipped due to absence of UTF-8 support.
+ goto :eof
+)
+ call :runsub 4 testout "UTF-8 support - Compatible with Perl 5.8 and above" -q
+ call :runsub 4 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do5
+ if %utf8% EQU 0 (
+ echo Test 5 Skipped due to absence of UTF-8 support.
+ goto :eof
+)
+ call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-8 support" -q
+ call :runsub 5 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do6
+if %ucp% EQU 0 (
+ echo Test 6 Skipped due to absence of ucp support.
+ goto :eof
+)
+ call :runsub 6 testout "Unicode property support - Compatible with Perl 5.10 and above" -q
+ call :runsub 6 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 6 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do7
+ call :runsub 7 testout "DFA matching" -q -dfa
+ call :runsub 7 testoutstudy "Test with Study Override" -q -dfa -s
+ if %jit% EQU 1 call :runsub 7 testoutjit "Test with JIT Override" -q -dfa -s+
+goto :eof
+
+:do8
+ if %utf8% EQU 0 (
+ echo Test 8 Skipped due to absence of UTF-8 support.
+ goto :eof
+)
+ call :runsub 8 testout "DFA matching with UTF-8" -q -dfa
+ call :runsub 8 testoutstudy "Test with Study Override" -q -dfa -s
+ if %jit% EQU 1 call :runsub 8 testoutjit "Test with JIT Override" -q -dfa -s+
+ goto :eof
+
+:do9
+ if %ucp% EQU 0 (
+ echo Test 9 Skipped due to absence of ucp support.
+ goto :eof
+)
+ call :runsub 9 testout "DFA matching with Unicode properties" -q -dfa
+ call :runsub 9 testoutstudy "Test with Study Override" -q -dfa -s
+ if %jit% EQU 1 call :runsub 9 testoutjit "Test with JIT Override" -q -dfa -s+
+goto :eof
+
+:do10
+ if %ucpandlink2% EQU 0 (
+ echo Test 10 Skipped due to requirements of ucp support AND link size 2.
+ goto :eof
+)
+ call :runsub 10 testout "Internal offsets and code size tests" -q
+ call :runsub 10 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 10 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do11
+ call :runsub 11 testout "Features from Perl 5.10 and above" -q
+ call :runsub 11 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 11 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do12
+ if %utf8% EQU 0 (
+ echo Test 12 Skipped due to absence of UTF-8 support.
+ goto :eof
+)
+ call :runsub 12 testout "Features from Perl 5.10 and above w UTF-8" -q
+ call :runsub 12 testoutstudy "Test with Study Override" -q -s
+ if %jit% EQU 1 call :runsub 12 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do13
+ if %ucp% EQU 0 (
+ echo Test 13 Skipped due to absence of ucp support.
+ goto :eof
+)
+call :runsub 13 testout "API internals and non-Perl stuff for Unicode property support" -q
+call :runsub 13 testoutstudy "Test with Study Override" -q -s
+if %jit% EQU 1 call :runsub 13 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do14
+if %jit% EQU 0 (
+ echo Test 14 Skipped due to absence of JIT support.
+ goto :eof
+)
+ call :runsub 14 testout "JIT-specific features - have JIT" -q
+ call :runsub 14 testoutstudy "Test with Study Override" -q -s
+ call :runsub 14 testoutjit "Test with JIT Override" -q -s+
+goto :eof
+
+:do15
+ if %jit% EQU 1 (
+ echo Test 15 Skipped due to presence of JIT support.
+ goto :eof
+)
+ call :runsub 15 testout "JIT-specific features - no JIT" -q
+ call :runsub 15 testoutstudy "Test with Study Override" -q -s
+goto :eof
|