]> git.baikalelectronics.ru Git - uboot.git/commit
dm: test: Clear the block cache after running a test
authorSimon Glass <sjg@chromium.org>
Sun, 30 Oct 2022 01:47:08 +0000 (19:47 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 7 Nov 2022 23:24:30 +0000 (16:24 -0700)
commit14a7d2919fee4332cd35a9b2a3321b1a32ccd000
tree52ab410f3ca011c24657c5498859efac5f93dc4a
parente849aa997354d16482b5d9e128cdf0bc76dc6b82
dm: test: Clear the block cache after running a test

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@chromium.org>
drivers/block/blkcache.c
include/blk.h
test/test-main.c