public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Udit Kumar <u-kumar1@ti.com>
To: <nm@ti.com>, <vigneshr@ti.com>, <patrick.delaunay@foss.st.com>,
	<sjoerd@collabora.com>, <sjg@google.com>, <trini@konsulko.com>
Cc: <u-boot@lists.denx.de>, <xypron.glpk@gmx.de>,
	<michal.simek@amd.com>, <dsankouski@gmail.com>,
	<kettenis@openbsd.org>, <sumit.garg@linaro.org>,
	<sam.shih@mediatek.com>, <mark.kettenis@xs4all.nl>,
	<sjg@chromium.org>, Udit Kumar <u-kumar1@ti.com>
Subject: [PATCH v2 2/2] test: lmb: Add test for coalescing and overlap range
Date: Tue, 26 Sep 2023 16:54:43 +0530	[thread overview]
Message-ID: <20230926112443.4190471-3-u-kumar1@ti.com> (raw)
In-Reply-To: <20230926112443.4190471-1-u-kumar1@ti.com>

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

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;
 }
 
-- 
2.34.1


  parent reply	other threads:[~2023-09-26 11:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 11:24 [PATCH v2 0/2] lmb: remove overlapping region with next range Udit Kumar
2023-09-26 11:24 ` [PATCH v2 1/2] " Udit Kumar
2023-10-10 12:58   ` Tom Rini
2023-09-26 11:24 ` Udit Kumar [this message]
2023-09-26 14:16   ` [PATCH v2 2/2] test: lmb: Add test for coalescing and overlap range Simon Glass
2023-10-10 12:58   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230926112443.4190471-3-u-kumar1@ti.com \
    --to=u-kumar1@ti.com \
    --cc=dsankouski@gmail.com \
    --cc=kettenis@openbsd.org \
    --cc=mark.kettenis@xs4all.nl \
    --cc=michal.simek@amd.com \
    --cc=nm@ti.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=sam.shih@mediatek.com \
    --cc=sjg@chromium.org \
    --cc=sjg@google.com \
    --cc=sjoerd@collabora.com \
    --cc=sumit.garg@linaro.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vigneshr@ti.com \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox