Skip to content

[tests] fix test_fcntl issue when run in a ChromeOS linux runtime #133053

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions Lib/test/test_fcntl.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Test program for the fcntl C module.
"""
import errno
import multiprocessing
import platform
import os
Expand Down Expand Up @@ -135,16 +136,21 @@ def test_fcntl_bad_file_overflow(self):
or platform.system() == "Android",
"this platform returns EINVAL for F_NOTIFY DN_MULTISHOT")
def test_fcntl_64_bit(self):
# Issue #1309352: fcntl shouldn't fail when the third arg fits in a
# Issue GH-42434: fcntl shouldn't fail when the third arg fits in a
# C 'long' but not in a C 'int'.
try:
cmd = fcntl.F_NOTIFY
# This flag is larger than 2**31 in 64-bit builds
# DN_MULTISHOT is >= 2**31 in 64-bit builds
flags = fcntl.DN_MULTISHOT
except AttributeError:
self.skipTest("F_NOTIFY or DN_MULTISHOT unavailable")
fd = os.open(os.path.dirname(os.path.abspath(TESTFN)), os.O_RDONLY)
try:
try:
fcntl.fcntl(fd, cmd, fcntl.DN_DELETE)
except OSError as exc:
if exc.errno == errno.EINVAL:
self.skipTest("F_NOTIFY not available by this environment")
fcntl.fcntl(fd, cmd, flags)
finally:
os.close(fd)
Expand Down
Loading