Skip to content

Commit 979b9de

Browse files
serge-sans-pailleadorilson
authored andcommitted
Disable peg generator tests when building with PGO (pythonGH-23141)
Otherwise, when running the testsuite, test_peg_generator tries to compile C code using the optimized flags and fails because it cannot find the profile data.
1 parent 3213e91 commit 979b9de

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Lib/test/test_peg_generator/test_c_parser.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sysconfig
12
import textwrap
23
import unittest
34
from distutils.tests.support import TempdirManager
@@ -8,6 +9,11 @@
89
from test.support import os_helper
910
from test.support.script_helper import assert_python_ok
1011

12+
_py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST')
13+
_pgo_flag = sysconfig.get_config_var('PGO_PROF_USE_FLAG')
14+
if _pgo_flag and _py_cflags_nodist and _pgo_flag in _py_cflags_nodist:
15+
raise unittest.SkipTest("peg_generator test disabled under PGO build")
16+
1117
test_tools.skip_if_missing("peg_generator")
1218
with test_tools.imports_under_tool("peg_generator"):
1319
from pegen.grammar_parser import GeneratedParser as GrammarParser

0 commit comments

Comments
 (0)