]> Git Repo - J-u-boot.git/commitdiff
test: lmb: Add test for coalescing and overlap range
authorUdit Kumar <[email protected]>
Tue, 26 Sep 2023 11:24:43 +0000 (16:54 +0530)
committerTom Rini <[email protected]>
Mon, 9 Oct 2023 19:24:31 +0000 (15:24 -0400)
Add test case for an address range which is coalescing with one of
range and overlapping with next range

Cc: Simon Glass <[email protected]>
Signed-off-by: Udit Kumar <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
test/lib/lmb.c

index 162887503588e89ccc7cc7fe156a453d2957597a..15c68ce3961b19a8b80308ca78b882b3443fb438 100644 (file)
@@ -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;
 }
 
This page took 0.035299 seconds and 4 git commands to generate.