[PATCH 06/17] dm: test: Clear the block cache after running a test
Simon Glass
sjg at chromium.org
Sat Nov 5 20:55:46 CET 2022
Some tests access data in block devices and so cause the cache to fill
up. This results in memory being allocated.
Some tests check the malloc usage at the beginning and then again at the
end, to ensure there is no memory leak caused by the test. The block cache
makes this difficult, since the any test may cause entries to be allocated
or even freed, if the cache becomes full.
It is simpler to clear the block cache after each test. This ensures that
it will not introduce noise in tests which check malloc usage.
Add the logic to clear the cache, using the existing blkcache_invalidate()
function. Drop the duplicate code at the same time.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
drivers/block/blkcache.c | 23 ++++++++++-------------
include/blk.h | 9 +++++++--
test/test-main.c | 3 +++
3 files changed, 20 insertions(+), 15 deletions(-)
Applied to u-boot-dm, thanks!
More information about the U-Boot
mailing list