[RFC PATCH 24/31] test: lmb: add a test case for checking overlapping region add
Sughosh Ganu
sughosh.ganu at linaro.org
Fri Jun 7 20:52:33 CEST 2024
Memory managed by LMB is now persistent and global. With that, it
could be possible for multiple callers to try to add memory that has
already been added. Add a test case to check that the LMB module
handles it as expected.
Signed-off-by: Sughosh Ganu <sughosh.ganu at linaro.org>
---
test/lib/lmb.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index 260ebcfcd3..9b0e023b67 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -419,6 +419,22 @@ static int lib_test_lmb_at_0(struct unit_test_state *uts)
}
LIB_TEST(lib_test_lmb_at_0, 0);
+static int lib_test_lmb_overlapping_add(struct unit_test_state *uts)
+{
+ const phys_addr_t ram = 0x40000000;
+ const phys_size_t ram_size = 0x20000000;
+ long ret;
+
+ ret = lmb_add(ram, ram_size);
+ ut_asserteq(ret, 0);
+
+ ret = lmb_add(ram, ram_size);
+ ut_asserteq(ret, 0);
+
+ return 0;
+}
+LIB_TEST(lib_test_lmb_overlapping_add, 0);
+
/* Check that calling lmb_reserve with overlapping regions fails. */
static int lib_test_lmb_overlapping_reserve(struct unit_test_state *uts)
{
--
2.34.1
More information about the U-Boot
mailing list