Instead of a randomly selected address, use an LMB allocated one for
reading the file into memory. With the LMB map now being persistent
and global, the address used for reading the file might be already
allocated as non-overwritable, resulting in a failure. Get a valid
address from LMB and then read the file to that address.

Signed-off-by: Sughosh Ganu <sughosh.g...@linaro.org>
---
 test/boot/cedit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/test/boot/cedit.c b/test/boot/cedit.c
index aa41719048..1f4147da89 100644
--- a/test/boot/cedit.c
+++ b/test/boot/cedit.c
@@ -8,6 +8,7 @@
 #include <cedit.h>
 #include <env.h>
 #include <expo.h>
+#include <lmb.h>
 #include <mapmem.h>
 #include <dm/ofnode.h>
 #include <test/ut.h>
@@ -62,7 +63,7 @@ static int cedit_fdt(struct unit_test_state *uts)
        struct video_priv *vid_priv;
        extern struct expo *cur_exp;
        struct scene_obj_menu *menu;
-       ulong addr = 0x1000;
+       ulong addr;
        struct ofprop prop;
        struct scene *scn;
        oftree tree;
@@ -87,6 +88,8 @@ static int cedit_fdt(struct unit_test_state *uts)
        str = abuf_data(&tline->buf);
        strcpy(str, "my-machine");
 
+       addr = lmb_alloc(1024, 1024);
+       ut_asserteq(!!addr, !0);
        ut_assertok(run_command("cedit write_fdt hostfs - settings.dtb", 0));
        ut_assertok(run_commandf("load hostfs - %lx settings.dtb", addr));
        ut_assert_nextlinen("1024 bytes read");
-- 
2.34.1

Reply via email to