1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-07-19 13:08:14 +00:00

test(core): don't fail next tests in case of a GC leak

Also, add more details to the assertion failure message.

[no changelog]
This commit is contained in:
Roman Zeyde 2025-06-11 10:56:07 +03:00 committed by Roman Zeyde
parent 97b8833746
commit cb9a8919e5

View File

@ -861,11 +861,23 @@ class DebugLink:
resp = self._read()
info = dict(sorted((item.name, item.value) for item in resp.items))
if self.prev_gc_info:
# Free heap memory should not decrease
assert info["free"] >= self.prev_gc_info["free"]
if info["total"]:
LOG.debug(
"GC info: free=%.2f%% max_free=%.2f%%",
100 * info["free"] / info["total"],
100 * info["max_free"] / info["total"],
)
prev_info = self.prev_gc_info
self.prev_gc_info = info
if not prev_info:
return
# Free heap memory should not decrease
if info["free"] < prev_info["free"]:
msg = f"GC leak found: {prev_info} -> {info}"
raise AssertionError(msg)
del _make_input_func