diff mbox series

[v2,2/2] test: lmb: Add test for coalescing and overlap range

Message ID 20230926112443.4190471-3-u-kumar1@ti.com
State Accepted
Commit 4a6105e7830e9e945a6dc556a43ffaf26f0156e5
Delegated to: Tom Rini
Headers show
Series lmb: remove overlapping region with next range | expand

Commit Message

Udit Kumar Sept. 26, 2023, 11:24 a.m. UTC
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>
---
 test/lib/lmb.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Simon Glass Sept. 26, 2023, 2:16 p.m. UTC | #1
On Tue, 26 Sept 2023 at 05:25, Udit Kumar <u-kumar1@ti.com> wrote:
>
> 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>
> ---
>  test/lib/lmb.c | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini Oct. 10, 2023, 12:58 p.m. UTC | #2
On Tue, Sep 26, 2023 at 04:54:43PM +0530, Udit Kumar wrote:

> 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>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index 1628875035..15c68ce396 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;
 }