Skip to content

Commit 055cbf0

Browse files
authored
Skip test_jit when the JIT backend is "interpreter" (GH-149423)
1 parent 970b043 commit 055cbf0

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

Lib/test/test_gdb/test_jit.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,18 @@
44
import sys
55
import unittest
66

7+
from test.support import import_helper
8+
79
from .util import setup_module, DebuggerTests
810

911

12+
_testinternalcapi = import_helper.import_module("_testinternalcapi")
13+
NATIVE_JIT_ENABLED = (
14+
hasattr(sys, "_jit")
15+
and sys._jit.is_enabled()
16+
and _testinternalcapi.get_jit_backend() == "jit"
17+
)
18+
1019
JIT_SAMPLE_SCRIPT = os.path.join(os.path.dirname(__file__), "gdb_jit_sample.py")
1120
# In batch GDB, break in builtin_id() while it is running under JIT,
1221
# then repeatedly "finish" until the selected frame is the JIT executor.
@@ -62,14 +71,14 @@ def setUpModule():
6271
# Python/jit_unwind.c, and the synthetic EH-frame is only implemented for
6372
# x86_64 and AArch64 (a #error fires otherwise). Skip cleanly on other
6473
# platforms or architectures instead of producing timeouts / empty backtraces.
65-
# is_enabled() implies is_available() and also implies that the runtime has
66-
# JIT execution active; interpreter-only tier 2 builds don't hit this path.
74+
# sys._jit.is_enabled() is true for --enable-experimental-jit=interpreter,
75+
# but these tests need native JIT code and a py::jit:executor frame.
6776
@unittest.skipUnless(sys.platform == "linux",
6877
"GDB JIT interface is only implemented for Linux + ELF")
6978
@unittest.skipUnless(platform.machine() in ("x86_64", "aarch64"),
7079
"GDB JIT CFI emitter only supports x86_64 and AArch64")
71-
@unittest.skipUnless(hasattr(sys, "_jit") and sys._jit.is_enabled(),
72-
"requires a JIT-enabled build with JIT execution active")
80+
@unittest.skipUnless(NATIVE_JIT_ENABLED,
81+
"requires native JIT execution active")
7382
class JitBacktraceTests(DebuggerTests):
7483
def get_stack_trace(self, **kwargs):
7584
# These tests validate the JIT-relevant part of the backtrace via

0 commit comments

Comments
 (0)