summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2023-09-30 22:37:23 (GMT)
committerGitHub <noreply@github.com>2023-09-30 22:37:23 (GMT)
commit53eb9a676f8c59b206dfc536b7590f6563ad65e0 (patch)
tree818bf98fb768d9f230b6375b9fff7102ce6849dc /Tools
parentd3728ddc572fff7ffcc95301bf5265717dbaf476 (diff)
downloadcpython-53eb9a676f8c59b206dfc536b7590f6563ad65e0.zip
cpython-53eb9a676f8c59b206dfc536b7590f6563ad65e0.tar.gz
cpython-53eb9a676f8c59b206dfc536b7590f6563ad65e0.tar.bz2
gh-110152: regrtest handles cross compilation and HOSTRUNNER (#110156)
* _add_python_opts() now handles cross compilation and HOSTRUNNER. * display_header() now tells if Python is cross-compiled, display HOSTRUNNER, and get the host platform. * Remove Tools/scripts/run_tests.py script. * Remove "make hostrunnertest": use "make buildbottest" or "make test" instead.
Diffstat (limited to 'Tools')
-rw-r--r--Tools/scripts/run_tests.py78
1 files changed, 0 insertions, 78 deletions
diff --git a/Tools/scripts/run_tests.py b/Tools/scripts/run_tests.py
deleted file mode 100644
index 3e3d15d..0000000
--- a/Tools/scripts/run_tests.py
+++ /dev/null
@@ -1,78 +0,0 @@
-"""Run Python's test suite in a fast, rigorous way.
-
-The defaults are meant to be reasonably thorough, while skipping certain
-tests that can be time-consuming or resource-intensive (e.g. largefile),
-or distracting (e.g. audio and gui). These defaults can be overridden by
-simply passing a -u option to this script.
-
-"""
-
-import os
-import shlex
-import sys
-import sysconfig
-import test.support
-
-
-def is_multiprocess_flag(arg):
- return arg.startswith('-j') or arg.startswith('--multiprocess')
-
-
-def is_python_flag(arg):
- return arg.startswith('-p') or arg.startswith('--python')
-
-
-def main(regrtest_args):
- args = [sys.executable]
-
- cross_compile = '_PYTHON_HOST_PLATFORM' in os.environ
- if (hostrunner := os.environ.get("_PYTHON_HOSTRUNNER")) is None:
- hostrunner = sysconfig.get_config_var("HOSTRUNNER")
- if cross_compile:
- # emulate -E, but keep PYTHONPATH + cross compile env vars, so
- # test executable can load correct sysconfigdata file.
- keep = {
- '_PYTHON_PROJECT_BASE',
- '_PYTHON_HOST_PLATFORM',
- '_PYTHON_SYSCONFIGDATA_NAME',
- 'PYTHONPATH'
- }
- environ = {
- name: value for name, value in os.environ.items()
- if not name.startswith(('PYTHON', '_PYTHON')) or name in keep
- }
- else:
- environ = os.environ.copy()
-
- # Allow user-specified interpreter options to override our defaults.
- args.extend(test.support.args_from_interpreter_flags())
-
- args.extend(['-m', 'test', # Run the test suite
- '--fast-ci', # Fast Continuous Integration mode
- ])
- if not any(is_multiprocess_flag(arg) for arg in regrtest_args):
- if cross_compile and hostrunner:
- # For now use only two cores for cross-compiled builds;
- # hostrunner can be expensive.
- args.extend(['-j', '2'])
-
- if cross_compile and hostrunner:
- # If HOSTRUNNER is set and -p/--python option is not given, then
- # use hostrunner to execute python binary for tests.
- if not any(is_python_flag(arg) for arg in regrtest_args):
- buildpython = sysconfig.get_config_var("BUILDPYTHON")
- args.extend(["--python", f"{hostrunner} {buildpython}"])
-
- args.extend(regrtest_args)
-
- print(shlex.join(args), flush=True)
-
- if sys.platform == 'win32':
- from subprocess import call
- sys.exit(call(args))
- else:
- os.execve(sys.executable, args, environ)
-
-
-if __name__ == '__main__':
- main(sys.argv[1:])