Cleanup test_faulthandler sanitizer skip logic. (GH-11381)
Also skip the same tests when using the undefined behavior sanitizer
as they much with the output.
Updates a regex in another test to use multi-line mode so that the ubsan
buildbot should pass again rather than also adding a skip to that one.
(cherry picked from commit 30e023256a
)
Co-authored-by: Gregory P. Smith <greg@krypto.org>
This commit is contained in:
parent
a144feeb7e
commit
e404299057
|
@ -20,10 +20,17 @@ except ImportError:
|
||||||
|
|
||||||
TIMEOUT = 0.5
|
TIMEOUT = 0.5
|
||||||
MS_WINDOWS = (os.name == 'nt')
|
MS_WINDOWS = (os.name == 'nt')
|
||||||
MEMORY_SANITIZER = (
|
_cflags = sysconfig.get_config_var('CFLAGS') or ''
|
||||||
sysconfig.get_config_var("CONFIG_ARGS") and
|
_config_args = sysconfig.get_config_var('CONFIG_ARGS') or ''
|
||||||
("--with-memory-sanitizer" in sysconfig.get_config_var("CONFIG_ARGS"))
|
UB_SANITIZER = (
|
||||||
|
'-fsanitizer=undefined' in _cflags or
|
||||||
|
'--with-undefined-behavior-sanitizer' in _config_args
|
||||||
)
|
)
|
||||||
|
MEMORY_SANITIZER = (
|
||||||
|
'-fsanitizer=memory' in _cflags or
|
||||||
|
'--with-memory-sanitizer' in _config_args
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def expected_traceback(lineno1, lineno2, header, min_count=1):
|
def expected_traceback(lineno1, lineno2, header, min_count=1):
|
||||||
regex = header
|
regex = header
|
||||||
|
@ -99,7 +106,7 @@ class FaultHandlerTests(unittest.TestCase):
|
||||||
else:
|
else:
|
||||||
header = 'Stack'
|
header = 'Stack'
|
||||||
regex = r"""
|
regex = r"""
|
||||||
^{fatal_error}
|
(?m)^{fatal_error}
|
||||||
|
|
||||||
{header} \(most recent call first\):
|
{header} \(most recent call first\):
|
||||||
File "<string>", line {lineno} in <module>
|
File "<string>", line {lineno} in <module>
|
||||||
|
@ -257,8 +264,8 @@ class FaultHandlerTests(unittest.TestCase):
|
||||||
3,
|
3,
|
||||||
'Segmentation fault')
|
'Segmentation fault')
|
||||||
|
|
||||||
@unittest.skipIf(MEMORY_SANITIZER,
|
@unittest.skipIf(UB_SANITIZER or MEMORY_SANITIZER,
|
||||||
"memory-sanizer builds change crashing process output.")
|
"sanizer builds change crashing process output.")
|
||||||
@skip_segfault_on_android
|
@skip_segfault_on_android
|
||||||
def test_enable_file(self):
|
def test_enable_file(self):
|
||||||
with temporary_filename() as filename:
|
with temporary_filename() as filename:
|
||||||
|
@ -274,8 +281,8 @@ class FaultHandlerTests(unittest.TestCase):
|
||||||
|
|
||||||
@unittest.skipIf(sys.platform == "win32",
|
@unittest.skipIf(sys.platform == "win32",
|
||||||
"subprocess doesn't support pass_fds on Windows")
|
"subprocess doesn't support pass_fds on Windows")
|
||||||
@unittest.skipIf(MEMORY_SANITIZER,
|
@unittest.skipIf(UB_SANITIZER or MEMORY_SANITIZER,
|
||||||
"memory-sanizer builds change crashing process output.")
|
"sanizer builds change crashing process output.")
|
||||||
@skip_segfault_on_android
|
@skip_segfault_on_android
|
||||||
def test_enable_fd(self):
|
def test_enable_fd(self):
|
||||||
with tempfile.TemporaryFile('wb+') as fp:
|
with tempfile.TemporaryFile('wb+') as fp:
|
||||||
|
|
Loading…
Reference in New Issue