]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-126909: Fix running xattr tests on systems with lower limits (GH-126930...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 18 Nov 2024 13:22:58 +0000 (14:22 +0100)
committerGitHub <noreply@github.com>
Mon, 18 Nov 2024 13:22:58 +0000 (13:22 +0000)
gh-126909: Fix running xattr tests on systems with lower limits (GH-126930)

Modify the extended attribute tests to write fewer and smaller extended
attributes, in order to fit within filesystems with total xattr limit
of 1 KiB (e.g. ext4 with 1 KiB blocks).  Previously, the test would
write over 2 KiB, making it fail with ENOSPC on such systems.
(cherry picked from commit 2c0a21c1aad65ab8362491acf856eb574b1257ad)

Co-authored-by: Michał Górny <mgorny@gentoo.org>
Lib/test/test_os.py
Misc/NEWS.d/next/Tests/2024-11-17-16-56-48.gh-issue-126909.60VTxW.rst [new file with mode: 0644]

index 8277ec9b608e846b269b3b4a466192f4e2f9149a..1d6d92e02356b465f9763b5b2bb28e018d64c0ec 100644 (file)
@@ -3887,10 +3887,10 @@ class ExtendedAttributeTests(unittest.TestCase):
         xattr.remove("user.test")
         self.assertEqual(set(listxattr(fn)), xattr)
         self.assertEqual(getxattr(fn, s("user.test2"), **kwargs), b"foo")
-        setxattr(fn, s("user.test"), b"a"*1024, **kwargs)
-        self.assertEqual(getxattr(fn, s("user.test"), **kwargs), b"a"*1024)
+        setxattr(fn, s("user.test"), b"a"*256, **kwargs)
+        self.assertEqual(getxattr(fn, s("user.test"), **kwargs), b"a"*256)
         removexattr(fn, s("user.test"), **kwargs)
-        many = sorted("user.test{}".format(i) for i in range(100))
+        many = sorted("user.test{}".format(i) for i in range(32))
         for thing in many:
             setxattr(fn, thing, b"x", **kwargs)
         self.assertEqual(set(listxattr(fn)), set(init_xattr) | set(many))
diff --git a/Misc/NEWS.d/next/Tests/2024-11-17-16-56-48.gh-issue-126909.60VTxW.rst b/Misc/NEWS.d/next/Tests/2024-11-17-16-56-48.gh-issue-126909.60VTxW.rst
new file mode 100644 (file)
index 0000000..68bd9ac
--- /dev/null
@@ -0,0 +1,2 @@
+Fix test_os extended attribute tests to work on filesystems with 1 KiB xattr size
+limit.