Skip to content

Commit 3e7ccf0

Browse files
committed
pythongh-124613: Don't run perf tests in JIT builds
Signed-off-by: Pablo Galindo <[email protected]>
1 parent 6d0d26e commit 3e7ccf0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Lib/test/test_perf_profiler.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@
2323
raise unittest.SkipTest("test crash randomly on ASAN/MSAN/UBSAN build")
2424

2525

26+
def is_jit_build():
27+
cflags = sysconfig.get_config_var("PY_CORE_CFLAGS")
28+
if not cflags:
29+
return False
30+
return "_Py_JIT" in cflags
31+
32+
33+
if is_jit_build():
34+
raise unittest.SkipTest("Perf support is not available in jit builds")
35+
36+
2637
def supports_trampoline_profiling():
2738
perf_trampoline = sysconfig.get_config_var("PY_HAVE_PERF_TRAMPOLINE")
2839
if not perf_trampoline:
@@ -229,7 +240,7 @@ def is_unwinding_reliable_with_frame_pointers():
229240
cflags = sysconfig.get_config_var("PY_CORE_CFLAGS")
230241
if not cflags:
231242
return False
232-
return "no-omit-frame-pointer" in cflags and "_Py_JIT" not in cflags
243+
return "no-omit-frame-pointer" in cflags
233244

234245

235246
def perf_command_works():
@@ -382,6 +393,7 @@ def baz(n):
382393
self.assertNotIn(f"py::bar:{script}", stdout)
383394
self.assertNotIn(f"py::baz:{script}", stdout)
384395

396+
385397
@unittest.skipUnless(perf_command_works(), "perf command doesn't work")
386398
@unittest.skipUnless(
387399
is_unwinding_reliable_with_frame_pointers(),
@@ -494,7 +506,9 @@ def _is_perf_version_at_least(major, minor):
494506

495507

496508
@unittest.skipUnless(perf_command_works(), "perf command doesn't work")
497-
@unittest.skipUnless(_is_perf_version_at_least(6, 6), "perf command may not work due to a perf bug")
509+
@unittest.skipUnless(
510+
_is_perf_version_at_least(6, 6), "perf command may not work due to a perf bug"
511+
)
498512
class TestPerfProfilerWithDwarf(unittest.TestCase, TestPerfProfilerMixin):
499513
def run_perf(self, script_dir, script, activate_trampoline=True):
500514
if activate_trampoline:

0 commit comments

Comments
 (0)