-
-
Notifications
You must be signed in to change notification settings - Fork 33.2k
gh-125041: test_zlib: For s390x HW acceleration, only skip checking the compressed bytes #125042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,7 +6,7 @@ | |
| import pickle | ||
| import random | ||
| import sys | ||
| from test.support import bigmemtest, _1G, _4G, skip_on_s390x | ||
| from test.support import bigmemtest, _1G, _4G, is_s390x | ||
|
|
||
|
|
||
| zlib = import_helper.import_module('zlib') | ||
|
|
@@ -33,8 +33,10 @@ def _zlib_runtime_version_tuple(zlib_version=zlib.ZLIB_RUNTIME_VERSION): | |
| ZLIB_RUNTIME_VERSION_TUPLE = _zlib_runtime_version_tuple() | ||
|
|
||
|
|
||
| # bpo-46623: On s390x, when a hardware accelerator is used, using different | ||
| # ways to compress data with zlib can produce different compressed data. | ||
|
|
||
| # bpo-46623: When a hardware accelerator is used (currently only on s390x), | ||
| # using different ways to compress data with zlib can produce different | ||
| # compressed data. | ||
| # Simplified test_pair() code: | ||
| # | ||
| # def func1(data): | ||
|
|
@@ -57,8 +59,10 @@ def _zlib_runtime_version_tuple(zlib_version=zlib.ZLIB_RUNTIME_VERSION): | |
| # | ||
| # zlib.decompress(func1(data)) == zlib.decompress(func2(data)) == data | ||
| # | ||
| # Make the assumption that s390x always has an accelerator to simplify the skip | ||
| # condition. | ||
| # To simplify the skip condition, make the assumption that s390x always has an | ||
| # accelerator, and nothing else has it. | ||
| HW_ACCELERATED = is_s390x | ||
|
|
||
|
|
||
| class VersionTestCase(unittest.TestCase): | ||
|
|
||
|
|
@@ -223,12 +227,14 @@ def test_keywords(self): | |
| bufsize=zlib.DEF_BUF_SIZE), | ||
| HAMLET_SCENE) | ||
|
|
||
| @skip_on_s390x | ||
| def test_speech128(self): | ||
| # compress more data | ||
| data = HAMLET_SCENE * 128 | ||
| x = zlib.compress(data) | ||
| self.assertEqual(zlib.compress(bytearray(data)), x) | ||
| if not HW_ACCELERATED: | ||
| # With hardware acceleration, the compressed bytes | ||
| # might not be identical. | ||
|
||
| self.assertEqual(zlib.compress(bytearray(data)), x) | ||
| for ob in x, bytearray(x): | ||
| self.assertEqual(zlib.decompress(ob), data) | ||
|
|
||
|
|
@@ -275,7 +281,6 @@ def test_64bit_compress(self, size): | |
|
|
||
| class CompressObjectTestCase(BaseCompressTestCase, unittest.TestCase): | ||
| # Test compression object | ||
| @skip_on_s390x | ||
| def test_pair(self): | ||
| # straightforward compress/decompress objects | ||
| datasrc = HAMLET_SCENE * 128 | ||
|
|
@@ -286,7 +291,10 @@ def test_pair(self): | |
| x1 = co.compress(data) | ||
| x2 = co.flush() | ||
| self.assertRaises(zlib.error, co.flush) # second flush should not work | ||
| self.assertEqual(x1 + x2, datazip) | ||
| if not HW_ACCELERATED: | ||
| # With hardware acceleration, the compressed bytes might not | ||
| # be identical. | ||
encukou marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| self.assertEqual(x1 + x2, datazip) | ||
| for v1, v2 in ((x1, x2), (bytearray(x1), bytearray(x2))): | ||
| dco = zlib.decompressobj() | ||
| y1 = dco.decompress(v1 + v2) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Re-enable skipped tests for :mod:`zlib` on the s390x architecture: only skip | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems that NEWS isn't required for unittest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, it's not required. |
||
| checks of the compressed bytes, which can be different between zlib's | ||
| software implementation and the hardware-accelerated implementation. | ||
Uh oh!
There was an error while loading. Please reload this page.