Skip to content

Commit fd241d6

Browse files
[3.12] gh-126909: Fix running xattr tests on systems with lower limits (GH-126930) (#126964)
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 2c0a21c) Co-authored-by: Michał Górny <mgorny@gentoo.org>
1 parent 06dc4bd commit fd241d6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Lib/test/test_os.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3887,10 +3887,10 @@ def _check_xattrs_str(self, s, getxattr, setxattr, removexattr, listxattr, **kwa
38873887
xattr.remove("user.test")
38883888
self.assertEqual(set(listxattr(fn)), xattr)
38893889
self.assertEqual(getxattr(fn, s("user.test2"), **kwargs), b"foo")
3890-
setxattr(fn, s("user.test"), b"a"*1024, **kwargs)
3891-
self.assertEqual(getxattr(fn, s("user.test"), **kwargs), b"a"*1024)
3890+
setxattr(fn, s("user.test"), b"a"*256, **kwargs)
3891+
self.assertEqual(getxattr(fn, s("user.test"), **kwargs), b"a"*256)
38923892
removexattr(fn, s("user.test"), **kwargs)
3893-
many = sorted("user.test{}".format(i) for i in range(100))
3893+
many = sorted("user.test{}".format(i) for i in range(32))
38943894
for thing in many:
38953895
setxattr(fn, thing, b"x", **kwargs)
38963896
self.assertEqual(set(listxattr(fn)), set(init_xattr) | set(many))
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix test_os extended attribute tests to work on filesystems with 1 KiB xattr size
2+
limit.

0 commit comments

Comments
 (0)