mirror of
https://github.com/esphome/esphome.git
synced 2026-10-01 08:50:22 +00:00
Ack chunks after the flash write on the inflate path and harden the decoder
Chunk acks again mean the block is in flash on both paths: the read callback writes and acks everything decoded so far before it waits for more input. The decoder rejects a negative distance symbol, initialises its whole state, and the flush feeds the watchdog once per window. The static_assert on the backend skips the static analysis build, which sets every define at once.
This commit is contained in:
@@ -186,7 +186,7 @@ async def test_host_ota_self_update(
|
||||
if "OTA staged at" in line:
|
||||
staged.set()
|
||||
# The host backend has no gzip support, so the upload negotiates deflate
|
||||
if "Inflated " in line:
|
||||
if " bytes from " in line:
|
||||
inflated.set()
|
||||
dev.on_log(line)
|
||||
|
||||
|
||||
@@ -1567,7 +1567,8 @@ def test_perform_ota_gzip_wins_over_deflate(mock_socket: Mock) -> None:
|
||||
espota2.perform_ota(mock_socket, None, io.BytesIO(original_content), "test.bin")
|
||||
|
||||
sent = [c[0][0] for c in mock_socket.sendall.call_args_list]
|
||||
compressed = gzip.compress(original_content, compresslevel=9)
|
||||
assert sent[3] == len(compressed).to_bytes(4, "big")
|
||||
assert sent[4] == hashlib.md5(compressed).hexdigest().encode()
|
||||
assert sent[5] == compressed
|
||||
# gzip output embeds the time of compression, so compare what it holds
|
||||
payload = sent[5]
|
||||
assert gzip.decompress(payload) == original_content
|
||||
assert sent[3] == len(payload).to_bytes(4, "big")
|
||||
assert sent[4] == hashlib.md5(payload).hexdigest().encode()
|
||||
|
||||
Reference in New Issue
Block a user