Skip to content

Commit 35541c4

Browse files
pablogsalvstinner
andauthored
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]>
1 parent fac5e7a commit 35541c4

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

Lib/test/test_perf_profiler.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@
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") or '')
28+
return "_Py_JIT" in cflags
29+
30+
31+
if is_jit_build():
32+
raise unittest.SkipTest("Perf support is not available in JIT builds")
33+
34+
2635
def supports_trampoline_profiling():
2736
perf_trampoline = sysconfig.get_config_var("PY_HAVE_PERF_TRAMPOLINE")
2837
if not perf_trampoline:
@@ -229,7 +238,7 @@ def is_unwinding_reliable_with_frame_pointers():
229238
cflags = sysconfig.get_config_var("PY_CORE_CFLAGS")
230239
if not cflags:
231240
return False
232-
return "no-omit-frame-pointer" in cflags and "_Py_JIT" not in cflags
241+
return "no-omit-frame-pointer" in cflags
233242

234243

235244
def perf_command_works():
@@ -382,6 +391,7 @@ def baz(n):
382391
self.assertNotIn(f"py::bar:{script}", stdout)
383392
self.assertNotIn(f"py::baz:{script}", stdout)
384393

394+
385395
@unittest.skipUnless(perf_command_works(), "perf command doesn't work")
386396
@unittest.skipUnless(
387397
is_unwinding_reliable_with_frame_pointers(),
@@ -494,7 +504,9 @@ def _is_perf_version_at_least(major, minor):
494504

495505

496506
@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")
507+
@unittest.skipUnless(
508+
_is_perf_version_at_least(6, 6), "perf command may not work due to a perf bug"
509+
)
498510
class TestPerfProfilerWithDwarf(unittest.TestCase, TestPerfProfilerMixin):
499511
def run_perf(self, script_dir, script, activate_trampoline=True):
500512
if activate_trampoline:

0 commit comments

Comments
 (0)