diff mbox series

[v2,8/9] test: bdinfo: Test bdinfo -m

Message ID 20231007214106.15744-8-marek.vasut+renesas@mailbox.org
State Accepted
Commit 2696f3ab8101d0037b4fca9b982595b2f935946d
Delegated to: Tom Rini
Headers show
Series [v2,1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a | expand

Commit Message

Marek Vasut Oct. 7, 2023, 9:41 p.m. UTC
The bdinfo -m should print only the board memory layout.
Test the expected output.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Bin Meng <bmeng.cn@gmail.com>
Cc: Mario Six <mario.six@gdsys.cc>
Cc: Nikhil M Jain <n-jain1@ti.com>
Cc: Simon Glass <sjg@chromium.org>
---
V2: Rename bdinfo_test_mem() to bdinfo_check_mem()
---
 test/cmd/bdinfo.c | 26 +++++++++++++++++++++++---
 1 file changed, 23 insertions(+), 3 deletions(-)

Comments

Simon Glass Oct. 7, 2023, 11:10 p.m. UTC | #1
On Sat, 7 Oct 2023 at 15:41, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> The bdinfo -m should print only the board memory layout.
> Test the expected output.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
> ---
> Cc: Bin Meng <bmeng.cn@gmail.com>
> Cc: Mario Six <mario.six@gdsys.cc>
> Cc: Nikhil M Jain <n-jain1@ti.com>
> Cc: Simon Glass <sjg@chromium.org>
> ---
> V2: Rename bdinfo_test_mem() to bdinfo_check_mem()
> ---
>  test/cmd/bdinfo.c | 26 +++++++++++++++++++++++---
>  1 file changed, 23 insertions(+), 3 deletions(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
diff mbox series

Patch

diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 2f34d877e5c..c9be182e370 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -130,13 +130,11 @@  static int lmb_test_dump_all(struct unit_test_state *uts, struct lmb *lmb)
 	return 0;
 }
 
-static int bdinfo_test_all(struct unit_test_state *uts)
+static int bdinfo_check_mem(struct unit_test_state *uts)
 {
 	struct bd_info *bd = gd->bd;
 	int i;
 
-	ut_assertok(test_num_l(uts, "boot_params", 0));
-
 	for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
 		if (bd->bi_dram[i].size) {
 			ut_assertok(test_num_l(uts, "DRAM bank", i));
@@ -147,6 +145,15 @@  static int bdinfo_test_all(struct unit_test_state *uts)
 		}
 	}
 
+	return 0;
+}
+
+static int bdinfo_test_all(struct unit_test_state *uts)
+{
+	ut_assertok(test_num_l(uts, "boot_params", 0));
+
+	ut_assertok(bdinfo_check_mem(uts));
+
 	/* CONFIG_SYS_HAS_SRAM testing not supported */
 	ut_assertok(test_num_l(uts, "flashstart", 0));
 	ut_assertok(test_num_l(uts, "flashsize", 0));
@@ -243,6 +250,19 @@  static int bdinfo_test_help(struct unit_test_state *uts)
 
 BDINFO_TEST(bdinfo_test_help, UT_TESTF_CONSOLE_REC);
 
+static int bdinfo_test_memory(struct unit_test_state *uts)
+{
+	/* Test BDINFO memory layout only print */
+	ut_assertok(console_record_reset_enable());
+	ut_assertok(run_commandf("bdinfo -m"));
+	ut_assertok(bdinfo_check_mem(uts));
+	ut_assertok(ut_check_console_end(uts));
+
+	return 0;
+}
+
+BDINFO_TEST(bdinfo_test_memory, UT_TESTF_CONSOLE_REC);
+
 int do_ut_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct unit_test *tests = UNIT_TEST_SUITE_START(bdinfo_test);