From 544cba8cb57dd7f7cb32c24c34e2eaefcc07ea05 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 27 Apr 2025 11:15:00 -0700 Subject: [PATCH 1/2] [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. --- Lib/test/test_fcntl.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py index bb784cbe2ce036..f7c5ff6052c78b 100644 --- a/Lib/test/test_fcntl.py +++ b/Lib/test/test_fcntl.py @@ -1,5 +1,6 @@ """Test program for the fcntl C module. """ +import errno import multiprocessing import platform import os @@ -139,12 +140,17 @@ def test_fcntl_64_bit(self): # 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) From 72026def44526ab0f84fa637af30218dc8cd8364 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Sun, 27 Apr 2025 11:25:27 -0700 Subject: [PATCH 2/2] update the bug ref to GH- --- Lib/test/test_fcntl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_fcntl.py b/Lib/test/test_fcntl.py index f7c5ff6052c78b..b84c98ef3a2972 100644 --- a/Lib/test/test_fcntl.py +++ b/Lib/test/test_fcntl.py @@ -136,7 +136,7 @@ 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