]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Disable peg generator tests when building with PGO (GH-23141)
authorserge-sans-paille <serge.guelton@telecom-bretagne.eu>
Wed, 4 Nov 2020 23:01:08 +0000 (23:01 +0000)
committerGitHub <noreply@github.com>
Wed, 4 Nov 2020 23:01:08 +0000 (23:01 +0000)
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.

Lib/test/test_peg_generator/test_c_parser.py

index 0dffedca789c57b8b9cf16b6e9904006c3784c05..67bb8512118e3a830610a19bb772e9ca7919ccf2 100644 (file)
@@ -1,3 +1,4 @@
+import sysconfig
 import textwrap
 import unittest
 from distutils.tests.support import TempdirManager
@@ -8,6 +9,11 @@ from test import support
 from test.support import os_helper
 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