|
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") |
| 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 | + |
26 | 37 | def supports_trampoline_profiling():
|
27 | 38 | perf_trampoline = sysconfig.get_config_var("PY_HAVE_PERF_TRAMPOLINE")
|
28 | 39 | if not perf_trampoline:
|
@@ -229,7 +240,7 @@ def is_unwinding_reliable_with_frame_pointers():
|
229 | 240 | cflags = sysconfig.get_config_var("PY_CORE_CFLAGS")
|
230 | 241 | if not cflags:
|
231 | 242 | return False
|
232 |
| - return "no-omit-frame-pointer" in cflags and "_Py_JIT" not in cflags |
| 243 | + return "no-omit-frame-pointer" in cflags |
233 | 244 |
|
234 | 245 |
|
235 | 246 | def perf_command_works():
|
@@ -382,6 +393,7 @@ def baz(n):
|
382 | 393 | self.assertNotIn(f"py::bar:{script}", stdout)
|
383 | 394 | self.assertNotIn(f"py::baz:{script}", stdout)
|
384 | 395 |
|
| 396 | + |
385 | 397 | @unittest.skipUnless(perf_command_works(), "perf command doesn't work")
|
386 | 398 | @unittest.skipUnless(
|
387 | 399 | is_unwinding_reliable_with_frame_pointers(),
|
@@ -494,7 +506,9 @@ def _is_perf_version_at_least(major, minor):
|
494 | 506 |
|
495 | 507 |
|
496 | 508 | @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 | +) |
498 | 512 | class TestPerfProfilerWithDwarf(unittest.TestCase, TestPerfProfilerMixin):
|
499 | 513 | def run_perf(self, script_dir, script, activate_trampoline=True):
|
500 | 514 | if activate_trampoline:
|
|
0 commit comments