]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Disable peg generator tests when building with PGO (GH-23141)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 4 Nov 2020 23:22:13 +0000 (15:22 -0800)
committerGitHub <noreply@github.com>
Wed, 4 Nov 2020 23:22:13 +0000 (15:22 -0800)
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 100964e0310d3a2040d0db976f7984d0507b2dbd)

Co-authored-by: serge-sans-paille <serge.guelton@telecom-bretagne.eu>
Lib/test/test_peg_generator/test_c_parser.py

index f9935258c861e0dc0c195dd62c3b114b4e03847b..9701d4f9feb16b18d2a41971a40888fe1c1a1206 100644 (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