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