File tree 5 files changed +35
-10
lines changed
5 files changed +35
-10
lines changed Original file line number Diff line number Diff line change @@ -259,16 +259,8 @@ def get_build_info():
259
259
elif '-flto' in ldflags_nodist :
260
260
optimizations .append ('LTO' )
261
261
262
- # --enable-optimizations
263
- pgo_options = (
264
- # GCC
265
- '-fprofile-use' ,
266
- # clang: -fprofile-instr-use=code.profclangd
267
- '-fprofile-instr-use' ,
268
- # ICC
269
- "-prof-use" ,
270
- )
271
- if any (option in cflags_nodist for option in pgo_options ):
262
+ if support .check_cflags_pgo ():
263
+ # PGO (--enable-optimizations)
272
264
optimizations .append ('PGO' )
273
265
if optimizations :
274
266
build .append ('+' .join (optimizations ))
Original file line number Diff line number Diff line change @@ -875,6 +875,15 @@ def collect_fips(info_add):
875
875
pass
876
876
877
877
878
+ def collect_libregrtest_utils (info_add ):
879
+ try :
880
+ from test .libregrtest import utils
881
+ except ImportError :
882
+ return
883
+
884
+ info_add ('libregrtests.build_info' , ' ' .join (utils .get_build_info ()))
885
+
886
+
878
887
def collect_info (info ):
879
888
error = False
880
889
info_add = info .add
@@ -912,6 +921,7 @@ def collect_info(info):
912
921
collect_tkinter ,
913
922
collect_windows ,
914
923
collect_zlib ,
924
+ collect_libregrtest_utils ,
915
925
916
926
# Collecting from tests should be last as they have side effects.
917
927
collect_test_socket ,
Original file line number Diff line number Diff line change @@ -765,6 +765,21 @@ def python_is_optimized():
765
765
return final_opt not in ('' , '-O0' , '-Og' )
766
766
767
767
768
+ def check_cflags_pgo ():
769
+ # Check if Python was built with ./configure --enable-optimizations:
770
+ # with Profile Guided Optimization (PGO).
771
+ cflags_nodist = sysconfig .get_config_var ('PY_CFLAGS_NODIST' ) or ''
772
+ pgo_options = (
773
+ # GCC
774
+ '-fprofile-use' ,
775
+ # clang: -fprofile-instr-use=code.profclangd
776
+ '-fprofile-instr-use' ,
777
+ # ICC
778
+ "-prof-use" ,
779
+ )
780
+ return any (option in cflags_nodist for option in pgo_options )
781
+
782
+
768
783
_header = 'nP'
769
784
_align = '0n'
770
785
if hasattr (sys , "getobjects" ):
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