Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 1 | @echo off |
| 2 | rem Run Tests. Run the regression test suite. |
| 3 | rem Usage: rt [-d] [-O] [-q] [-x64] regrtest_args |
| 4 | rem -d Run Debug build (python_d.exe). Else release build. |
| 5 | rem -O Run python.exe or python_d.exe (see -d) with -O. |
| 6 | rem -q "quick" -- normally the tests are run twice, the first time |
| 7 | rem after deleting all the .pyc files reachable from Lib/. |
| 8 | rem -q runs the tests just once, and without deleting .pyc files. |
| 9 | rem -x64 Run the 64-bit build of python (or python_d if -d was specified) |
| 10 | rem from the 'amd64' dir instead of the 32-bit build in this dir. |
| 11 | rem All leading instances of these switches are shifted off, and |
| 12 | rem whatever remains (up to 9 arguments) is passed to regrtest.py. |
| 13 | rem For example, |
| 14 | rem rt -O -d -x test_thread |
| 15 | rem runs |
| 16 | rem python_d -O ../lib/test/regrtest.py -x test_thread |
| 17 | rem twice, and |
| 18 | rem rt -q -g test_binascii |
| 19 | rem runs |
| 20 | rem python_d ../lib/test/regrtest.py -g test_binascii |
| 21 | rem to generate the expected-output file for binascii quickly. |
| 22 | rem |
| 23 | rem Confusing: if you want to pass a comma-separated list, like |
| 24 | rem -u network,largefile |
| 25 | rem then you have to quote it on the rt line, like |
| 26 | rem rt -u "network,largefile" |
| 27 | |
| 28 | setlocal |
| 29 | |
| 30 | set pcbuild=%~dp0 |
| 31 | set prefix=%pcbuild%win32\ |
| 32 | set suffix= |
| 33 | set qmode= |
| 34 | set dashO= |
| 35 | set regrtestargs= |
| 36 | |
| 37 | :CheckOpts |
| 38 | if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts |
| 39 | if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts |
| 40 | if "%1"=="-d" (set suffix=_d) & shift & goto CheckOpts |
| 41 | if "%1"=="-x64" (set prefix=%pcbuild%amd64\) & shift & goto CheckOpts |
| 42 | if NOT "%1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts |
| 43 | |
| 44 | set exe=%prefix%python%suffix%.exe |
| 45 | set cmd="%exe%" %dashO% -u -Wd -E -bb -m test %regrtestargs% |
| 46 | if defined qmode goto Qmode |
| 47 | |
| 48 | echo Deleting .pyc files ... |
| 49 | "%exe%" "%pcbuild%rmpyc.py" |
| 50 | |
| 51 | echo Cleaning _pth files ... |
| 52 | if exist %prefix%*._pth del %prefix%*._pth |
| 53 | |
| 54 | echo on |
| 55 | %cmd% |
| 56 | @echo off |
| 57 | |
| 58 | echo About to run again without deleting .pyc first: |
| 59 | pause |
| 60 | |
| 61 | :Qmode |
| 62 | echo on |
| 63 | %cmd% |