diff mbox series

[06/34] test: Handle use of stack pointer in bdinfo

Message ID 20231002011553.463514-7-sjg@chromium.org
State Accepted
Commit 80a8a2ebb34b4c2b99e41370ab42b8ed70ef2df5
Delegated to: Simon Glass
Headers show
Series x86: expo: Add support for editing coreboot CMOS RAM settings | expand

Commit Message

Simon Glass Oct. 2, 2023, 1:15 a.m. UTC
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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Simon Glass Dec. 13, 2023, 8:39 p.m. UTC | #1
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 | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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

Patch

diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 8c09281cac0d..0f09a5a3e1db 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -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);
 	}