[3.13] gh-126925: Modify how iOS test results are gathered (GH-127592) (#127754)

Adds a `use_system_log` config item to enable stdout/stderr redirection for
Apple platforms. This log streaming is then used by a new iOS test runner
script, allowing the display of test suite output at runtime. The iOS test
runner script can be used by any Python project, not just the CPython test
suite.
(cherry picked from commit 2041a95e68)
This commit is contained in:
Russell Keith-Magee 2024-12-09 14:39:11 +08:00 committed by GitHub
parent b56100c77a
commit 075c41d5f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 782 additions and 58 deletions

View file

@ -129,6 +129,10 @@ static const PyConfigSpec PYCONFIG_SPEC[] = {
#ifdef Py_DEBUG
SPEC(run_presite, WSTR_OPT),
#endif
#ifdef __APPLE__
SPEC(use_system_logger, BOOL),
#endif
{NULL, 0, 0},
};
@ -744,6 +748,9 @@ config_check_consistency(const PyConfig *config)
assert(config->cpu_count != 0);
// config->use_frozen_modules is initialized later
// by _PyConfig_InitImportConfig().
#ifdef __APPLE__
assert(config->use_system_logger >= 0);
#endif
#ifdef Py_STATS
assert(config->_pystats >= 0);
#endif
@ -846,6 +853,9 @@ _PyConfig_InitCompatConfig(PyConfig *config)
config->_is_python_build = 0;
config->code_debug_ranges = 1;
config->cpu_count = -1;
#ifdef __APPLE__
config->use_system_logger = 0;
#endif
#ifdef Py_GIL_DISABLED
config->enable_gil = _PyConfig_GIL_DEFAULT;
#endif
@ -874,6 +884,9 @@ config_init_defaults(PyConfig *config)
#ifdef MS_WINDOWS
config->legacy_windows_stdio = 0;
#endif
#ifdef __APPLE__
config->use_system_logger = 0;
#endif
}
@ -909,6 +922,9 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
#ifdef MS_WINDOWS
config->legacy_windows_stdio = 0;
#endif
#ifdef __APPLE__
config->use_system_logger = 0;
#endif
}