https://github.com/python/cpython/commit/643dd5107cee995c0b48511bf5dbc52c695d11af
commit: 643dd5107cee995c0b48511bf5dbc52c695d11af
branch: main
author: Victor Stinner <vstin...@python.org>
committer: vstinner <vstin...@python.org>
date: 2025-04-02T18:46:10+02:00
summary:

gh-111178: Skip test_perf_profiler on function sanitizer (#132020)

Add 'function' parameter to check_sanitizer() of test.support.

files:
M Lib/test/support/__init__.py
M Lib/test/test_perf_profiler.py

diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 748b9b37117063..1ae4e0b756f007 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -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)
     )
 
 
diff --git a/Lib/test/test_perf_profiler.py b/Lib/test/test_perf_profiler.py
index 3ae4fff31155f9..43e5a7e114b317 100644
--- a/Lib/test/test_perf_profiler.py
+++ b/Lib/test/test_perf_profiler.py
@@ -17,7 +17,7 @@
 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")

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to