summaryrefslogtreecommitdiff
path: root/test/cmd
diff options
context:
space:
mode:
authorMarek Vasut <marek.vasut+renesas@mailbox.org>2023-10-07 23:41:04 +0200
committerTom Rini <trini@konsulko.com>2023-12-09 08:42:29 -0500
commit8827a38714526adcff95271bac6a9bb49b9c0b83 (patch)
tree89e6a984cd75c14f2a65f4510b2bb252a87b090a /test/cmd
parent4823b05f01873826f063848bcad3446025917de2 (diff)
downloadu-boot-8827a38714526adcff95271bac6a9bb49b9c0b83.tar.gz
u-boot-8827a38714526adcff95271bac6a9bb49b9c0b83.tar.bz2
u-boot-8827a38714526adcff95271bac6a9bb49b9c0b83.zip
test: bdinfo: Test bdinfo -h
The bdinfo -h should print error message that -h is an unknown parameter and then command help text. Test the expected output. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Diffstat (limited to 'test/cmd')
-rw-r--r--test/cmd/bdinfo.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/cmd/bdinfo.c b/test/cmd/bdinfo.c
index 509a8b5c58..2f34d877e5 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);