aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUdit Kumar <u-kumar1@ti.com>2023-09-26 16:54:43 +0530
committerTom Rini <trini@konsulko.com>2023-10-09 15:24:31 -0400
commit4a6105e7830e9e945a6dc556a43ffaf26f0156e5 (patch)
tree6f2243dffc3a8e938f3852afd6e7cc7f972c7353
parentedb5824be17f018c76d094372a4573750be7c631 (diff)
downloadu-boot-4a6105e7830e9e945a6dc556a43ffaf26f0156e5.zip
u-boot-4a6105e7830e9e945a6dc556a43ffaf26f0156e5.tar.gz
u-boot-4a6105e7830e9e945a6dc556a43ffaf26f0156e5.tar.bz2
test: lmb: Add test for coalescing and overlap range
Add test case for an address range which is coalescing with one of range and overlapping with next range Cc: Simon Glass <sjg@google.com> Signed-off-by: Udit Kumar <u-kumar1@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--test/lib/lmb.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index 1628875..15c68ce 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -451,12 +451,23 @@ static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
ut_asserteq(ret, 0);
ASSERT_LMB(&lmb, ram, ram_size, 2, 0x40010000, 0x10000,
0x40030000, 0x10000, 0, 0);
- /* allocate 2nd region */
+ /* allocate 2nd region , This should coalesced all region into one */
ret = lmb_reserve(&lmb, 0x40020000, 0x10000);
ut_assert(ret >= 0);
ASSERT_LMB(&lmb, ram, ram_size, 1, 0x40010000, 0x30000,
0, 0, 0, 0);
+ /* allocate 2nd region, which should be added as first region */
+ ret = lmb_reserve(&lmb, 0x40000000, 0x8000);
+ ut_assert(ret >= 0);
+ ASSERT_LMB(&lmb, ram, ram_size, 2, 0x40000000, 0x8000,
+ 0x40010000, 0x30000, 0, 0);
+
+ /* allocate 3rd region, coalesce with first and overlap with second */
+ ret = lmb_reserve(&lmb, 0x40008000, 0x10000);
+ ut_assert(ret >= 0);
+ ASSERT_LMB(&lmb, ram, ram_size, 1, 0x40000000, 0x40000,
+ 0, 0, 0, 0);
return 0;
}