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():
310
310
elif '-flto' in ldflags_nodist :
311
311
optimizations .append ('LTO' )
312
312
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)
323
315
optimizations .append ('PGO' )
324
316
if optimizations :
325
317
build .append ('+' .join (optimizations ))
Original file line number Diff line number Diff line change @@ -956,6 +956,16 @@ def collect_tempfile(info_add):
956
956
957
957
info_add ('tempfile.gettempdir' , tempfile .gettempdir ())
958
958
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
+
959
969
def collect_info (info ):
960
970
error = False
961
971
info_add = info .add
@@ -995,6 +1005,7 @@ def collect_info(info):
995
1005
collect_tkinter ,
996
1006
collect_windows ,
997
1007
collect_zlib ,
1008
+ collect_libregrtest_utils ,
998
1009
999
1010
# Collecting from tests should be last as they have side effects.
1000
1011
collect_test_socket ,
Original file line number Diff line number Diff line change @@ -773,6 +773,21 @@ def python_is_optimized():
773
773
return final_opt not in ('' , '-O0' , '-Og' )
774
774
775
775
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
+
776
791
_header = 'nP'
777
792
_align = '0n'
778
793
_vheader = _header + 'n'
Original file line number Diff line number Diff line change 15
15
@support .requires_zlib ()
16
16
@unittest .skipIf (sys .platform .startswith ('win' ), 'not supported on Windows' )
17
17
@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' )
18
22
class TestFreeze (unittest .TestCase ):
19
23
20
24
@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