]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-111178: Skip test_perf_profiler on function sanitizer (#132020)
authorVictor Stinner <vstinner@python.org>
Wed, 2 Apr 2025 16:46:10 +0000 (18:46 +0200)
committerGitHub <noreply@github.com>
Wed, 2 Apr 2025 16:46:10 +0000 (18:46 +0200)
Add 'function' parameter to check_sanitizer() of test.support.

Lib/test/support/__init__.py
Lib/test/test_perf_profiler.py

index 748b9b371170632975c06354b717370b8e516862..1ae4e0b756f007b68436909c287b71b0c2a9dfad 100644 (file)
@@ -409,7 +409,8 @@ def skip_if_buildbot(reason=None):
         isbuildbot = False
     return unittest.skipIf(isbuildbot, reason)
 
-def check_sanitizer(*, address=False, memory=False, ub=False, thread=False):
+def check_sanitizer(*, address=False, memory=False, ub=False, thread=False,
+                    function=True):
     """Returns True if Python is compiled with sanitizer support"""
     if not (address or memory or ub or thread):
         raise ValueError('At least one of address, memory, ub or thread must be True')
@@ -433,11 +434,15 @@ def check_sanitizer(*, address=False, memory=False, ub=False, thread=False):
         '-fsanitize=thread' in cflags or
         '--with-thread-sanitizer' in config_args
     )
+    function_sanitizer = (
+        '-fsanitize=function' in cflags
+    )
     return (
         (memory and memory_sanitizer) or
         (address and address_sanitizer) or
         (ub and ub_sanitizer) or
-        (thread and thread_sanitizer)
+        (thread and thread_sanitizer) or
+        (function and function_sanitizer)
     )
 
 
index 3ae4fff31155f915361b64ad97616acb24b13ef0..43e5a7e114b317f503ca63791bc3180c6bc70305 100644 (file)
@@ -17,7 +17,7 @@ from test.support.os_helper import temp_dir
 if not support.has_subprocess_support:
     raise unittest.SkipTest("test module requires subprocess")
 
-if support.check_sanitizer(address=True, memory=True, ub=True):
+if support.check_sanitizer(address=True, memory=True, ub=True, function=True):
     # gh-109580: Skip the test because it does crash randomly if Python is
     # built with ASAN.
     raise unittest.SkipTest("test crash randomly on ASAN/MSAN/UBSAN build")