diff options
author | Simon Glass <sjg@chromium.org> | 2023-10-01 19:14:38 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-11-14 20:04:00 -0700 |
commit | 3fa53b9531c1db5e3be42014f2004786e9511f35 (patch) | |
tree | 54612c886104b00a78898970b17689645f789600 /test/boot/bootflow.c | |
parent | baea7ec6a63e38bd4a5815c6cafded972a91c148 (diff) |
bootstd: Add a return code to bootflow menu
Return an error when the user does not select an OS, so we know whether
to boot or not.
Move calling of bootflow_menu_run() into a separate function so we can
call it from other places.
Expand the test to cover these cases.
Add some documentation also, while we are here.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/boot/bootflow.c')
-rw-r--r-- | test/boot/bootflow.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/boot/bootflow.c b/test/boot/bootflow.c index 102b2b56135..b97c566f000 100644 --- a/test/boot/bootflow.c +++ b/test/boot/bootflow.c @@ -604,8 +604,12 @@ static int scan_mmc4_bootdev(struct unit_test_state *uts) /* Check 'bootflow menu' to select a bootflow */ static int bootflow_cmd_menu(struct unit_test_state *uts) { + struct bootstd_priv *std; char prev[3]; + /* get access to the current bootflow */ + ut_assertok(bootstd_get_priv(&std)); + ut_assertok(scan_mmc4_bootdev(uts)); /* Add keypresses to move to and select the second one in the list */ @@ -616,6 +620,17 @@ static int bootflow_cmd_menu(struct unit_test_state *uts) ut_assertok(run_command("bootflow menu", 0)); ut_assert_nextline("Selected: Armbian"); + ut_assertnonnull(std->cur_bootflow); + ut_assert_console_end(); + + /* Check not selecting anything */ + prev[0] = '\e'; + prev[1] = '\0'; + ut_asserteq(1, console_in_puts(prev)); + + ut_asserteq(1, run_command("bootflow menu", 0)); + ut_assertnull(std->cur_bootflow); + ut_assert_nextline("Nothing chosen"); ut_assert_console_end(); return 0; |