"Fossies" - the Fresh Open Source Software Archive

Member "pcre2-10.36/RunTest.bat" (22 Nov 2020, 13862 Bytes) of package /linux/misc/pcre2-10.36.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) MS DOS Batch source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "RunTest.bat": 10.35_vs_10.36.

    1 @echo off
    2 @rem
    3 @rem MS Windows batch file to run pcre2test on testfiles with the correct
    4 @rem options. This file must use CRLF linebreaks to function properly,
    5 @rem and requires both pcre2test and pcre2grep.
    6 @rem
    7 @rem ------------------------ HISTORY ----------------------------------
    8 @rem This file was originally contributed to PCRE1 by Ralf Junker, and touched
    9 @rem up by Daniel Richard G. Tests 10-12 added by Philip H.
   10 @rem Philip H also changed test 3 to use "wintest" files.
   11 @rem
   12 @rem Updated by Tom Fortmann to support explicit test numbers on the command
   13 @rem line. Added argument validation and added error reporting.
   14 @rem
   15 @rem Sheri Pierce added logic to skip feature dependent tests
   16 @rem tests 4 5 7 10 12 14 19 and 22 require Unicode support
   17 @rem 8 requires Unicode and link size 2
   18 @rem 16 requires absence of jit support
   19 @rem 17 requires presence of jit support
   20 @rem Sheri P also added override tests for study and jit testing
   21 @rem Zoltan Herczeg added libpcre16 support
   22 @rem Zoltan Herczeg added libpcre32 support
   23 @rem -------------------------------------------------------------------
   24 @rem
   25 @rem The file was converted for PCRE2 by PH, February 2015.
   26 @rem Updated for new test 14 (moving others up a number), August 2015.
   27 @rem Tidied and updated for new tests 21, 22, 23 by PH, October 2015.
   28 @rem PH added missing "set type" for test 22, April 2016.
   29 @rem PH added copy command for new testbtables file, November 2020
   30 
   31 
   32 setlocal enabledelayedexpansion
   33 if [%srcdir%]==[] (
   34 if exist testdata\ set srcdir=.)
   35 if [%srcdir%]==[] (
   36 if exist ..\testdata\ set srcdir=..)
   37 if [%srcdir%]==[] (
   38 if exist ..\..\testdata\ set srcdir=..\..)
   39 if NOT exist %srcdir%\testdata\ (
   40 Error: echo distribution testdata folder not found!
   41 call :conferror
   42 exit /b 1
   43 goto :eof
   44 )
   45 
   46 if [%pcre2test%]==[] set pcre2test=.\pcre2test.exe
   47 
   48 echo source dir is %srcdir%
   49 echo pcre2test=%pcre2test%
   50 
   51 if NOT exist %pcre2test% (
   52 echo Error: %pcre2test% not found!
   53 echo.
   54 call :conferror
   55 exit /b 1
   56 )
   57 
   58 %pcre2test% -C linksize >NUL
   59 set link_size=%ERRORLEVEL%
   60 %pcre2test% -C pcre2-8 >NUL
   61 set support8=%ERRORLEVEL%
   62 %pcre2test% -C pcre2-16 >NUL
   63 set support16=%ERRORLEVEL%
   64 %pcre2test% -C pcre2-32 >NUL
   65 set support32=%ERRORLEVEL%
   66 %pcre2test% -C unicode >NUL
   67 set unicode=%ERRORLEVEL%
   68 %pcre2test% -C jit >NUL
   69 set jit=%ERRORLEVEL%
   70 %pcre2test% -C backslash-C >NUL
   71 set supportBSC=%ERRORLEVEL%
   72 
   73 if %support8% EQU 1 (
   74 if not exist testout8 md testout8
   75 if not exist testoutjit8 md testoutjit8
   76 )
   77 
   78 if %support16% EQU 1 (
   79 if not exist testout16 md testout16
   80 if not exist testoutjit16 md testoutjit16
   81 )
   82 
   83 if %support16% EQU 1 (
   84 if not exist testout32 md testout32
   85 if not exist testoutjit32 md testoutjit32
   86 )
   87 
   88 set do1=no
   89 set do2=no
   90 set do3=no
   91 set do4=no
   92 set do5=no
   93 set do6=no
   94 set do7=no
   95 set do8=no
   96 set do9=no
   97 set do10=no
   98 set do11=no
   99 set do12=no
  100 set do13=no
  101 set do14=no
  102 set do15=no
  103 set do16=no
  104 set do17=no
  105 set do18=no
  106 set do19=no
  107 set do20=no
  108 set do21=no
  109 set do22=no
  110 set do23=no
  111 set all=yes
  112 
  113 for %%a in (%*) do (
  114   set valid=no
  115   for %%v in (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23) do if %%v == %%a set valid=yes
  116   if "!valid!" == "yes" (
  117     set do%%a=yes
  118     set all=no
  119 ) else (
  120     echo Invalid test number - %%a!
  121         echo Usage %0 [ test_number ] ...
  122         echo Where test_number is one or more optional test numbers 1 through 23, default is all tests.
  123         exit /b 1
  124 )
  125 )
  126 set failed="no"
  127 
  128 if "%all%" == "yes" (
  129   set do1=yes
  130   set do2=yes
  131   set do3=yes
  132   set do4=yes
  133   set do5=yes
  134   set do6=yes
  135   set do7=yes
  136   set do8=yes
  137   set do9=yes
  138   set do10=yes
  139   set do11=yes
  140   set do12=yes
  141   set do13=yes
  142   set do14=yes
  143   set do15=yes
  144   set do16=yes
  145   set do17=yes
  146   set do18=yes
  147   set do19=yes
  148   set do20=yes
  149   set do21=yes
  150   set do22=yes
  151   set do23=yes
  152 )
  153 
  154 @echo RunTest.bat's pcre2test output is written to newly created subfolders
  155 @echo named testout{8,16,32} and testoutjit{8,16,32}.
  156 @echo.
  157 
  158 set mode=
  159 set bits=8
  160 
  161 :nextMode
  162 if "%mode%" == "" (
  163   if %support8% EQU 0 goto modeSkip
  164   echo.
  165   echo ---- Testing 8-bit library ----
  166   echo.
  167 )
  168 if "%mode%" == "-16" (
  169   if %support16% EQU 0 goto modeSkip
  170   echo.
  171   echo ---- Testing 16-bit library ----
  172   echo.
  173 )
  174 if "%mode%" == "-32" (
  175   if %support32% EQU 0 goto modeSkip
  176   echo.
  177   echo ---- Testing 32-bit library ----
  178   echo.
  179 )
  180 if "%do1%" == "yes" call :do1
  181 if "%do2%" == "yes" call :do2
  182 if "%do3%" == "yes" call :do3
  183 if "%do4%" == "yes" call :do4
  184 if "%do5%" == "yes" call :do5
  185 if "%do6%" == "yes" call :do6
  186 if "%do7%" == "yes" call :do7
  187 if "%do8%" == "yes" call :do8
  188 if "%do9%" == "yes" call :do9
  189 if "%do10%" == "yes" call :do10
  190 if "%do11%" == "yes" call :do11
  191 if "%do12%" == "yes" call :do12
  192 if "%do13%" == "yes" call :do13
  193 if "%do14%" == "yes" call :do14
  194 if "%do15%" == "yes" call :do15
  195 if "%do16%" == "yes" call :do16
  196 if "%do17%" == "yes" call :do17
  197 if "%do18%" == "yes" call :do18
  198 if "%do19%" == "yes" call :do19
  199 if "%do20%" == "yes" call :do20
  200 if "%do21%" == "yes" call :do21
  201 if "%do22%" == "yes" call :do22
  202 if "%do23%" == "yes" call :do23
  203 :modeSkip
  204 if "%mode%" == "" (
  205   set mode=-16
  206   set bits=16
  207   goto nextMode
  208 )
  209 if "%mode%" == "-16" (
  210   set mode=-32
  211   set bits=32
  212   goto nextMode
  213 )
  214 
  215 @rem If mode is -32, testing is finished
  216 if %failed% == "yes" (
  217 echo In above output, one or more of the various tests failed!
  218 exit /b 1
  219 )
  220 echo All OK
  221 goto :eof
  222 
  223 :runsub
  224 @rem Function to execute pcre2test and compare the output
  225 @rem Arguments are as follows:
  226 @rem
  227 @rem       1 = test number
  228 @rem       2 = outputdir
  229 @rem       3 = test name use double quotes
  230 @rem   4 - 9 = pcre2test options
  231 
  232 if [%1] == [] (
  233   echo Missing test number argument!
  234   exit /b 1
  235 )
  236 
  237 if [%2] == [] (
  238   echo Missing outputdir!
  239   exit /b 1
  240 )
  241 
  242 if [%3] == [] (
  243   echo Missing test name argument!
  244   exit /b 1
  245 )
  246 
  247 if %1 == 8 (
  248   set outnum=8-%bits%-%link_size%
  249 ) else (
  250   set outnum=%1
  251 )
  252 set testinput=testinput%1
  253 set testoutput=testoutput%outnum%
  254 if exist %srcdir%\testdata\win%testinput% (
  255   set testinput=wintestinput%1
  256   set testoutput=wintestoutput%outnum%
  257 )
  258 
  259 echo Test %1: %3
  260 %pcre2test% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% >%2%bits%\%testoutput%
  261 if errorlevel 1 (
  262   echo.          failed executing command-line:
  263   echo.            %pcre2test% %mode% %4 %5 %6 %7 %8 %9 %srcdir%\testdata\%testinput% ^>%2%bits%\%testoutput%
  264   set failed="yes"
  265   goto :eof
  266 ) else if [%1]==[2] (
  267   %pcre2test% %mode% %4 %5 %6 %7 %8 %9 -error -70,-62,-2,-1,0,100,101,191,200 >>%2%bits%\%testoutput%
  268 )
  269 
  270 set type=
  271 if [%1]==[11] (
  272   set type=-%bits%
  273 )
  274 if [%1]==[12] (
  275   set type=-%bits%
  276 )
  277 if [%1]==[14] (
  278   set type=-%bits%
  279 )
  280 if [%1]==[22] (
  281   set type=-%bits%
  282 )
  283 
  284 fc /n %srcdir%\testdata\%testoutput%%type% %2%bits%\%testoutput% >NUL
  285 
  286 if errorlevel 1 (
  287   echo.          failed comparison: fc /n %srcdir%\testdata\%testoutput% %2%bits%\%testoutput%
  288   if [%1]==[3] (
  289     echo.
  290     echo ** Test 3 failure usually means french locale is not
  291     echo ** available on the system, rather than a bug or problem with PCRE2.
  292     echo.
  293     goto :eof
  294 )
  295 
  296   set failed="yes"
  297   goto :eof
  298 )
  299 
  300 echo.          Passed.
  301 goto :eof
  302 
  303 :do1
  304 call :runsub 1 testout "Main non-UTF, non-UCP functionality (Compatible with Perl >= 5.10)" -q
  305 if %jit% EQU 1 call :runsub 1 testoutjit "Test with JIT Override" -q -jit
  306 goto :eof
  307 
  308 :do2
  309   copy /y %srcdir%\testdata\testbtables testbtables
 
  310   call :runsub 2 testout "API, errors, internals, and non-Perl stuff" -q
  311   if %jit% EQU 1 call :runsub 2 testoutjit "Test with JIT Override" -q -jit
  312 goto :eof
  313 
  314 :do3
  315   call :runsub 3 testout "Locale-specific features" -q
  316   if %jit% EQU 1 call :runsub 3 testoutjit "Test with JIT Override" -q -jit
  317 goto :eof
  318 
  319 :do4
  320 if %unicode% EQU 0 (
  321   echo Test 4 Skipped due to absence of Unicode support.
  322   goto :eof
  323 )
  324   call :runsub 4 testout "UTF-%bits% and Unicode property support - (Compatible with Perl >= 5.10)" -q
  325   if %jit% EQU 1 call :runsub 4 testoutjit "Test with JIT Override" -q -jit
  326 goto :eof
  327 
  328 :do5
  329 if %unicode% EQU 0 (
  330   echo Test 5 Skipped due to absence of Unicode support.
  331   goto :eof
  332 )
  333   call :runsub 5 testout "API, internals, and non-Perl stuff for UTF-%bits% and UCP" -q
  334   if %jit% EQU 1 call :runsub 5 testoutjit "Test with JIT Override" -q -jit
  335 goto :eof
  336 
  337 :do6
  338   call :runsub 6 testout "DFA matching main non-UTF, non-UCP functionality" -q
  339 goto :eof
  340 
  341 :do7
  342 if %unicode% EQU 0 (
  343   echo Test 7 Skipped due to absence of Unicode support.
  344   goto :eof
  345 )
  346   call :runsub 7 testout "DFA matching with UTF-%bits% and Unicode property support" -q
  347   goto :eof
  348 
  349 :do8
  350 if NOT %link_size% EQU 2 (
  351   echo Test 8 Skipped because link size is not 2.
  352   goto :eof
  353 )
  354 if %unicode% EQU 0 (
  355   echo Test 8 Skipped due to absence of Unicode support.
  356   goto :eof
  357 )
  358   call :runsub 8 testout "Internal offsets and code size tests" -q
  359 goto :eof
  360 
  361 :do9
  362 if NOT %bits% EQU 8 (
  363   echo Test 9 Skipped when running 16/32-bit tests.
  364   goto :eof
  365 )
  366   call :runsub 9 testout "Specials for the basic 8-bit library" -q
  367   if %jit% EQU 1 call :runsub 9 testoutjit "Test with JIT Override" -q -jit
  368 goto :eof
  369 
  370 :do10
  371 if NOT %bits% EQU 8 (
  372   echo Test 10 Skipped when running 16/32-bit tests.
  373   goto :eof
  374 )
  375 if %unicode% EQU 0 (
  376   echo Test 10 Skipped due to absence of Unicode support.
  377   goto :eof
  378 )
  379   call :runsub 10 testout "Specials for the 8-bit library with Unicode support" -q
  380   if %jit% EQU 1 call :runsub 10 testoutjit "Test with JIT Override" -q -jit
  381 goto :eof
  382 
  383 :do11
  384 if %bits% EQU 8 (
  385   echo Test 11 Skipped when running 8-bit tests.
  386   goto :eof
  387 )
  388   call :runsub 11 testout "Specials for the basic 16/32-bit library" -q
  389   if %jit% EQU 1 call :runsub 11 testoutjit "Test with JIT Override" -q -jit
  390 goto :eof
  391 
  392 :do12
  393 if %bits% EQU 8 (
  394   echo Test 12 Skipped when running 8-bit tests.
  395   goto :eof
  396 )
  397 if %unicode% EQU 0 (
  398   echo Test 12 Skipped due to absence of Unicode support.
  399   goto :eof
  400 )
  401   call :runsub 12 testout "Specials for the 16/32-bit library with Unicode support" -q
  402   if %jit% EQU 1 call :runsub 12 testoutjit "Test with JIT Override" -q -jit
  403 goto :eof
  404 
  405 :do13
  406 if %bits% EQU 8 (
  407   echo Test 13 Skipped when running 8-bit tests.
  408   goto :eof
  409 )
  410   call :runsub 13 testout "DFA specials for the basic 16/32-bit library" -q
  411 goto :eof
  412 
  413 :do14
  414 if %unicode% EQU 0 (
  415   echo Test 14 Skipped due to absence of Unicode support.
  416   goto :eof
  417 )
  418   call :runsub 14 testout "DFA specials for UTF and UCP support" -q
  419   goto :eof
  420 
  421 :do15
  422 call :runsub 15 testout "Non-JIT limits and other non_JIT tests" -q
  423 goto :eof
  424 
  425 :do16
  426 if %jit% EQU 1 (
  427   echo Test 16 Skipped due to presence of JIT support.
  428   goto :eof
  429 )
  430   call :runsub 16 testout "JIT-specific features when JIT is not available" -q
  431 goto :eof
  432 
  433 :do17
  434 if %jit% EQU 0 (
  435   echo Test 17 Skipped due to absence of JIT support.
  436   goto :eof
  437 )
  438   call :runsub 17 testout "JIT-specific features when JIT is available" -q
  439 goto :eof
  440 
  441 :do18
  442 if %bits% EQU 16 (
  443   echo Test 18 Skipped when running 16-bit tests.
  444   goto :eof
  445 )
  446 if %bits% EQU 32 (
  447   echo Test 18 Skipped when running 32-bit tests.
  448   goto :eof
  449 )
  450   call :runsub 18 testout "POSIX interface, excluding UTF-8 and UCP" -q
  451 goto :eof
  452 
  453 :do19
  454 if %bits% EQU 16 (
  455   echo Test 19 Skipped when running 16-bit tests.
  456   goto :eof
  457 )
  458 if %bits% EQU 32 (
  459   echo Test 19 Skipped when running 32-bit tests.
  460   goto :eof
  461 )
  462 if %unicode% EQU 0 (
  463   echo Test 19 Skipped due to absence of Unicode support.
  464   goto :eof
  465 )
  466   call :runsub 19 testout "POSIX interface with UTF-8 and UCP" -q
  467 goto :eof
  468 
  469 :do20
  470 call :runsub 20 testout "Serialization tests" -q
  471 goto :eof
  472 
  473 :do21
  474 if %supportBSC% EQU 0 (
  475   echo Test 21 Skipped due to absence of backslash-C support.
  476   goto :eof
  477 )
  478   call :runsub 21 testout "Backslash-C tests without UTF" -q
  479   call :runsub 21 testout "Backslash-C tests without UTF (DFA)" -q -dfa
  480   if %jit% EQU 1 call :runsub 21 testoutjit "Test with JIT Override" -q -jit
  481 goto :eof
  482 
  483 :do22
  484 if %supportBSC% EQU 0 (
  485   echo Test 22 Skipped due to absence of backslash-C support.
  486   goto :eof
  487 )
  488 if %unicode% EQU 0 (
  489   echo Test 22 Skipped due to absence of Unicode support.
  490   goto :eof
  491 )
  492   call :runsub 22 testout "Backslash-C tests with UTF" -q
  493   if %jit% EQU 1 call :runsub 22 testoutjit "Test with JIT Override" -q -jit
  494 goto :eof
  495 
  496 :do23
  497 if %supportBSC% EQU 1 (
  498   echo Test 23 Skipped due to presence of backslash-C support.
  499   goto :eof
  500 )
  501   call :runsub 23 testout "Backslash-C disabled test" -q
  502 goto :eof
  503 
  504 :conferror
  505 @echo.
  506 @echo Either your build is incomplete or you have a configuration error.
  507 @echo.
  508 @echo If configured with cmake and executed via "make test" or the MSVC "RUN_TESTS"
  509 @echo project, pcre2_test.bat defines variables and automatically calls RunTest.bat.
  510 @echo For manual testing of all available features, after configuring with cmake
  511 @echo and building, you can run the built pcre2_test.bat. For best results with
  512 @echo cmake builds and tests avoid directories with full path names that include
  513 @echo spaces for source or build.
  514 @echo.
  515 @echo Otherwise, if the build dir is in a subdir of the source dir, testdata needed
  516 @echo for input and verification should be found automatically when (from the
  517 @echo location of the the built exes) you call RunTest.bat. By default RunTest.bat
  518 @echo runs all tests compatible with the linked pcre2 library but it can be given
  519 @echo a test number as an argument.
  520 @echo.
  521 @echo If the build dir is not under the source dir you can either copy your exes
  522 @echo to the source folder or copy RunTest.bat and the testdata folder to the
  523 @echo location of your built exes and then run RunTest.bat.
  524 @echo.
  525 goto :eof