mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
test.pythoninfo logs more build info (GH-93225)
Log also test.support.check_sanitizer() values.
(cherry picked from commit 06dd26f89f
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
4d863453f8
commit
9555d77953
1 changed files with 47 additions and 3 deletions
|
@ -10,6 +10,9 @@ import unittest
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
|
MS_WINDOWS = (sys.platform == 'win32')
|
||||||
|
|
||||||
|
|
||||||
def normalize_text(text):
|
def normalize_text(text):
|
||||||
if text is None:
|
if text is None:
|
||||||
return None
|
return None
|
||||||
|
@ -127,13 +130,21 @@ def collect_sys(info_add):
|
||||||
encoding = '%s/%s' % (encoding, errors)
|
encoding = '%s/%s' % (encoding, errors)
|
||||||
info_add('sys.%s.encoding' % name, encoding)
|
info_add('sys.%s.encoding' % name, encoding)
|
||||||
|
|
||||||
# Were we compiled --with-pydebug or with #define Py_DEBUG?
|
# Were we compiled --with-pydebug?
|
||||||
Py_DEBUG = hasattr(sys, 'gettotalrefcount')
|
Py_DEBUG = hasattr(sys, 'gettotalrefcount')
|
||||||
if Py_DEBUG:
|
if Py_DEBUG:
|
||||||
text = 'Yes (sys.gettotalrefcount() present)'
|
text = 'Yes (sys.gettotalrefcount() present)'
|
||||||
else:
|
else:
|
||||||
text = 'No (sys.gettotalrefcount() missing)'
|
text = 'No (sys.gettotalrefcount() missing)'
|
||||||
info_add('Py_DEBUG', text)
|
info_add('build.Py_DEBUG', text)
|
||||||
|
|
||||||
|
# Were we compiled --with-trace-refs?
|
||||||
|
Py_TRACE_REFS = hasattr(sys, 'getobjects')
|
||||||
|
if Py_TRACE_REFS:
|
||||||
|
text = 'Yes (sys.getobjects() present)'
|
||||||
|
else:
|
||||||
|
text = 'No (sys.getobjects() missing)'
|
||||||
|
info_add('build.Py_REF_DEBUG', text)
|
||||||
|
|
||||||
|
|
||||||
def collect_platform(info_add):
|
def collect_platform(info_add):
|
||||||
|
@ -455,6 +466,11 @@ def collect_datetime(info_add):
|
||||||
|
|
||||||
|
|
||||||
def collect_sysconfig(info_add):
|
def collect_sysconfig(info_add):
|
||||||
|
# On Windows, sysconfig is not reliable to get macros used
|
||||||
|
# to build Python
|
||||||
|
if MS_WINDOWS:
|
||||||
|
return
|
||||||
|
|
||||||
import sysconfig
|
import sysconfig
|
||||||
|
|
||||||
for name in (
|
for name in (
|
||||||
|
@ -488,6 +504,28 @@ def collect_sysconfig(info_add):
|
||||||
value = normalize_text(value)
|
value = normalize_text(value)
|
||||||
info_add('sysconfig[%s]' % name, value)
|
info_add('sysconfig[%s]' % name, value)
|
||||||
|
|
||||||
|
PY_CFLAGS = sysconfig.get_config_var('PY_CFLAGS')
|
||||||
|
NDEBUG = (PY_CFLAGS and '-DNDEBUG' in PY_CFLAGS)
|
||||||
|
if NDEBUG:
|
||||||
|
text = 'ignore assertions (macro defined)'
|
||||||
|
else:
|
||||||
|
text= 'build assertions (macro not defined)'
|
||||||
|
info_add('build.NDEBUG',text)
|
||||||
|
|
||||||
|
for name in (
|
||||||
|
'WITH_DOC_STRINGS',
|
||||||
|
'WITH_DTRACE',
|
||||||
|
'WITH_FREELISTS',
|
||||||
|
'WITH_PYMALLOC',
|
||||||
|
'WITH_VALGRIND',
|
||||||
|
):
|
||||||
|
value = sysconfig.get_config_var(name)
|
||||||
|
if value:
|
||||||
|
text = 'Yes'
|
||||||
|
else:
|
||||||
|
text = 'No'
|
||||||
|
info_add(f'build.{name}', text)
|
||||||
|
|
||||||
|
|
||||||
def collect_ssl(info_add):
|
def collect_ssl(info_add):
|
||||||
import os
|
import os
|
||||||
|
@ -605,7 +643,6 @@ def collect_testcapi(info_add):
|
||||||
return
|
return
|
||||||
|
|
||||||
call_func(info_add, 'pymem.allocator', _testcapi, 'pymem_getallocatorsname')
|
call_func(info_add, 'pymem.allocator', _testcapi, 'pymem_getallocatorsname')
|
||||||
copy_attr(info_add, 'pymem.with_pymalloc', _testcapi, 'WITH_PYMALLOC')
|
|
||||||
|
|
||||||
|
|
||||||
def collect_resource(info_add):
|
def collect_resource(info_add):
|
||||||
|
@ -647,6 +684,13 @@ def collect_test_support(info_add):
|
||||||
call_func(info_add, 'test_support._is_gui_available', support, '_is_gui_available')
|
call_func(info_add, 'test_support._is_gui_available', support, '_is_gui_available')
|
||||||
call_func(info_add, 'test_support.python_is_optimized', support, 'python_is_optimized')
|
call_func(info_add, 'test_support.python_is_optimized', support, 'python_is_optimized')
|
||||||
|
|
||||||
|
info_add('test_support.check_sanitizer(address=True)',
|
||||||
|
support.check_sanitizer(address=True))
|
||||||
|
info_add('test_support.check_sanitizer(memory=True)',
|
||||||
|
support.check_sanitizer(memory=True))
|
||||||
|
info_add('test_support.check_sanitizer(ub=True)',
|
||||||
|
support.check_sanitizer(ub=True))
|
||||||
|
|
||||||
|
|
||||||
def collect_cc(info_add):
|
def collect_cc(info_add):
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue