From a33766880e8fabfa421bee3252b486ebcfbde79b Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 27 Sep 2023 13:13:12 +1000 Subject: [PATCH] tests/extmod/deflate_decompress.py: Skip test when not enough memory. Signed-off-by: Damien George --- tests/extmod/deflate_decompress.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/extmod/deflate_decompress.py b/tests/extmod/deflate_decompress.py index 29d3ec2d71..3ac8880af2 100644 --- a/tests/extmod/deflate_decompress.py +++ b/tests/extmod/deflate_decompress.py @@ -6,6 +6,17 @@ except ImportError: print("SKIP") raise SystemExit +try: + # Check there's enough memory to deflate gzip streams. + # zlib.compress(b'', wbits=25) + empty_gzip = ( + b"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\x03\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00" + ) + deflate.DeflateIO(io.BytesIO(empty_gzip)).read() +except MemoryError: + print("SKIP") + raise SystemExit + # zlib.compress(b'micropython hello world hello world micropython', wbits=-9) data_raw = b'\xcb\xcdL.\xca/\xa8,\xc9\xc8\xcfS\xc8H\xcd\xc9\xc9W(\xcf/\xcaIAa\xe7"\xd4\x00\x00' # zlib.compress(b'micropython hello world hello world micropython', wbits=9)