https://github.com/python/cpython/commit/35541c410d894d4fa18002f7fdbebfe522f8320e
commit: 35541c410d894d4fa18002f7fdbebfe522f8320e
branch: main
author: Pablo Galindo Salgado <[email protected]>
committer: pablogsal <[email protected]>
date: 2024-09-30T17:57:00Z
summary:

gh-124613: Don't run perf tests in JIT builds (#124792)

* gh-124613: Don't run perf tests in JIT builds

Signed-off-by: Pablo Galindo <[email protected]>

* Apply suggestions from code review

Co-authored-by: Victor Stinner <[email protected]>

---------

Signed-off-by: Pablo Galindo <[email protected]>
Co-authored-by: Victor Stinner <[email protected]>

files:
M Lib/test/test_perf_profiler.py

diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py
index b68a55259c62e1..672851425ffb53 100644
--- a/Lib/test/test_perf_profiler.py
+++ b/Lib/test/test_perf_profiler.py
@@ -23,6 +23,15 @@
     raise unittest.SkipTest("test crash randomly on ASAN/MSAN/UBSAN build")
 
 
+def is_jit_build():
+    cflags = (sysconfig.get_config_var("PY_CORE_CFLAGS") or '')
+    return "_Py_JIT" in cflags
+
+
+if is_jit_build():
+    raise unittest.SkipTest("Perf support is not available in JIT builds")
+
+
 def supports_trampoline_profiling():
     perf_trampoline = sysconfig.get_config_var("PY_HAVE_PERF_TRAMPOLINE")
     if not perf_trampoline:
@@ -229,7 +238,7 @@ def is_unwinding_reliable_with_frame_pointers():
     cflags = sysconfig.get_config_var("PY_CORE_CFLAGS")
     if not cflags:
         return False
-    return "no-omit-frame-pointer" in cflags and "_Py_JIT" not in cflags
+    return "no-omit-frame-pointer" in cflags
 
 
 def perf_command_works():
@@ -382,6 +391,7 @@ def baz(n):
             self.assertNotIn(f"py::bar:{script}", stdout)
             self.assertNotIn(f"py::baz:{script}", stdout)
 
+
 @unittest.skipUnless(perf_command_works(), "perf command doesn't work")
 @unittest.skipUnless(
     is_unwinding_reliable_with_frame_pointers(),
@@ -494,7 +504,9 @@ def _is_perf_version_at_least(major, minor):
 
 
 @unittest.skipUnless(perf_command_works(), "perf command doesn't work")
[email protected](_is_perf_version_at_least(6, 6), "perf command may not 
work due to a perf bug")
[email protected](
+    _is_perf_version_at_least(6, 6), "perf command may not work due to a perf 
bug"
+)
 class TestPerfProfilerWithDwarf(unittest.TestCase, TestPerfProfilerMixin):
     def run_perf(self, script_dir, script, activate_trampoline=True):
         if activate_trampoline:

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to