Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d1dd6be

Browse filesBrowse files
bpo-35772: Fix test_tarfile on ppc64 (GH-11606)
Fix sparse file tests of test_tarfile on ppc64le with the tmpfs filesystem. Fix the function testing if the filesystem supports sparse files: create a file which contains data and "holes", instead of creating a file which contains no data. tmpfs effective block size is a page size (tmpfs lives in the page cache). RHEL uses 64 KiB pages on aarch64, ppc64 and ppc64le, only s390x and x86_64 use 4 KiB pages, whereas the test punch holes of 4 KiB. test.pythoninfo: Add resource.getpagesize(). (cherry picked from commit b238545) Co-authored-by: Victor Stinner <vstinner@redhat.com>
1 parent d358a8c commit d1dd6be
Copy full SHA for d1dd6be

File tree

Expand file treeCollapse file tree

3 files changed

+15
-2
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+15
-2
lines changed

‎Lib/test/pythoninfo.py

Copy file name to clipboardExpand all lines: Lib/test/pythoninfo.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,8 @@ def collect_resource(info_add):
516516
value = resource.getrlimit(key)
517517
info_add('resource.%s' % name, value)
518518

519+
call_func(info_add, 'resource.pagesize', resource, 'getpagesize')
520+
519521

520522
def collect_test_socket(info_add):
521523
try:

‎Lib/test/test_tarfile.py

Copy file name to clipboardExpand all lines: Lib/test/test_tarfile.py
+7-2Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -973,16 +973,21 @@ def test_sparse_file_10(self):
973973
def _fs_supports_holes():
974974
# Return True if the platform knows the st_blocks stat attribute and
975975
# uses st_blocks units of 512 bytes, and if the filesystem is able to
976-
# store holes in files.
976+
# store holes of 4 KiB in files.
977+
#
978+
# The function returns False if page size is larger than 4 KiB.
979+
# For example, ppc64 uses pages of 64 KiB.
977980
if sys.platform.startswith("linux"):
978981
# Linux evidentially has 512 byte st_blocks units.
979982
name = os.path.join(TEMPDIR, "sparse-test")
980983
with open(name, "wb") as fobj:
984+
# Seek to "punch a hole" of 4 KiB
981985
fobj.seek(4096)
986+
fobj.write(b'x' * 4096)
982987
fobj.truncate()
983988
s = os.stat(name)
984989
support.unlink(name)
985-
return s.st_blocks == 0
990+
return (s.st_blocks * 512 < s.st_size)
986991
else:
987992
return False
988993

+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Fix sparse file tests of test_tarfile on ppc64 with the tmpfs filesystem. Fix
2+
the function testing if the filesystem supports sparse files: create a file
3+
which contains data and "holes", instead of creating a file which contains no
4+
data. tmpfs effective block size is a page size (tmpfs lives in the page cache).
5+
RHEL uses 64 KiB pages on aarch64, ppc64, ppc64le, only s390x and x86_64 use 4
6+
KiB pages, whereas the test punch holes of 4 KiB.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.