Skip to content

Commit 643dd51

Browse files
authored
gh-111178: Skip test_perf_profiler on function sanitizer (#132020)
Add 'function' parameter to check_sanitizer() of test.support.
1 parent f20f02e commit 643dd51

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Lib/test/support/__init__.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,8 @@ def skip_if_buildbot(reason=None):
409409
isbuildbot = False
410410
return unittest.skipIf(isbuildbot, reason)
411411

412-
def check_sanitizer(*, address=False, memory=False, ub=False, thread=False):
412+
def check_sanitizer(*, address=False, memory=False, ub=False, thread=False,
413+
function=True):
413414
"""Returns True if Python is compiled with sanitizer support"""
414415
if not (address or memory or ub or thread):
415416
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):
433434
'-fsanitize=thread' in cflags or
434435
'--with-thread-sanitizer' in config_args
435436
)
437+
function_sanitizer = (
438+
'-fsanitize=function' in cflags
439+
)
436440
return (
437441
(memory and memory_sanitizer) or
438442
(address and address_sanitizer) or
439443
(ub and ub_sanitizer) or
440-
(thread and thread_sanitizer)
444+
(thread and thread_sanitizer) or
445+
(function and function_sanitizer)
441446
)
442447

443448

Lib/test/test_perf_profiler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
if not support.has_subprocess_support:
1818
raise unittest.SkipTest("test module requires subprocess")
1919

20-
if support.check_sanitizer(address=True, memory=True, ub=True):
20+
if support.check_sanitizer(address=True, memory=True, ub=True, function=True):
2121
# gh-109580: Skip the test because it does crash randomly if Python is
2222
# built with ASAN.
2323
raise unittest.SkipTest("test crash randomly on ASAN/MSAN/UBSAN build")

0 commit comments

Comments
 (0)