summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest/worker.py
Commit message (Collapse)AuthorAgeFilesLines
* gh-109413: Enable mypy's `disallow_any_generics` setting when checking ↵sobolevn2024-11-191-1/+1
| | | | `libregrtest` (#127033)
* gh-109413: Add more type hints to `libregrtest` (#126352)sobolevn2024-11-041-1/+1
|
* gh-119727: Add --single-process option to regrtest (#119728)Victor Stinner2024-06-031-3/+3
|
* gh-119273: Don't run test_ioctl in a process group (#119275)Victor Stinner2024-05-291-1/+7
| | | | | Python test runner no longer runs tests using TTY (ex: test_ioctl) in a process group (using setsid()). Previously, tests using TTY were skipped.
* gh-115122: Add --bisect option to regrtest (#115123)Victor Stinner2024-02-181-16/+2
| | | | | | | | * test.bisect_cmd now exit with code 0 on success, and code 1 on failure. Before, it was the opposite. * test.bisect_cmd now runs the test worker process with -X faulthandler. * regrtest RunTests: Add create_python_cmd() and bisect_cmd() methods.
* gh-109413: regrtest: add WorkerRunTests class (#112588)Victor Stinner2023-12-011-3/+3
|
* gh-110722: Make `-m test -T -j` use sys.monitoring (GH-111710)Łukasz Langa2023-11-101-1/+15
| | | | | | | | | | | Now all results from worker processes are aggregated and displayed together as a summary at the end of a regrtest run. The traditional trace is left in place for use with sequential in-process test runs but now raises a warning that those numbers are not precise. `-T -j` requires `--with-pydebug` as it relies on `-Xpresite=`.
* gh-110918: regrtest: allow to intermix --match and --ignore options (GH-110919)Serhiy Storchaka2023-10-211-3/+3
| | | | | | | Test case matching patterns specified by options --match, --ignore, --matchfile and --ignorefile are now tested in the order of specification, and the last match determines whether the test case be run or ignored.
* gh-109566: regrtest _add_python_opts() handles KeyboardInterrupt (#110062)Victor Stinner2023-09-291-3/+6
| | | | | | | | | | In the subprocess code path, wait until the child process completes with a timeout of EXIT_TIMEOUT seconds. Fix create_worker_process() regression: use start_new_session=True if USE_PROCESS_GROUP is true. WorkerThread.wait_stopped() uses a timeout of 60 seconds, instead of 30 seconds.
* gh-109566: Fix regrtest Python options for WASM/WASI (#109954)Victor Stinner2023-09-271-1/+5
| | | | | WASM and WASI buildbots use multiple PYTHON environment variables such as PYTHONPATH and _PYTHON_HOSTRUNNER. Don't use -E if the --python=COMMAND option is used.
* gh-109413: Fix some trivial mypy nitpicks in libregrtest (#109454)Alex Waygood2023-09-151-1/+1
|
* gh-109413: libregrtest: Add and improve type annotations (#109405)Alex Waygood2023-09-141-2/+2
|
* gh-109276: libregrtest: WASM use stdout for JSON (#109355)Victor Stinner2023-09-131-7/+7
| | | | | | | | | | On Emscripten and WASI, or if --python command line is used, libregrtest now writes JSON into stdout, instead of using a name file. * Add JsonFileType.STDOUT. * Remove JsonFileType.FILENAME. * test.pythoninfo logs environment variables related to cross-compilation and running Python on Emscripten/WASI.
* gh-109276: libregrtest: WASM use filename for JSON (#109340)Victor Stinner2023-09-121-27/+16
| | | | | | | | | | | | | | | | On Emscripten and WASI platforms, or if --python command line option is used, libregrtest now uses a filename for the JSON file. Emscripten and WASI buildbot workers run the main test process with a different Python (Linux) which spawns Emscripten/WASI processes using the command specified in --python command line option. Passing a file descriptor from the parent process to the child process doesn't work in this case. * Add JsonFile and JsonFileType classes * Add RunTests.json_file_use_filename() method. * Add a test in test_regrtest on the --python command line option. * test_regrtest: add parallel=False parameter. * Split long RunWorkers._runtest() function into sub-functions.
* gh-109276: libregrtest: fix worker working dir (#109313)Victor Stinner2023-09-121-3/+10
| | | | | | | | | | | | | | Fix Emscripten and WASI: start the test worker process in the Python source code directory, where 'python.js' and 'python.wasm' can be found. Then worker_process() changes to a temporary directory created to run tests. * create_worker_process() uses os_helper.SAVEDCWD as cwd. * worker_process() uses get_temp_dir() as the parent directory for get_work_dir(). * Don't use plural but singual for "test" in "Run 1 test ..." message. * Remove unused imports. * Add WORK_DIR_PREFIX and WORKER_WORK_DIR_PREFIX constants.
* gh-109276: libregrtest: use separated file for JSON (#109277)Victor Stinner2023-09-111-12/+30
| | | | | | | | | | | | | | libregrtest now uses a separated file descriptor to write test result as JSON. Previously, if a test wrote debug messages late around the JSON, the main test process failed to parse JSON. Rename TestResult.write_json() to TestResult.write_json_into(). worker_process() no longer writes an empty line at the end. There is no need to separate test process output from the JSON output anymore, since JSON is now written into a separated file descriptor. create_worker_process() now always spawn the process with close_fds=True.
* gh-109162: libregrtest: use relative imports (#109250)Victor Stinner2023-09-111-4/+4
| | | | libregrtest.__init__ no longer exposes any symbol, so "python -m test.libregrtest.worker" imports less modules.
* gh-109162: libregrtest: rename runtest_mp.py to run_workers.py (#109248)Victor Stinner2023-09-111-2/+2
| | | | | | | | | | | | | | | * Rename runtest_mp.py to run_workers.py * Move exit_timeout() and temp_cwd() context managers from Regrtest.main() to Regrtest.run_tests(). Actions like --list-tests or --list-cases don't need these protections. * Regrtest: remove selected and tests attributes. Pass 'selected' to list_tests(), list_cases() and run_tests(). display_result() now expects a TestTuple, instead of TestList. * Rename setup_tests() to setup_process() and rename setup_support() to setup_tests(). * Move _adjust_resource_limits() to utils and rename it to adjust_rlimit_nofile(). * Move replace_stdout() to utils. * Fix RunTests.verbose type: it's an int.
* gh-109162: libregrtest: add single.py and result.py (#109243)Victor Stinner2023-09-111-3/+5
| | | | | | | | | | | * Add single.py and result.py files. * Rename runtest.py to runtests.py. * Move run_single_test() function and its helper functions to single.py. * Move remove_testfn(), abs_module_name() and normalize_test_name() to utils.py. * Move setup_support() to setup.py. * Move type hints like TestName to utils.py. * Rename runtest.py to runtests.py.
* gh-109162: libregrtest: add worker.py (#109229)Victor Stinner2023-09-101-0/+93
Add new worker.py file: * Move create_worker_process() and worker_process() to this file. * Add main() function to worker.py. create_worker_process() now runs the command: "python -m test.libregrtest.worker JSON". * create_worker_process() now starts the worker process in the current working directory. Regrtest now gets the absolute path of the reflog.txt filename: -R command line option filename. * Remove --worker-json command line option. Remove test_regrtest.test_worker_json(). Related changes: * Add write_json() and from_json() methods to TestResult. * Rename select_temp_dir() to get_temp_dir() and move it to utils. * Rename make_temp_dir() to get_work_dir() and move it to utils. It no longer calls os.makedirs(): Regrtest.main() now calls it. * Move fix_umask() to utils. The function is now called by setup_tests(). * Move StrPath to utils. * Add exit_timeout() context manager to utils. * RunTests: Replace junit_filename (StrPath) with use_junit (bool).