• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 --disable-gil Run free-threaded build.
13rem All leading instances of these switches are shifted off, and
14rem whatever remains (up to 9 arguments) is passed to regrtest.py.
15rem For example,
16rem     rt -O -d -x test_thread
17rem runs
18rem     python_d -O ../lib/test/regrtest.py -x test_thread
19rem twice, and
20rem     rt -q -g test_binascii
21rem runs
22rem     python_d ../lib/test/regrtest.py -g test_binascii
23rem to generate the expected-output file for binascii quickly.
24rem
25rem Confusing:  if you want to pass a comma-separated list, like
26rem     -u network,largefile
27rem then you have to quote it on the rt line, like
28rem     rt -u "network,largefile"
29
30setlocal
31
32set pcbuild=%~dp0
33set pyname=python
34set suffix=
35set qmode=
36set dashO=
37set regrtestargs=--fast-ci
38set exe=
39
40:CheckOpts
41if "%~1"=="-O" (set dashO=-O)     & shift & goto CheckOpts
42if "%~1"=="-q" (set qmode=yes)    & shift & goto CheckOpts
43if "%~1"=="-d" (set suffix=_d)    & shift & goto CheckOpts
44rem HACK: Need some way to infer the version number in this script
45if "%~1"=="--disable-gil" (set pyname=python3.13t) & shift & goto CheckOpts
46if "%~1"=="-win32" (set prefix=%pcbuild%win32) & shift & goto CheckOpts
47if "%~1"=="-x64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts
48if "%~1"=="-amd64" (set prefix=%pcbuild%amd64) & shift & goto CheckOpts
49if "%~1"=="-arm64" (set prefix=%pcbuild%arm64) & shift & goto CheckOpts
50if "%~1"=="-arm32" (set prefix=%pcbuild%arm32) & shift & goto CheckOpts
51if "%~1"=="-p" (call :SetPlatform %~2) & shift & shift & goto CheckOpts
52if NOT "%~1"=="" (set regrtestargs=%regrtestargs% %~1) & shift & goto CheckOpts
53
54if not defined prefix set prefix=%pcbuild%amd64
55set exe=%prefix%\%pyname%%suffix%.exe
56set cmd="%exe%" %dashO% -m test %regrtestargs%
57if defined qmode goto Qmode
58
59echo Deleting .pyc files ...
60"%exe%" "%pcbuild%rmpyc.py"
61
62echo Cleaning _pth files ...
63if exist %prefix%\*._pth del %prefix%\*._pth
64
65echo on
66%cmd%
67@echo off
68
69echo About to run again without deleting .pyc first:
70pause
71goto Qmode
72
73:SetPlatform
74if /I %1 EQU Win32 (set prefix=%pcbuild%win32) & exit /B 0
75if /I %1 EQU x64 (set prefix=%pcbuild%amd64) & exit /B 0
76if /I %1 EQU ARM64 (set prefix=%pcbuild%arm64) & exit /B 0
77if /I %1 EQU ARM (set prefix=%pcbuild%arm32) & exit /B 0
78echo Invalid platform "%1"
79exit /B 1
80
81:Qmode
82echo on
83%cmd%
84