|
23 | 23 | raise unittest.SkipTest("test crash randomly on ASAN/MSAN/UBSAN build")
|
24 | 24 |
|
25 | 25 |
|
| 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 | + |
26 | 35 | def supports_trampoline_profiling():
|
27 | 36 | perf_trampoline = sysconfig.get_config_var("PY_HAVE_PERF_TRAMPOLINE")
|
28 | 37 | if not perf_trampoline:
|
@@ -229,7 +238,7 @@ def is_unwinding_reliable_with_frame_pointers():
|
229 | 238 | cflags = sysconfig.get_config_var("PY_CORE_CFLAGS")
|
230 | 239 | if not cflags:
|
231 | 240 | return False
|
232 |
| - return "no-omit-frame-pointer" in cflags and "_Py_JIT" not in cflags |
| 241 | + return "no-omit-frame-pointer" in cflags |
233 | 242 |
|
234 | 243 |
|
235 | 244 | def perf_command_works():
|
@@ -382,6 +391,7 @@ def baz(n):
|
382 | 391 | self.assertNotIn(f"py::bar:{script}", stdout)
|
383 | 392 | self.assertNotIn(f"py::baz:{script}", stdout)
|
384 | 393 |
|
| 394 | + |
385 | 395 | @unittest.skipUnless(perf_command_works(), "perf command doesn't work")
|
386 | 396 | @unittest.skipUnless(
|
387 | 397 | is_unwinding_reliable_with_frame_pointers(),
|
@@ -494,7 +504,9 @@ def _is_perf_version_at_least(major, minor):
|
494 | 504 |
|
495 | 505 |
|
496 | 506 | @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 | +) |
498 | 510 | class TestPerfProfilerWithDwarf(unittest.TestCase, TestPerfProfilerMixin):
|
499 | 511 | def run_perf(self, script_dir, script, activate_trampoline=True):
|
500 | 512 | if activate_trampoline:
|
|
0 commit comments