Skip to content

Commit 2c0a21c

Browse files
authored
gh-126909: Fix running xattr tests on systems with lower limits (#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.
1 parent f9c5573 commit 2c0a21c

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Diff for: Lib/test/test_os.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3967,10 +3967,10 @@ def _check_xattrs_str(self, s, getxattr, setxattr, removexattr, listxattr, **kwa
39673967
xattr.remove("user.test")
39683968
self.assertEqual(set(listxattr(fn)), xattr)
39693969
self.assertEqual(getxattr(fn, s("user.test2"), **kwargs), b"foo")
3970-
setxattr(fn, s("user.test"), b"a"*1024, **kwargs)
3971-
self.assertEqual(getxattr(fn, s("user.test"), **kwargs), b"a"*1024)
3970+
setxattr(fn, s("user.test"), b"a"*256, **kwargs)
3971+
self.assertEqual(getxattr(fn, s("user.test"), **kwargs), b"a"*256)
39723972
removexattr(fn, s("user.test"), **kwargs)
3973-
many = sorted("user.test{}".format(i) for i in range(100))
3973+
many = sorted("user.test{}".format(i) for i in range(32))
39743974
for thing in many:
39753975
setxattr(fn, thing, b"x", **kwargs)
39763976
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)