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
19 changes: 13 additions & 6 deletions Lib/test/test_faulthandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from test import support
from test.support import os_helper
from test.support import script_helper, is_android
from test.support import skip_if_sanitizer
import tempfile
import unittest
from textwrap import dedent
Expand Down Expand Up @@ -64,8 +63,20 @@ def get_output(self, code, filename=None, fd=None):
pass_fds = []
if fd is not None:
pass_fds.append(fd)
env = dict(os.environ)

# Sanitizers must not handle SIGSEGV (ex: for test_enable_fd())
option = 'handle_segv=0'
for name in ('ASAN_OPTIONS', 'MSAN_OPTIONS', 'UBSAN_OPTIONS'):
if name in env:
env[name] += f':{option}'
else:
env[name] = option

with support.SuppressCrashReport():
process = script_helper.spawn_python('-c', code, pass_fds=pass_fds)
process = script_helper.spawn_python('-c', code,
pass_fds=pass_fds,
env=env)
with process:
output, stderr = process.communicate()
exitcode = process.wait()
Expand Down Expand Up @@ -304,8 +315,6 @@ def test_gil_released(self):
3,
'Segmentation fault')

@skip_if_sanitizer(memory=True, ub=True, reason="sanitizer "
"builds change crashing process output.")
@skip_segfault_on_android
def test_enable_file(self):
with temporary_filename() as filename:
Expand All @@ -321,8 +330,6 @@ def test_enable_file(self):

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