summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorCody Maloney <cmaloney@users.noreply.github.com>2024-11-21 09:33:12 (GMT)
committerGitHub <noreply@github.com>2024-11-21 09:33:12 (GMT)
commitff2278e2bf660155ca8f7c0529190ca59a41c13a (patch)
treea3faef0307e70fda6a1f9c1e18dda7b2850c7ad7 /Lib
parent1629d2ca56014beb2d46c42cc199a43ac97e3b97 (diff)
downloadcpython-ff2278e2bf660155ca8f7c0529190ca59a41c13a.zip
cpython-ff2278e2bf660155ca8f7c0529190ca59a41c13a.tar.gz
cpython-ff2278e2bf660155ca8f7c0529190ca59a41c13a.tar.bz2
gh-127076: Disable strace tests under LD_PRELOAD (#127086)
Distribution tooling (ex. sandbox on Gentoo and fakeroot on Debian) uses LD_PRELOAD to intercept system calls and potentially modify them when building. These tools can change the set of system calls, so disable system call testing under these cases. Co-authored-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/support/strace_helper.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/support/strace_helper.py b/Lib/test/support/strace_helper.py
index 7fb4581..90281b4 100644
--- a/Lib/test/support/strace_helper.py
+++ b/Lib/test/support/strace_helper.py
@@ -1,6 +1,7 @@
import re
import sys
import textwrap
+import os
import unittest
from dataclasses import dataclass
from functools import cache
@@ -163,6 +164,13 @@ def requires_strace():
if sys.platform != "linux":
return unittest.skip("Linux only, requires strace.")
+ if "LD_PRELOAD" in os.environ:
+ # Distribution packaging (ex. Debian `fakeroot` and Gentoo `sandbox`)
+ # use LD_PRELOAD to intercept system calls, which changes the overall
+ # set of system calls which breaks tests expecting a specific set of
+ # system calls).
+ return unittest.skip("Not supported when LD_PRELOAD is intercepting system calls.")
+
if support.check_sanitizer(address=True, memory=True):
return unittest.skip("LeakSanitizer does not work under ptrace (strace, gdb, etc)")