Disable peg generator tests when building with PGO (GH-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.
(cherry picked from commit 100964e031)

Co-authored-by: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
This commit is contained in:
Miss Islington (bot) 2020-11-04 15:22:13 -08:00 committed by GitHub
parent 72bb4c6c1f
commit 3997a4e6bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import sysconfig
import textwrap
import unittest
from distutils.tests.support import TempdirManager
@ -7,6 +8,11 @@ from test import test_tools
from test import support
from test.support.script_helper import assert_python_ok
_py_cflags_nodist = sysconfig.get_config_var('PY_CFLAGS_NODIST')
_pgo_flag = sysconfig.get_config_var('PGO_PROF_USE_FLAG')
if _pgo_flag and _py_cflags_nodist and _pgo_flag in _py_cflags_nodist:
raise unittest.SkipTest("peg_generator test disabled under PGO build")
test_tools.skip_if_missing("peg_generator")
with test_tools.imports_under_tool("peg_generator"):
from pegen.grammar_parser import GeneratedParser as GrammarParser