File tree Expand file tree Collapse file tree 5 files changed +36
-10
lines changed Expand file tree Collapse file tree 5 files changed +36
-10
lines changed Original file line number Diff line number Diff line change @@ -310,16 +310,8 @@ def get_build_info():
310310 elif '-flto' in ldflags_nodist :
311311 optimizations .append ('LTO' )
312312
313- # --enable-optimizations
314- pgo_options = (
315- # GCC
316- '-fprofile-use' ,
317- # clang: -fprofile-instr-use=code.profclangd
318- '-fprofile-instr-use' ,
319- # ICC
320- "-prof-use" ,
321- )
322- if any (option in cflags_nodist for option in pgo_options ):
313+ if support .check_cflags_pgo ():
314+ # PGO (--enable-optimizations)
323315 optimizations .append ('PGO' )
324316 if optimizations :
325317 build .append ('+' .join (optimizations ))
Original file line number Diff line number Diff line change @@ -956,6 +956,16 @@ def collect_tempfile(info_add):
956956
957957 info_add ('tempfile.gettempdir' , tempfile .gettempdir ())
958958
959+
960+ def collect_libregrtest_utils (info_add ):
961+ try :
962+ from test .libregrtest import utils
963+ except ImportError :
964+ return
965+
966+ info_add ('libregrtests.build_info' , ' ' .join (utils .get_build_info ()))
967+
968+
959969def collect_info (info ):
960970 error = False
961971 info_add = info .add
@@ -995,6 +1005,7 @@ def collect_info(info):
9951005 collect_tkinter ,
9961006 collect_windows ,
9971007 collect_zlib ,
1008+ collect_libregrtest_utils ,
9981009
9991010 # Collecting from tests should be last as they have side effects.
10001011 collect_test_socket ,
Original file line number Diff line number Diff line change @@ -773,6 +773,21 @@ def python_is_optimized():
773773 return final_opt not in ('' , '-O0' , '-Og' )
774774
775775
776+ def check_cflags_pgo ():
777+ # Check if Python was built with ./configure --enable-optimizations:
778+ # with Profile Guided Optimization (PGO).
779+ cflags_nodist = sysconfig .get_config_var ('PY_CFLAGS_NODIST' ) or ''
780+ pgo_options = (
781+ # GCC
782+ '-fprofile-use' ,
783+ # clang: -fprofile-instr-use=code.profclangd
784+ '-fprofile-instr-use' ,
785+ # ICC
786+ "-prof-use" ,
787+ )
788+ return any (option in cflags_nodist for option in pgo_options )
789+
790+
776791_header = 'nP'
777792_align = '0n'
778793_vheader = _header + 'n'
Original file line number Diff line number Diff line change 1515@support .requires_zlib ()
1616@unittest .skipIf (sys .platform .startswith ('win' ), 'not supported on Windows' )
1717@support .skip_if_buildbot ('not all buildbots have enough space' )
18+ # gh-103053: Skip test if Python is built with Profile Guided Optimization
19+ # (PGO), since the test is just too slow in this case.
20+ @unittest .skipIf (support .check_cflags_pgo (),
21+ 'test is too slow with PGO' )
1822class TestFreeze (unittest .TestCase ):
1923
2024 @support .requires_resource ('cpu' ) # Building Python is slow
Original file line number Diff line number Diff line change 1+ Skip test_freeze_simple_script() of test_tools.test_freeze if Python is built
2+ with ``./configure --enable-optimizations ``, which means with Profile Guided
3+ Optimization (PGO): it just makes the test too slow. The freeze tool is tested
4+ by many other CIs with other (faster) compiler flags. Patch by Victor Stinner.
You can’t perform that action at this time.
0 commit comments