FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-35772: Fix test_tarfile _fs_supports_holes() by vstinner · Pull Request #11606 · python/cpython · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (2) .rst  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 2 additions & 0 deletions Lib/test/pythoninfo.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ def collect_resource(info_add):
value = resource.getrlimit(key)
info_add('resource.%s' % name, value)

call_func(info_add, 'resource.pagesize', resource, 'getpagesize')


def collect_test_socket(info_add):
try:
Expand Down
9 changes: 7 additions & 2 deletions Lib/test/test_tarfile.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -973,16 +973,21 @@ def test_sparse_file_10(self):
def _fs_supports_holes():
# Return True if the platform knows the st_blocks stat attribute and
# uses st_blocks units of 512 bytes, and if the filesystem is able to
# store holes in files.
# store holes of 4 KiB in files.
#
# The function returns False if page size is larger than 4 KiB.
# For example, ppc64 uses pages of 64 KiB.
if sys.platform.startswith("linux"):
# Linux evidentially has 512 byte st_blocks units.
name = os.path.join(TEMPDIR, "sparse-test")
with open(name, "wb") as fobj:
# Seek to "punch a hole" of 4 KiB
fobj.seek(4096)
fobj.write(b'x' * 4096)
fobj.truncate()
s = os.stat(name)
support.unlink(name)
return s.st_blocks == 0
return (s.st_blocks * 512 < s.st_size)
else:
return False

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Fix sparse file tests of test_tarfile on ppc64 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, ppc64le, only s390x and x86_64 use 4
KiB pages, whereas the test punch holes of 4 KiB.

Back | FazBrowse Home | New Git URL