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) |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 10 | rem When omitted, uses %PREFIX% if set or the 32-bit build |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 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 |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 31 | set suffix= |
| 32 | set qmode= |
| 33 | set dashO= |
| 34 | set regrtestargs= |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 35 | set exe= |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 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 |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 41 | if "%1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts |
Miss Islington (bot) | 84d47bd | 2019-06-07 11:17:52 -0700 | [diff] [blame] | 42 | if "%1"=="-arm64" (set prefix=%pcbuild%arm64) & shift & goto CheckOpts |
Paul Monson | 67ff6a1 | 2019-05-15 15:42:29 -0700 | [diff] [blame] | 43 | if "%1"=="-arm32" (set prefix=%pcbuild%arm32) & shift & goto CheckOpts |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 44 | if NOT "%1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts |
| 45 | |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 46 | if not defined prefix set prefix=%pcbuild%win32 |
| 47 | set exe=%prefix%\python%suffix%.exe |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 48 | set cmd="%exe%" %dashO% -u -Wd -E -bb -m test %regrtestargs% |
| 49 | if defined qmode goto Qmode |
| 50 | |
| 51 | echo Deleting .pyc files ... |
| 52 | "%exe%" "%pcbuild%rmpyc.py" |
| 53 | |
| 54 | echo Cleaning _pth files ... |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 55 | if exist %prefix%\*._pth del %prefix%\*._pth |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 56 | |
| 57 | echo on |
| 58 | %cmd% |
| 59 | @echo off |
| 60 | |
| 61 | echo About to run again without deleting .pyc first: |
| 62 | pause |
| 63 | |
| 64 | :Qmode |
| 65 | echo on |
| 66 | %cmd% |