8000 [3.13] [tests] fix test_fcntl issue when run in a ChromeOS linux runt… · python/cpython@8fdc106 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8fdc106

Browse files
[3.13] [tests] fix test_fcntl issue when run in a ChromeOS linux runtime (GH-133053) (GH-133056)
[tests] fix test_fcntl issue when run in a ChromeOS linux runtime (GH-133053) * [tests] test_fcntl fails when run in a ChromeOS linux runtime container. It doesn't appear to support F_NOTIFY? Detect the lack of that and skip the test. (cherry picked from commit 355ee1a) Co-authored-by: Gregory P. Smith <greg@krypto.org>
1 parent fdcaaad commit 8fdc106

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Lib/test/test_fcntl.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Test program for the fcntl C module.
22
"""
3+
import errno
34
import multiprocessing
45
import platform
56
import os
@@ -135,16 +136,21 @@ def test_fcntl_bad_file_overflow(self):
135136
or platform.system() == "Android",
136137
"this platform returns EINVAL for F_NOTIFY DN_MULTISHOT")
137138
def test_fcntl_64_bit(self):
138-
# Issue #1309352: fcntl shouldn't fail when the third arg fits in a
139+
# Issue GH-42434: fcntl shouldn't fail when the third arg fits in a
139140
# C 'long' but not in a C 'int'.
140141
try:
141142
cmd = fcntl.F_NOTIFY
142-
# This flag is larger than 2**31 in 64-bit builds
143+
# DN_MULTISHOT is >= 2**31 in 64-bit builds
143144
flags = fcntl.DN_MULTISHOT
144145
except AttributeError:
145146
self.skipTest("F_NOTIFY or DN_MULTISHOT unavailable")
146147
fd = os.open(os.path.dirname(os.path.abspath(TESTFN)), os.O_RDONLY)
147148
try:
149+
try:
150+
fcntl.fcntl(fd, cmd, fcntl.DN_DELETE)
151+
except OSError as exc:
152+
if exc.errno == errno.EINVAL:
153+
self.skipTest("F_NOTIFY not available by this environment")
148154
fcntl.fcntl(fd, cmd, flags)
149155
finally:
150156
os.close(fd)

0 commit comments

Comments
 (0)
0