Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions Lib/test/test_faulthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@

TIMEOUT = 0.5
MS_WINDOWS = (os.name == 'nt')
_cflags = sysconfig.get_config_var('CFLAGS') or ''
_config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
UB_SANITIZER = (
'-fsanitizer=undefined' in _cflags or
'--with-undefined-behavior-sanitizer' in _config_args
)
MEMORY_SANITIZER = (
sysconfig.get_config_var("CONFIG_ARGS") and
("--with-memory-sanitizer" in sysconfig.get_config_var("CONFIG_ARGS"))
'-fsanitizer=memory' in _cflags or
'--with-memory-sanitizer' in _config_args
)


def expected_traceback(lineno1, lineno2, header, min_count=1):
regex = header
regex += ' File "<string>", line %s in func\n' % lineno1
Expand Down Expand Up @@ -99,7 +106,7 @@ def check_error(self, code, line_number, fatal_error, *,
else:
header = 'Stack'
regex = r"""
^{fatal_error}
(?m)^{fatal_error}

{header} \(most recent call first\):
File "<string>", line {lineno} in <module>
Expand Down Expand Up @@ -257,8 +264,8 @@ def test_gil_released(self):
3,
'Segmentation fault')

@unittest.skipIf(MEMORY_SANITIZER,
"memory-sanizer builds change crashing process output.")
@unittest.skipIf(UB_SANITIZER or MEMORY_SANITIZER,
"sanizer builds change crashing process output.")
@skip_segfault_on_android
def test_enable_file(self):
with temporary_filename() as filename:
Expand All @@ -274,8 +281,8 @@ def test_enable_file(self):

@unittest.skipIf(sys.platform == "win32",
"subprocess doesn't support pass_fds on Windows")
@unittest.skipIf(MEMORY_SANITIZER,
"memory-sanizer builds change crashing process output.")
@unittest.skipIf(UB_SANITIZER or MEMORY_SANITIZER,
"sanizer builds change crashing process output.")
@skip_segfault_on_android
def test_enable_fd(self):
with tempfile.TemporaryFile('wb+') as fp:
Expand Down