mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
gh-108418: Speed up bigmem compression tests in dry mode (GH-108419)
Only generate and compress small amount of random data in dry run.
This commit is contained in:
parent
e59a95238b
commit
4ae3edf300
3 changed files with 6 additions and 6 deletions
|
@ -721,10 +721,10 @@ class BZ2DecompressorTest(BaseTest):
|
||||||
@bigmemtest(size=_4G + 100, memuse=3.3)
|
@bigmemtest(size=_4G + 100, memuse=3.3)
|
||||||
def testDecompress4G(self, size):
|
def testDecompress4G(self, size):
|
||||||
# "Test BZ2Decompressor.decompress() with >4GiB input"
|
# "Test BZ2Decompressor.decompress() with >4GiB input"
|
||||||
blocksize = 10 * 1024 * 1024
|
blocksize = min(10 * 1024 * 1024, size)
|
||||||
block = random.randbytes(blocksize)
|
block = random.randbytes(blocksize)
|
||||||
try:
|
try:
|
||||||
data = block * (size // blocksize + 1)
|
data = block * ((size-1) // blocksize + 1)
|
||||||
compressed = bz2.compress(data)
|
compressed = bz2.compress(data)
|
||||||
bz2d = BZ2Decompressor()
|
bz2d = BZ2Decompressor()
|
||||||
decompressed = bz2d.decompress(compressed)
|
decompressed = bz2d.decompress(compressed)
|
||||||
|
|
|
@ -352,10 +352,10 @@ class CompressorDecompressorTestCase(unittest.TestCase):
|
||||||
@bigmemtest(size=_4G + 100, memuse=3)
|
@bigmemtest(size=_4G + 100, memuse=3)
|
||||||
def test_decompressor_bigmem(self, size):
|
def test_decompressor_bigmem(self, size):
|
||||||
lzd = LZMADecompressor()
|
lzd = LZMADecompressor()
|
||||||
blocksize = 10 * 1024 * 1024
|
blocksize = min(10 * 1024 * 1024, size)
|
||||||
block = random.randbytes(blocksize)
|
block = random.randbytes(blocksize)
|
||||||
try:
|
try:
|
||||||
input = block * (size // blocksize + 1)
|
input = block * ((size-1) // blocksize + 1)
|
||||||
cdata = lzma.compress(input)
|
cdata = lzma.compress(input)
|
||||||
ddata = lzd.decompress(cdata)
|
ddata = lzd.decompress(cdata)
|
||||||
self.assertEqual(ddata, input)
|
self.assertEqual(ddata, input)
|
||||||
|
|
|
@ -989,10 +989,10 @@ class ZlibDecompressorTest(unittest.TestCase):
|
||||||
@bigmemtest(size=_4G + 100, memuse=3.3)
|
@bigmemtest(size=_4G + 100, memuse=3.3)
|
||||||
def testDecompress4G(self, size):
|
def testDecompress4G(self, size):
|
||||||
# "Test zlib._ZlibDecompressor.decompress() with >4GiB input"
|
# "Test zlib._ZlibDecompressor.decompress() with >4GiB input"
|
||||||
blocksize = 10 * 1024 * 1024
|
blocksize = min(10 * 1024 * 1024, size)
|
||||||
block = random.randbytes(blocksize)
|
block = random.randbytes(blocksize)
|
||||||
try:
|
try:
|
||||||
data = block * (size // blocksize + 1)
|
data = block * ((size-1) // blocksize + 1)
|
||||||
compressed = zlib.compress(data)
|
compressed = zlib.compress(data)
|
||||||
zlibd = zlib._ZlibDecompressor()
|
zlibd = zlib._ZlibDecompressor()
|
||||||
decompressed = zlibd.decompress(compressed)
|
decompressed = zlibd.decompress(compressed)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue