summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_faulthandler.py
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2022-01-25 22:01:10 (GMT)
committerGitHub <noreply@github.com>2022-01-25 22:01:10 (GMT)
commitb1cb8430504931f7854eac5d32cba74770078a4e (patch)
tree5d48cddcbe7fe4bfffc9ecf92cdf8487e1e8dcdc /Lib/test/test_faulthandler.py
parentcef0a5458f254c2f8536b928dee25862ca90ffa6 (diff)
downloadcpython-b1cb8430504931f7854eac5d32cba74770078a4e.zip
cpython-b1cb8430504931f7854eac5d32cba74770078a4e.tar.gz
cpython-b1cb8430504931f7854eac5d32cba74770078a4e.tar.bz2
Refactor sanitiser skip tests into test.support (GH-30889)
* Refactor sanitizer skip tests into test.support * fixup! Refactor sanitizer skip tests into test.support * fixup! fixup! Refactor sanitizer skip tests into test.support
Diffstat (limited to 'Lib/test/test_faulthandler.py')
-rw-r--r--Lib/test/test_faulthandler.py20
1 files changed, 5 insertions, 15 deletions
diff --git a/Lib/test/test_faulthandler.py b/Lib/test/test_faulthandler.py
index f7eaa77..daacdee 100644
--- a/Lib/test/test_faulthandler.py
+++ b/Lib/test/test_faulthandler.py
@@ -6,10 +6,10 @@ import re
import signal
import subprocess
import sys
-import sysconfig
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
@@ -21,16 +21,6 @@ except ImportError:
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 = (
- '-fsanitize=undefined' in _cflags or
- '--with-undefined-behavior-sanitizer' in _config_args
-)
-MEMORY_SANITIZER = (
- '-fsanitize=memory' in _cflags or
- '--with-memory-sanitizer' in _config_args
-)
def expected_traceback(lineno1, lineno2, header, min_count=1):
@@ -311,8 +301,8 @@ class FaultHandlerTests(unittest.TestCase):
3,
'Segmentation fault')
- @unittest.skipIf(UB_SANITIZER or MEMORY_SANITIZER,
- "sanitizer builds change crashing process output.")
+ @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:
@@ -328,8 +318,8 @@ class FaultHandlerTests(unittest.TestCase):
@unittest.skipIf(sys.platform == "win32",
"subprocess doesn't support pass_fds on Windows")
- @unittest.skipIf(UB_SANITIZER or MEMORY_SANITIZER,
- "sanitizer builds change crashing process output.")
+ @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: