Skip to content

Commit 61015e1

Browse files
committed
Skip GNU backtrace tests on 32-bit Arm
GNU backtrace() can return an empty stack on 32-bit Arm when the build lacks suitable runtime unwind tables. Rather than trying to infer the effective unwind-table compiler flags in the test, skip the GNU backtrace tests on all 32-bit Arm builds.
1 parent cb52a24 commit 61015e1

1 file changed

Lines changed: 2 additions & 60 deletions

File tree

Lib/test/test_frame_pointer_unwind.py

Lines changed: 2 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import json
22
import os
33
import platform
4-
import shlex
54
import subprocess
65
import sys
76
import sysconfig
@@ -105,63 +104,6 @@ def _is_arm32_build():
105104
return "arm" in abi
106105

107106

108-
def _cflags_have_unwind_tables(cflags):
109-
unwind_tables = False
110-
asynchronous_unwind_tables = False
111-
exceptions = False
112-
113-
try:
114-
options = shlex.split(cflags)
115-
except ValueError:
116-
options = cflags.split()
117-
118-
for option in options:
119-
if option == "-funwind-tables":
120-
unwind_tables = True
121-
elif option == "-fno-unwind-tables":
122-
unwind_tables = False
123-
elif option == "-fasynchronous-unwind-tables":
124-
asynchronous_unwind_tables = True
125-
elif option == "-fno-asynchronous-unwind-tables":
126-
asynchronous_unwind_tables = False
127-
elif option == "-fexceptions":
128-
exceptions = True
129-
elif option == "-fno-exceptions":
130-
exceptions = False
131-
132-
return unwind_tables or asynchronous_unwind_tables or exceptions
133-
134-
135-
def _build_has_unwind_tables():
136-
cflags = [
137-
value for value in (
138-
sysconfig.get_config_var("PY_CORE_CFLAGS"),
139-
sysconfig.get_config_var("PY_STDMODULE_CFLAGS"),
140-
)
141-
if value
142-
]
143-
if not cflags:
144-
cflags = [
145-
value for value in (
146-
sysconfig.get_config_var("PY_CFLAGS"),
147-
sysconfig.get_config_var("CFLAGS"),
148-
)
149-
if value
150-
]
151-
152-
return (
153-
bool(cflags)
154-
and all(_cflags_have_unwind_tables(value) for value in cflags)
155-
)
156-
157-
158-
def _gnu_backtrace_requires_unwind_tables():
159-
if not _is_arm32_build():
160-
return False
161-
162-
return not _build_has_unwind_tables()
163-
164-
165107
def _build_stack_and_unwind(unwinder):
166108
import operator
167109

@@ -369,8 +311,8 @@ def test_manual_unwind_respects_frame_pointers(self):
369311
@unittest.skipIf(support.is_wasi, "test not supported on WASI")
370312
@unittest.skipUnless(sys.platform == "linux", "GNU backtrace unwinding test requires Linux")
371313
@unittest.skipIf(
372-
_gnu_backtrace_requires_unwind_tables(),
373-
"GNU backtrace unwinding on Arm 32-bit requires unwind tables",
314+
_is_arm32_build(),
315+
"GNU backtrace unwinding skipped on Arm 32-bit",
374316
)
375317
class GnuBacktraceUnwindTests(unittest.TestCase):
376318

0 commit comments

Comments
 (0)