Steffen Daode Nurpmeso <sdao...@googlemail.com> added the comment:
On Mon, 2 May 2011 01:22:41 +0200, STINNER Victor <rep...@bugs.python.org>
wrote:
> @sdaoden: Can you try on Python 2.7?
@haypo: Python 2.7 is absolute horror.
But i tried and produced a (terrible - i don't know the test
framework and that test_support stuff seems to have been changed
a lot since 2.7) 2 gigabyte+ big buffer test for 2.7.
(Of course: even though Python uses int, ZLib uses uInt.)
It took some time because i fell over #1202 from 2007 unprepared.
The (nasty) test works quite well on Apple, which is not such
a big surprise, because Apple's OS X is especially designed for
artists which need to work on large files, like video+ cutters,
sound designers with sample databases etc., so i would be
terribly disappointed if that wouldn't work! Apple even
propagandize OS X for, and makes money with that very application
task - i really couldn't understand your doubts here.
----------
Added file: http://bugs.python.org/file21855/11277-27.1.diff
_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue11277>
_______________________________________
diff --git a/Lib/test/test_zlib.py b/Lib/test/test_zlib.py
--- a/Lib/test/test_zlib.py
+++ b/Lib/test/test_zlib.py
@@ -1,10 +1,16 @@
import unittest
-from test import test_support
+from test.test_support import TESTFN, run_unittest, import_module, unlink,
requires
+from test.test_support import precisionbigmemtest, _1G, _2G
import binascii
import random
-from test.test_support import precisionbigmemtest, _1G
+import sys
-zlib = test_support.import_module('zlib')
+try:
+ import mmap
+except ImportError:
+ mmap = None
+
+zlib = import_module('zlib')
class ChecksumTestCase(unittest.TestCase):
@@ -66,6 +72,32 @@
zlib.crc32('spam', (2**31)))
+# Issue #10276 - check that inputs >=4GB are handled correctly.
+# Backport to 2.7 due to Issue #11277: why not verify INT32_MAX on 2.7?
+# Also take care of Issue #1202 here
+class ChecksumBigBufferTestCase(unittest.TestCase):
+ @unittest.skipUnless(mmap, "mmap() is not available.")
+ def test_big_buffer(self):
+ if sys.platform[:3] == 'win' or sys.platform == 'darwin':
+ requires('largefile',
+ 'test requires %s bytes and a long time to run' % str(_2G+2))
+ try:
+ with open(TESTFN, "wb+") as f:
+ f.seek(_2G-2)
+ f.write("asdf")
+ f.flush()
+ try:
+ m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
+ self.assertEqual(zlib.crc32(m), -2072986226)
+ self.assertEqual(zlib.adler32(m), -2072641121)
+ finally:
+ m.close()
+ except (IOError, OverflowError):
+ raise unittest.SkipTest("filesystem doesn't have largefile
support")
+ finally:
+ unlink(TESTFN)
+
+
class ExceptionTestCase(unittest.TestCase):
# make sure we generate some expected errors
def test_badlevel(self):
@@ -546,8 +578,9 @@
def test_main():
- test_support.run_unittest(
+ run_unittest(
ChecksumTestCase,
+ ChecksumBigBufferTestCase,
ExceptionTestCase,
CompressTestCase,
CompressObjectTestCase
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com