|
|
900f19 |
commit 86ed41792d394f804d2c9e695ac8b257220fbdee
|
|
|
900f19 |
Author: Victor Stinner <vstinner@redhat.com>
|
|
|
900f19 |
Date: Tue Mar 12 17:17:13 2019 +0100
|
|
|
900f19 |
|
|
|
900f19 |
Fix test_tarfile on ppc64
|
|
|
900f19 |
|
|
|
900f19 |
Fix sparse file tests of test_tarfile on ppc64le with the tmpfs
|
|
|
900f19 |
filesystem.
|
|
|
900f19 |
|
|
|
900f19 |
* https://bugzilla.redhat.com/show_bug.cgi?id=1639490
|
|
|
900f19 |
* https://bugs.python.org/issue35772
|
|
|
900f19 |
* https://github.com/python/cpython/commit/d1dd6be613381b996b9071443ef081de8e5f3aff
|
|
|
900f19 |
|
|
|
900f19 |
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
|
|
|
900f19 |
index 4cd7d53..bd8b05f 100644
|
|
|
900f19 |
--- a/Lib/test/test_tarfile.py
|
|
|
900f19 |
+++ b/Lib/test/test_tarfile.py
|
|
|
900f19 |
@@ -973,16 +973,21 @@ class GNUReadTest(LongnameTest, ReadTest, unittest.TestCase):
|
|
|
900f19 |
def _fs_supports_holes():
|
|
|
900f19 |
# Return True if the platform knows the st_blocks stat attribute and
|
|
|
900f19 |
# uses st_blocks units of 512 bytes, and if the filesystem is able to
|
|
|
900f19 |
- # store holes in files.
|
|
|
900f19 |
+ # store holes of 4 KiB in files.
|
|
|
900f19 |
+ #
|
|
|
900f19 |
+ # The function returns False if page size is larger than 4 KiB.
|
|
|
900f19 |
+ # For example, ppc64 uses pages of 64 KiB.
|
|
|
900f19 |
if sys.platform.startswith("linux"):
|
|
|
900f19 |
# Linux evidentially has 512 byte st_blocks units.
|
|
|
900f19 |
name = os.path.join(TEMPDIR, "sparse-test")
|
|
|
900f19 |
with open(name, "wb") as fobj:
|
|
|
900f19 |
+ # Seek to "punch a hole" of 4 KiB
|
|
|
900f19 |
fobj.seek(4096)
|
|
|
900f19 |
+ fobj.write(b'x' * 4096)
|
|
|
900f19 |
fobj.truncate()
|
|
|
900f19 |
s = os.stat(name)
|
|
|
900f19 |
support.unlink(name)
|
|
|
900f19 |
- return s.st_blocks == 0
|
|
|
900f19 |
+ return (s.st_blocks * 512 < s.st_size)
|
|
|
900f19 |
else:
|
|
|
900f19 |
return False
|
|
|
900f19 |
|