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