mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-103053: Skip test_freeze_simple_script() on PGO build (#109591)
Skip test_freeze_simple_script() of test_tools.test_freeze if Python is built with "./configure --enable-optimizations", which means with Profile Guided Optimization (PGO): it just makes the test too slow. The freeze tool is tested by many other CIs with other (faster) compiler flags. test.pythoninfo now gets also get_build_info() of test.libregrtests.utils.
This commit is contained in:
parent
3e3a7da590
commit
81cd1bd713
5 changed files with 36 additions and 10 deletions
|
@ -310,16 +310,8 @@ def get_build_info():
|
||||||
elif '-flto' in ldflags_nodist:
|
elif '-flto' in ldflags_nodist:
|
||||||
optimizations.append('LTO')
|
optimizations.append('LTO')
|
||||||
|
|
||||||
# --enable-optimizations
|
if support.check_cflags_pgo():
|
||||||
pgo_options = (
|
# PGO (--enable-optimizations)
|
||||||
# GCC
|
|
||||||
'-fprofile-use',
|
|
||||||
# clang: -fprofile-instr-use=code.profclangd
|
|
||||||
'-fprofile-instr-use',
|
|
||||||
# ICC
|
|
||||||
"-prof-use",
|
|
||||||
)
|
|
||||||
if any(option in cflags_nodist for option in pgo_options):
|
|
||||||
optimizations.append('PGO')
|
optimizations.append('PGO')
|
||||||
if optimizations:
|
if optimizations:
|
||||||
build.append('+'.join(optimizations))
|
build.append('+'.join(optimizations))
|
||||||
|
|
|
@ -956,6 +956,16 @@ def collect_tempfile(info_add):
|
||||||
|
|
||||||
info_add('tempfile.gettempdir', tempfile.gettempdir())
|
info_add('tempfile.gettempdir', tempfile.gettempdir())
|
||||||
|
|
||||||
|
|
||||||
|
def collect_libregrtest_utils(info_add):
|
||||||
|
try:
|
||||||
|
from test.libregrtest import utils
|
||||||
|
except ImportError:
|
||||||
|
return
|
||||||
|
|
||||||
|
info_add('libregrtests.build_info', ' '.join(utils.get_build_info()))
|
||||||
|
|
||||||
|
|
||||||
def collect_info(info):
|
def collect_info(info):
|
||||||
error = False
|
error = False
|
||||||
info_add = info.add
|
info_add = info.add
|
||||||
|
@ -995,6 +1005,7 @@ def collect_info(info):
|
||||||
collect_tkinter,
|
collect_tkinter,
|
||||||
collect_windows,
|
collect_windows,
|
||||||
collect_zlib,
|
collect_zlib,
|
||||||
|
collect_libregrtest_utils,
|
||||||
|
|
||||||
# Collecting from tests should be last as they have side effects.
|
# Collecting from tests should be last as they have side effects.
|
||||||
collect_test_socket,
|
collect_test_socket,
|
||||||
|
|
|
@ -773,6 +773,21 @@ def python_is_optimized():
|
||||||
return final_opt not in ('', '-O0', '-Og')
|
return final_opt not in ('', '-O0', '-Og')
|
||||||
|
|
||||||
|
|
||||||
|
def check_cflags_pgo():
|
||||||
|
# Check if Python was built with ./configure --enable-optimizations:
|
||||||
|
# with Profile Guided Optimization (PGO).
|
||||||
|
cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST') or ''
|
||||||
|
pgo_options = (
|
||||||
|
# GCC
|
||||||
|
'-fprofile-use',
|
||||||
|
# clang: -fprofile-instr-use=code.profclangd
|
||||||
|
'-fprofile-instr-use',
|
||||||
|
# ICC
|
||||||
|
"-prof-use",
|
||||||
|
)
|
||||||
|
return any(option in cflags_nodist for option in pgo_options)
|
||||||
|
|
||||||
|
|
||||||
_header = 'nP'
|
_header = 'nP'
|
||||||
_align = '0n'
|
_align = '0n'
|
||||||
_vheader = _header + 'n'
|
_vheader = _header + 'n'
|
||||||
|
|
|
@ -15,6 +15,10 @@ with imports_under_tool('freeze', 'test'):
|
||||||
@support.requires_zlib()
|
@support.requires_zlib()
|
||||||
@unittest.skipIf(sys.platform.startswith('win'), 'not supported on Windows')
|
@unittest.skipIf(sys.platform.startswith('win'), 'not supported on Windows')
|
||||||
@support.skip_if_buildbot('not all buildbots have enough space')
|
@support.skip_if_buildbot('not all buildbots have enough space')
|
||||||
|
# gh-103053: Skip test if Python is built with Profile Guided Optimization
|
||||||
|
# (PGO), since the test is just too slow in this case.
|
||||||
|
@unittest.skipIf(support.check_cflags_pgo(),
|
||||||
|
'test is too slow with PGO')
|
||||||
class TestFreeze(unittest.TestCase):
|
class TestFreeze(unittest.TestCase):
|
||||||
|
|
||||||
@support.requires_resource('cpu') # Building Python is slow
|
@support.requires_resource('cpu') # Building Python is slow
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
Skip test_freeze_simple_script() of test_tools.test_freeze if Python is built
|
||||||
|
with ``./configure --enable-optimizations``, which means with Profile Guided
|
||||||
|
Optimization (PGO): it just makes the test too slow. The freeze tool is tested
|
||||||
|
by many other CIs with other (faster) compiler flags. Patch by Victor Stinner.
|
Loading…
Add table
Add a link
Reference in a new issue