(self, regrtest_opts)
| 595 | return self._run_tests(selected, tests) |
| 596 | |
| 597 | def _add_cross_compile_opts(self, regrtest_opts): |
| 598 | # WASM/WASI buildbot builders pass multiple PYTHON environment |
| 599 | # variables such as PYTHONPATH and _PYTHON_HOSTRUNNER. |
| 600 | keep_environ = bool(self.python_cmd) |
| 601 | environ = None |
| 602 | |
| 603 | # Are we using cross-compilation? |
| 604 | cross_compile = is_cross_compiled() |
| 605 | |
| 606 | # Get HOSTRUNNER |
| 607 | hostrunner = get_host_runner() |
| 608 | |
| 609 | if cross_compile: |
| 610 | # emulate -E, but keep PYTHONPATH + cross compile env vars, |
| 611 | # so test executable can load correct sysconfigdata file. |
| 612 | keep = { |
| 613 | '_PYTHON_PROJECT_BASE', |
| 614 | '_PYTHON_HOST_PLATFORM', |
| 615 | '_PYTHON_SYSCONFIGDATA_NAME', |
| 616 | "_PYTHON_SYSCONFIGDATA_PATH", |
| 617 | 'PYTHONPATH' |
| 618 | } |
| 619 | old_environ = os.environ |
| 620 | new_environ = { |
| 621 | name: value for name, value in os.environ.items() |
| 622 | if not name.startswith(('PYTHON', '_PYTHON')) or name in keep |
| 623 | } |
| 624 | # Only set environ if at least one variable was removed |
| 625 | if new_environ != old_environ: |
| 626 | environ = new_environ |
| 627 | keep_environ = True |
| 628 | |
| 629 | if cross_compile and hostrunner: |
| 630 | if self.num_workers == 0 and not self.single_process: |
| 631 | # For now use only two cores for cross-compiled builds; |
| 632 | # hostrunner can be expensive. |
| 633 | regrtest_opts.extend(['-j', '2']) |
| 634 | |
| 635 | # If HOSTRUNNER is set and -p/--python option is not given, then |
| 636 | # use hostrunner to execute python binary for tests. |
| 637 | if not self.python_cmd: |
| 638 | buildpython = sysconfig.get_config_var("BUILDPYTHON") |
| 639 | python_cmd = f"{hostrunner} {buildpython}" |
| 640 | regrtest_opts.extend(["--python", python_cmd]) |
| 641 | keep_environ = True |
| 642 | |
| 643 | return (environ, keep_environ) |
| 644 | |
| 645 | def _add_ci_python_opts(self, python_opts, keep_environ): |
| 646 | # --fast-ci and --slow-ci add options to Python. |
no test coverage detected