From 3e7ccf0ed48e2ae1bb9f9f039f1e553a486be695 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 30 Sep 2024 18:06:53 +0100 Subject: [PATCH 1/2] gh-124613: Don't run perf tests in JIT builds Signed-off-by: Pablo Galindo --- Lib/test/test_perf_profiler.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index b68a55259c62e1..b1201f672f7972 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -23,6 +23,17 @@ raise unittest.SkipTest("test crash randomly on ASAN/MSAN/UBSAN build") +def is_jit_build(): + cflags = sysconfig.get_config_var("PY_CORE_CFLAGS") + if not cflags: + return False + 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 +240,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 +393,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 +506,9 @@ def _is_perf_version_at_least(major, minor): @unittest.skipUnless(perf_command_works(), "perf command doesn't work") -@unittest.skipUnless(_is_perf_version_at_least(6, 6), "perf command may not work due to a perf bug") +@unittest.skipUnless( + _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: From 851f12cecdeb97c01b855b2d0dda5d7175a15cdf Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Mon, 30 Sep 2024 18:24:15 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Victor Stinner --- Lib/test/test_perf_profiler.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py index b1201f672f7972..672851425ffb53 100644 --- a/Lib/test/test_perf_profiler.py +++ b/Lib/test/test_perf_profiler.py @@ -24,14 +24,12 @@ def is_jit_build(): - cflags = sysconfig.get_config_var("PY_CORE_CFLAGS") - if not cflags: - return False + 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") + raise unittest.SkipTest("Perf support is not available in JIT builds") def supports_trampoline_profiling(): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy