0
0
mirror of https://github.com/python/cpython.git synced 2024-11-21 12:59:38 +01:00

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>
This commit is contained in:
Cody Maloney 2024-11-21 01:33:12 -08:00 committed by GitHub
parent 1629d2ca56
commit ff2278e2bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -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)")

View File

@ -0,0 +1 @@
Disable strace based system call tests when LD_PRELOAD is set.