Skip to content

Commit b335875

Browse files
committed
pythongh-127076: Disable strace tests under LD_PRELOAD
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.
1 parent 0af4ec3 commit b335875

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Lib/test/support/strace_helper.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import re
22
import sys
33
import textwrap
4+
import os
45
import unittest
56
from dataclasses import dataclass
67
from functools import cache
@@ -163,6 +164,13 @@ def requires_strace():
163164
if sys.platform != "linux":
164165
return unittest.skip("Linux only, requires strace.")
165166

167+
if 'LD_PRELOAD' in os.environ:
168+
# Distribution packaging (ex. Debian `fakeroot` and Gentoo `sandbox`)
169+
# use LD_PRELOAD to intercept system calls, which changes the overall
170+
# set of system calls which breaks tests expecting a specific set of
171+
# system calls).
172+
return unittest.skip("Not supported when LD_PRELOAD is intercepting system calls.")
173+
166174
if support.check_sanitizer(address=True, memory=True):
167175
return unittest.skip("LeakSanitizer does not work under ptrace (strace, gdb, etc)")
168176

0 commit comments

Comments
 (0)