blob: 59f757c0f5888add193905648ea39be12d8a03d4 [file] [log] [blame]
Zachary Ware6b6e6872017-06-10 14:58:42 -05001@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 -x64 Run the 64-bit build of python (or python_d if -d was specified)
Steve Dowere5f41d22018-05-16 17:50:29 -040010rem When omitted, uses %PREFIX% if set or the 32-bit build
Zachary Ware6b6e6872017-06-10 14:58:42 -050011rem All leading instances of these switches are shifted off, and
12rem whatever remains (up to 9 arguments) is passed to regrtest.py.
13rem For example,
14rem rt -O -d -x test_thread
15rem runs
16rem python_d -O ../lib/test/regrtest.py -x test_thread
17rem twice, and
18rem rt -q -g test_binascii
19rem runs
20rem python_d ../lib/test/regrtest.py -g test_binascii
21rem to generate the expected-output file for binascii quickly.
22rem
23rem Confusing: if you want to pass a comma-separated list, like
24rem -u network,largefile
25rem then you have to quote it on the rt line, like
26rem rt -u "network,largefile"
27
28setlocal
29
30set pcbuild=%~dp0
Zachary Ware6b6e6872017-06-10 14:58:42 -050031set suffix=
32set qmode=
33set dashO=
34set regrtestargs=
Steve Dowere5f41d22018-05-16 17:50:29 -040035set exe=
Zachary Ware6b6e6872017-06-10 14:58:42 -050036
37:CheckOpts
38if "%1"=="-O" (set dashO=-O) & shift & goto CheckOpts
39if "%1"=="-q" (set qmode=yes) & shift & goto CheckOpts
40if "%1"=="-d" (set suffix=_d) & shift & goto CheckOpts
Steve Dowere5f41d22018-05-16 17:50:29 -040041if "%1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts
Paul Monsone7e50392019-06-07 10:58:41 -070042if "%1"=="-arm64" (set prefix=%pcbuild%arm64) & shift & goto CheckOpts
Paul Monson67ff6a12019-05-15 15:42:29 -070043if "%1"=="-arm32" (set prefix=%pcbuild%arm32) & shift & goto CheckOpts
Zachary Ware6b6e6872017-06-10 14:58:42 -050044if NOT "%1"=="" (set regrtestargs=%regrtestargs% %1) & shift & goto CheckOpts
45
Steve Dowere5f41d22018-05-16 17:50:29 -040046if not defined prefix set prefix=%pcbuild%win32
47set exe=%prefix%\python%suffix%.exe
Zachary Ware6b6e6872017-06-10 14:58:42 -050048set cmd="%exe%" %dashO% -u -Wd -E -bb -m test %regrtestargs%
49if defined qmode goto Qmode
50
51echo Deleting .pyc files ...
52"%exe%" "%pcbuild%rmpyc.py"
53
54echo Cleaning _pth files ...
Steve Dowere5f41d22018-05-16 17:50:29 -040055if exist %prefix%\*._pth del %prefix%\*._pth
Zachary Ware6b6e6872017-06-10 14:58:42 -050056
57echo on
58%cmd%
59@echo off
60
61echo About to run again without deleting .pyc first:
62pause
63
64:Qmode
65echo on
66%cmd%