* [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a
@ 2023-09-20 22:58 Marek Vasut
2023-09-20 22:58 ` [PATCH 2/9] cmd: bdinfo: Implement support for printing memory layout via bdinfo -m Marek Vasut
` (8 more replies)
0 siblings, 9 replies; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
Add optional support for getopt() and in case this is enabled via
GETOPT configuration option, implement support for 'bdinfo -a'.
The 'bdinfo -a' behaves exactly like bdinfo and prints 'all' the
bdinfo information. This is implemented in preparation for other
more fine-grained options.
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>
---
cmd/bdinfo.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 1fe13ca13a0..2c0d5e9c01b 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -10,6 +10,7 @@
#include <command.h>
#include <dm.h>
#include <env.h>
+#include <getopt.h>
#include <lmb.h>
#include <mapmem.h>
#include <net.h>
@@ -133,10 +134,8 @@ static void print_serial(struct udevice *dev)
bdinfo_print_num_l(" clock", info.clock);
}
-int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+static int bdinfo_print_all(struct bd_info *bd)
{
- struct bd_info *bd = gd->bd;
-
#ifdef DEBUG
bdinfo_print_num_l("bd address", (ulong)bd);
#endif
@@ -184,8 +183,30 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return 0;
}
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+ struct bd_info *bd = gd->bd;
+ struct getopt_state gs;
+ int opt;
+
+ if (!CONFIG_IS_ENABLED(GETOPT) || argc == 1)
+ return bdinfo_print_all(bd);
+
+ getopt_init_state(&gs);
+ while ((opt = getopt(&gs, argc, argv, "a")) > 0) {
+ switch (opt) {
+ case 'a':
+ return bdinfo_print_all(bd);
+ default:
+ return CMD_RET_USAGE;
+ }
+ }
+
+ return CMD_RET_USAGE;
+}
+
U_BOOT_CMD(
- bdinfo, 1, 1, do_bdinfo,
+ bdinfo, 2, 1, do_bdinfo,
"print Board Info structure",
""
);
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 2/9] cmd: bdinfo: Implement support for printing memory layout via bdinfo -m
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
@ 2023-09-20 22:58 ` Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 3/9] cmd: bdinfo: Implement support for printing ethernet settings via bdinfo -e Marek Vasut
` (7 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
Add support for printing memory layout only via 'bdinfo -m' .
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>
---
cmd/bdinfo.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 2c0d5e9c01b..c720ee6f9b6 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -193,10 +193,13 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return bdinfo_print_all(bd);
getopt_init_state(&gs);
- while ((opt = getopt(&gs, argc, argv, "a")) > 0) {
+ while ((opt = getopt(&gs, argc, argv, "am")) > 0) {
switch (opt) {
case 'a':
return bdinfo_print_all(bd);
+ case 'm':
+ print_bi_dram(bd);
+ return CMD_RET_SUCCESS;
default:
return CMD_RET_USAGE;
}
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 3/9] cmd: bdinfo: Implement support for printing ethernet settings via bdinfo -e
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
2023-09-20 22:58 ` [PATCH 2/9] cmd: bdinfo: Implement support for printing memory layout via bdinfo -m Marek Vasut
@ 2023-09-20 22:58 ` Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 4/9] configs: sandbox: Enable GETOPT for sandbox and sandbox64 target Marek Vasut
` (6 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
Add support for printing ethernet settings only via 'bdinfo -e' .
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>
---
cmd/bdinfo.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index c720ee6f9b6..79106caeec2 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -193,10 +193,15 @@ int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
return bdinfo_print_all(bd);
getopt_init_state(&gs);
- while ((opt = getopt(&gs, argc, argv, "am")) > 0) {
+ while ((opt = getopt(&gs, argc, argv, "aem")) > 0) {
switch (opt) {
case 'a':
return bdinfo_print_all(bd);
+ case 'e':
+ if (!IS_ENABLED(CONFIG_CMD_NET))
+ return CMD_RET_USAGE;
+ print_eth();
+ return CMD_RET_SUCCESS;
case 'm':
print_bi_dram(bd);
return CMD_RET_SUCCESS;
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 4/9] configs: sandbox: Enable GETOPT for sandbox and sandbox64 target
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
2023-09-20 22:58 ` [PATCH 2/9] cmd: bdinfo: Implement support for printing memory layout via bdinfo -m Marek Vasut
2023-09-20 22:58 ` [PATCH 3/9] cmd: bdinfo: Implement support for printing ethernet settings via bdinfo -e Marek Vasut
@ 2023-09-20 22:58 ` Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 5/9] test: bdinfo: Rename bdinfo_test_move() to bdinfo_test_full() Marek Vasut
` (5 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
Enable GETOPT so that 'bdinfo' command with getopt() support can be
tested in CI.
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>
---
configs/sandbox64_defconfig | 1 +
configs/sandbox_defconfig | 1 +
2 files changed, 2 insertions(+)
diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig
index fd110d99a3a..8aef76a5c00 100644
--- a/configs/sandbox64_defconfig
+++ b/configs/sandbox64_defconfig
@@ -262,6 +262,7 @@ CONFIG_CMD_DHRYSTONE=y
CONFIG_TPM=y
CONFIG_LZ4=y
CONFIG_ERRNO_STR=y
+CONFIG_GETOPT=y
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
CONFIG_EFI_CAPSULE_ON_DISK=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index d667cb9ae47..ca54e445426 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -338,6 +338,7 @@ CONFIG_ECDSA_VERIFY=y
CONFIG_TPM=y
CONFIG_SHA384=y
CONFIG_ERRNO_STR=y
+CONFIG_GETOPT=y
CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
CONFIG_EFI_CAPSULE_ON_DISK=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 5/9] test: bdinfo: Rename bdinfo_test_move() to bdinfo_test_full()
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
` (2 preceding siblings ...)
2023-09-20 22:58 ` [PATCH 4/9] configs: sandbox: Enable GETOPT for sandbox and sandbox64 target Marek Vasut
@ 2023-09-20 22:58 ` Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 6/9] test: bdinfo: Test both bdinfo and bdinfo -a Marek Vasut
` (4 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
Rename bdinfo_test_move() to bdinfo_test_full(). The former is a
remnant of deriving this test from another test. No functional
change.
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>
---
test/cmd/bdinfo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 8c09281cac0..b2896e8eb41 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -130,7 +130,7 @@ static int lmb_test_dump_all(struct unit_test_state *uts, struct lmb *lmb)
return 0;
}
-static int bdinfo_test_move(struct unit_test_state *uts)
+static int bdinfo_test_full(struct unit_test_state *uts)
{
struct bd_info *bd = gd->bd;
int i;
@@ -217,7 +217,7 @@ static int bdinfo_test_move(struct unit_test_state *uts)
return 0;
}
-BDINFO_TEST(bdinfo_test_move, UT_TESTF_CONSOLE_REC);
+BDINFO_TEST(bdinfo_test_full, UT_TESTF_CONSOLE_REC);
int do_ut_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
{
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 6/9] test: bdinfo: Test both bdinfo and bdinfo -a
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
` (3 preceding siblings ...)
2023-09-20 22:58 ` [PATCH 5/9] test: bdinfo: Rename bdinfo_test_move() to bdinfo_test_full() Marek Vasut
@ 2023-09-20 22:58 ` Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 7/9] test: bdinfo: Test bdinfo -h Marek Vasut
` (3 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
Factor out the core of test for all bdinfo output into bdinfo_test_all()
and then reuse it to verify that both 'bdinfo' and 'bdinfo -a' print all
the bdinfo 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>
---
test/cmd/bdinfo.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index b2896e8eb41..509a8b5c586 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -130,15 +130,11 @@ static int lmb_test_dump_all(struct unit_test_state *uts, struct lmb *lmb)
return 0;
}
-static int bdinfo_test_full(struct unit_test_state *uts)
+static int bdinfo_test_all(struct unit_test_state *uts)
{
struct bd_info *bd = gd->bd;
int i;
- /* Test moving the working BDINFO to a new location */
- ut_assertok(console_record_reset_enable());
- ut_assertok(run_commandf("bdinfo"));
-
ut_assertok(test_num_l(uts, "boot_params", 0));
for (i = 0; i < CONFIG_NR_DRAM_BANKS; ++i) {
@@ -212,6 +208,17 @@ static int bdinfo_test_full(struct unit_test_state *uts)
ut_assertok(test_num_l(uts, "malloc base", gd_malloc_start()));
}
+ return 0;
+}
+
+static int bdinfo_test_full(struct unit_test_state *uts)
+{
+ /* Test BDINFO full print */
+ ut_assertok(console_record_reset_enable());
+ ut_assertok(run_commandf("bdinfo"));
+ ut_assertok(bdinfo_test_all(uts));
+ ut_assertok(run_commandf("bdinfo -a"));
+ ut_assertok(bdinfo_test_all(uts));
ut_assertok(ut_check_console_end(uts));
return 0;
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 7/9] test: bdinfo: Test bdinfo -h
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
` (4 preceding siblings ...)
2023-09-20 22:58 ` [PATCH 6/9] test: bdinfo: Test both bdinfo and bdinfo -a Marek Vasut
@ 2023-09-20 22:58 ` Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 8/9] test: bdinfo: Test bdinfo -m Marek Vasut
` (2 subsequent siblings)
8 siblings, 1 reply; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
The bdinfo -h should print error message that -h is an unknown
parameter and then command help text. 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>
---
test/cmd/bdinfo.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 509a8b5c586..2f34d877e5c 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -226,6 +226,23 @@ static int bdinfo_test_full(struct unit_test_state *uts)
BDINFO_TEST(bdinfo_test_full, UT_TESTF_CONSOLE_REC);
+static int bdinfo_test_help(struct unit_test_state *uts)
+{
+ /* Test BDINFO unknown option help text print */
+ ut_assertok(console_record_reset_enable());
+ ut_asserteq(1, run_commandf("bdinfo -h"));
+ ut_assert_nextlinen("bdinfo: invalid option -- h");
+ ut_assert_nextlinen("bdinfo - print Board Info structure");
+ ut_assert_nextline_empty();
+ ut_assert_nextlinen("Usage:");
+ ut_assert_nextlinen("bdinfo");
+ ut_assertok(ut_check_console_end(uts));
+
+ return 0;
+}
+
+BDINFO_TEST(bdinfo_test_help, 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);
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 8/9] test: bdinfo: Test bdinfo -m
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
` (5 preceding siblings ...)
2023-09-20 22:58 ` [PATCH 7/9] test: bdinfo: Test bdinfo -h Marek Vasut
@ 2023-09-20 22:58 ` Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 9/9] test: bdinfo: Test bdinfo -e Marek Vasut
2023-09-22 18:27 ` [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Simon Glass
8 siblings, 1 reply; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
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>
---
test/cmd/bdinfo.c | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 2f34d877e5c..f090667fb42 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_test_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_test_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_test_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);
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 9/9] test: bdinfo: Test bdinfo -e
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
` (6 preceding siblings ...)
2023-09-20 22:58 ` [PATCH 8/9] test: bdinfo: Test bdinfo -m Marek Vasut
@ 2023-09-20 22:58 ` Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-22 18:27 ` [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Simon Glass
8 siblings, 1 reply; 18+ messages in thread
From: Marek Vasut @ 2023-09-20 22:58 UTC (permalink / raw)
To: u-boot; +Cc: Marek Vasut, Bin Meng, Mario Six, Nikhil M Jain, Simon Glass
The bdinfo -e should print only the board ethernet settings.
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>
---
test/cmd/bdinfo.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index f090667fb42..6caee4b0b50 100644
--- a/test/cmd/bdinfo.c
+++ b/test/cmd/bdinfo.c
@@ -263,6 +263,20 @@ static int bdinfo_test_memory(struct unit_test_state *uts)
BDINFO_TEST(bdinfo_test_memory, UT_TESTF_CONSOLE_REC);
+static int bdinfo_test_eth(struct unit_test_state *uts)
+{
+ /* Test BDINFO ethernet settings only print */
+ ut_assertok(console_record_reset_enable());
+ ut_assertok(run_commandf("bdinfo -e"));
+ if (IS_ENABLED(CONFIG_CMD_NET))
+ ut_assertok(test_eth(uts));
+ ut_assertok(ut_check_console_end(uts));
+
+ return 0;
+}
+
+BDINFO_TEST(bdinfo_test_eth, 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);
--
2.40.1
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
` (7 preceding siblings ...)
2023-09-20 22:58 ` [PATCH 9/9] test: bdinfo: Test bdinfo -e Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
8 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Add optional support for getopt() and in case this is enabled via
> GETOPT configuration option, implement support for 'bdinfo -a'.
> The 'bdinfo -a' behaves exactly like bdinfo and prints 'all' the
> bdinfo information. This is implemented in preparation for other
> more fine-grained options.
>
> 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>
> ---
> cmd/bdinfo.c | 29 +++++++++++++++++++++++++----
> 1 file changed, 25 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/9] cmd: bdinfo: Implement support for printing memory layout via bdinfo -m
2023-09-20 22:58 ` [PATCH 2/9] cmd: bdinfo: Implement support for printing memory layout via bdinfo -m Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
0 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Add support for printing memory layout only via 'bdinfo -m' .
>
> 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>
> ---
> cmd/bdinfo.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 3/9] cmd: bdinfo: Implement support for printing ethernet settings via bdinfo -e
2023-09-20 22:58 ` [PATCH 3/9] cmd: bdinfo: Implement support for printing ethernet settings via bdinfo -e Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
0 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Add support for printing ethernet settings only via 'bdinfo -e' .
>
> 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>
> ---
> cmd/bdinfo.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 5/9] test: bdinfo: Rename bdinfo_test_move() to bdinfo_test_full()
2023-09-20 22:58 ` [PATCH 5/9] test: bdinfo: Rename bdinfo_test_move() to bdinfo_test_full() Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
0 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Rename bdinfo_test_move() to bdinfo_test_full(). The former is a
> remnant of deriving this test from another test. No functional
> change.
>
> 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>
> ---
> test/cmd/bdinfo.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 4/9] configs: sandbox: Enable GETOPT for sandbox and sandbox64 target
2023-09-20 22:58 ` [PATCH 4/9] configs: sandbox: Enable GETOPT for sandbox and sandbox64 target Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
0 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Enable GETOPT so that 'bdinfo' command with getopt() support can be
> tested in CI.
>
> 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>
> ---
> configs/sandbox64_defconfig | 1 +
> configs/sandbox_defconfig | 1 +
> 2 files changed, 2 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 6/9] test: bdinfo: Test both bdinfo and bdinfo -a
2023-09-20 22:58 ` [PATCH 6/9] test: bdinfo: Test both bdinfo and bdinfo -a Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
0 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> Factor out the core of test for all bdinfo output into bdinfo_test_all()
> and then reuse it to verify that both 'bdinfo' and 'bdinfo -a' print all
> the bdinfo 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>
> ---
> test/cmd/bdinfo.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 7/9] test: bdinfo: Test bdinfo -h
2023-09-20 22:58 ` [PATCH 7/9] test: bdinfo: Test bdinfo -h Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
0 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> The bdinfo -h should print error message that -h is an unknown
> parameter and then command help text. 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>
> ---
> test/cmd/bdinfo.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
e
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 8/9] test: bdinfo: Test bdinfo -m
2023-09-20 22:58 ` [PATCH 8/9] test: bdinfo: Test bdinfo -m Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
0 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, 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>
> ---
> test/cmd/bdinfo.c | 26 +++++++++++++++++++++++---
> 1 file changed, 23 insertions(+), 3 deletions(-)
>
> diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
> index 2f34d877e5c..f090667fb42 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_test_mem(struct unit_test_state *uts)
Since this is not a standalone test now, I think the word 'check' is
better than test. I try to reserve ''test' for a top-level test that
can be run.
> {
> 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_test_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_test_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);
> --
> 2.40.1
>
Regards,
Simon
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 9/9] test: bdinfo: Test bdinfo -e
2023-09-20 22:58 ` [PATCH 9/9] test: bdinfo: Test bdinfo -e Marek Vasut
@ 2023-09-22 18:27 ` Simon Glass
0 siblings, 0 replies; 18+ messages in thread
From: Simon Glass @ 2023-09-22 18:27 UTC (permalink / raw)
To: Marek Vasut; +Cc: u-boot, Bin Meng, Mario Six, Nikhil M Jain
On Wed, 20 Sept 2023 at 16:58, Marek Vasut
<marek.vasut+renesas@mailbox.org> wrote:
>
> The bdinfo -e should print only the board ethernet settings.
> 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>
> ---
> test/cmd/bdinfo.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2023-09-22 18:30 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20 22:58 [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Marek Vasut
2023-09-20 22:58 ` [PATCH 2/9] cmd: bdinfo: Implement support for printing memory layout via bdinfo -m Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 3/9] cmd: bdinfo: Implement support for printing ethernet settings via bdinfo -e Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 4/9] configs: sandbox: Enable GETOPT for sandbox and sandbox64 target Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 5/9] test: bdinfo: Rename bdinfo_test_move() to bdinfo_test_full() Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 6/9] test: bdinfo: Test both bdinfo and bdinfo -a Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 7/9] test: bdinfo: Test bdinfo -h Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 8/9] test: bdinfo: Test bdinfo -m Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-20 22:58 ` [PATCH 9/9] test: bdinfo: Test bdinfo -e Marek Vasut
2023-09-22 18:27 ` Simon Glass
2023-09-22 18:27 ` [PATCH 1/9] cmd: bdinfo: Optionally use getopt and implement bdinfo -a Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.