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. |
Steve Dower | 2156d96 | 2020-11-18 17:24:36 +0000 | [diff] [blame] | 9 | rem -p <Win32|x64|ARM|ARM64> or -win32, -x64, -arm32, -arm64 |
| 10 | rem Run the specified architecture of python (or python_d if -d |
| 11 | rem was specified). If omitted, uses %PREFIX% if set or 64-bit. |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 12 | rem All leading instances of these switches are shifted off, and |
| 13 | rem whatever remains (up to 9 arguments) is passed to regrtest.py. |
| 14 | rem For example, |
| 15 | rem rt -O -d -x test_thread |
| 16 | rem runs |
| 17 | rem python_d -O ../lib/test/regrtest.py -x test_thread |
| 18 | rem twice, and |
| 19 | rem rt -q -g test_binascii |
| 20 | rem runs |
| 21 | rem python_d ../lib/test/regrtest.py -g test_binascii |
| 22 | rem to generate the expected-output file for binascii quickly. |
| 23 | rem |
| 24 | rem Confusing: if you want to pass a comma-separated list, like |
| 25 | rem -u network,largefile |
| 26 | rem then you have to quote it on the rt line, like |
| 27 | rem rt -u "network,largefile" |
| 28 | |
| 29 | setlocal |
| 30 | |
| 31 | set pcbuild=%~dp0 |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 32 | set suffix= |
| 33 | set qmode= |
| 34 | set dashO= |
| 35 | set regrtestargs= |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 36 | set exe= |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 37 | |
| 38 | :CheckOpts |
| 39 | if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts |
| 40 | if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts |
| 41 | if "%1"=="-d" (set suffix=_d) & shift & goto CheckOpts |
Steve Dower | 2156d96 | 2020-11-18 17:24:36 +0000 | [diff] [blame] | 42 | if "%1"=="-win32" (set prefix=%pcbuild%win32) & shift & goto CheckOpts |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 43 | if "%1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts |
Paul Monson | e7e5039 | 2019-06-07 10:58:41 -0700 | [diff] [blame] | 44 | if "%1"=="-arm64" (set prefix=%pcbuild%arm64) & shift & goto CheckOpts |
Paul Monson | 67ff6a1 | 2019-05-15 15:42:29 -0700 | [diff] [blame] | 45 | if "%1"=="-arm32" (set prefix=%pcbuild%arm32) & shift & goto CheckOpts |
Steve Dower | 2156d96 | 2020-11-18 17:24:36 +0000 | [diff] [blame] | 46 | if "%1"=="-p" (call :SetPlatform %~2) & shift & shift & goto CheckOpts |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 47 | if NOT "%1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts |
| 48 | |
Steve Dower | 2156d96 | 2020-11-18 17:24:36 +0000 | [diff] [blame] | 49 | if not defined prefix set prefix=%pcbuild%amd64 |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 50 | set exe=%prefix%\python%suffix%.exe |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 51 | set cmd="%exe%" %dashO% -u -Wd -E -bb -m test %regrtestargs% |
| 52 | if defined qmode goto Qmode |
| 53 | |
| 54 | echo Deleting .pyc files ... |
| 55 | "%exe%" "%pcbuild%rmpyc.py" |
| 56 | |
| 57 | echo Cleaning _pth files ... |
Steve Dower | e5f41d2 | 2018-05-16 17:50:29 -0400 | [diff] [blame] | 58 | if exist %prefix%\*._pth del %prefix%\*._pth |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 59 | |
| 60 | echo on |
| 61 | %cmd% |
| 62 | @echo off |
| 63 | |
| 64 | echo About to run again without deleting .pyc first: |
| 65 | pause |
Steve Dower | 2156d96 | 2020-11-18 17:24:36 +0000 | [diff] [blame] | 66 | goto Qmode |
| 67 | |
| 68 | :SetPlatform |
| 69 | if /I %1 EQU Win32 (set prefix=%pcbuild%win32) & exit /B 0 |
| 70 | if /I %1 EQU x64 (set prefix=%pcbuild%amd64) & exit /B 0 |
| 71 | if /I %1 EQU ARM64 (set prefix=%pcbuild%arm64) & exit /B 0 |
| 72 | if /I %1 EQU ARM (set prefix=%pcbuild%arm32) & exit /B 0 |
| 73 | echo Invalid platform "%1" |
| 74 | exit /B 1 |
Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame] | 75 | |
| 76 | :Qmode |
| 77 | echo on |
| 78 | %cmd% |