mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-21 22:18:36 +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:
parent
97b8833746
commit
cb9a8919e5
@ -861,11 +861,23 @@ class DebugLink:
|
|||||||
resp = self._read()
|
resp = self._read()
|
||||||
|
|
||||||
info = dict(sorted((item.name, item.value) for item in resp.items))
|
info = dict(sorted((item.name, item.value) for item in resp.items))
|
||||||
if self.prev_gc_info:
|
if info["total"]:
|
||||||
# Free heap memory should not decrease
|
LOG.debug(
|
||||||
assert info["free"] >= self.prev_gc_info["free"]
|
"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
|
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
|
del _make_input_func
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user