]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: Handle use of stack pointer in bdinfo
authorSimon Glass <sjg@chromium.org>
Mon, 2 Oct 2023 01:15:16 +0000 (19:15 -0600)
committerTom Rini <trini@konsulko.com>
Wed, 13 Dec 2023 23:39:05 +0000 (18:39 -0500)
This test assumes that the stack pointer is the same across two calls
to lmb_init_and_reserve() but this is not the case on x86, for example.

Add a special case to handle this, along with a detailed comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
test/cmd/bdinfo.c

index 053f2224919d354939ce77db698e04accde62f38..e4632742887affd005b15b6bf1b1beedb766dea1 100644 (file)
@@ -114,6 +114,18 @@ static int lmb_test_dump_region(struct unit_test_state *uts,
                end = base + size - 1;
                flags = rgn->region[i].flags;
 
+               /*
+                * this entry includes the stack (get_sp()) on many platforms
+                * so will different each time lmb_init_and_reserve() is called.
+                * We could instead have the bdinfo command put its lmb region
+                * in a known location, so we can check it directly, rather than
+                * calling lmb_init_and_reserve() to create a new (and hopefully
+                * identical one). But for now this seems good enough.
+                */
+               if (!IS_ENABLED(CONFIG_SANDBOX) && i == 3) {
+                       ut_assert_nextlinen(" %s[%d]\t[", name, i);
+                       continue;
+               }
                ut_assert_nextline(" %s[%d]\t[0x%llx-0x%llx], 0x%08llx bytes flags: %x",
                                   name, i, base, end, size, flags);
        }