summaryrefslogtreecommitdiff
path: root/tests/vboot_api_kernel2_tests.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2018-10-16 19:36:48 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-11-16 05:01:45 -0800
commita0ae31871275b389ea0f8b99ee4de359970b7db6 (patch)
treef8a5a5867dfbe1fa9f1ee5ed21928bd8daa392e9 /tests/vboot_api_kernel2_tests.c
parent4586b0c1dea8af8fd603ee7f1a0f6271bdcc1963 (diff)
downloadvboot-a0ae31871275b389ea0f8b99ee4de359970b7db6.tar.gz
Add a screen showing a menu for alternative firmware
At present we allow the user to press a keypad number to boot into another bootloader but there is no indication which one is which. Add a new screen for this. It is entered via Ctrl-L and shows the available bootloaders, along with the number to press for each. The contents of the screen is rendered by the bootloader, as usual. This is supported by two new screens, one for the keyboard UI and one for the menu UI. Also a new function, VbExGetAltFwIdxMask(), is added to find out what bootloaders are available. Note: This CL combines changes for both UIs. The changes may be easier to review separately. CQ-DEPEND=CL:1273269 BUG=chromium:837018 BRANCH=none TEST=FEATURES=test emerge-grunt --nodeps vboot_reference Change-Id: Ib3227545dc677c8f9587944753e32f3b49647360 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1273268 Reviewed-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'tests/vboot_api_kernel2_tests.c')
-rw-r--r--tests/vboot_api_kernel2_tests.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index 2f76490a..2f1dee90 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -484,25 +484,49 @@ static void VbBootDevTest(void)
TEST_EQ(VbBootDeveloper(&ctx), 1002, "Ctrl+L normal");
TEST_EQ(vbexlegacy_called, 0, " not legacy");
+ /* Enter altfw menu and time out */
ResetMocks();
+ shutdown_request_calls_left = 1000;
sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
mock_keypress[0] = 0x0c;
+ TEST_EQ(VbBootDeveloper(&ctx), VBERROR_SHUTDOWN_REQUESTED,
+ "Ctrl+L force legacy");
+ TEST_EQ(vbexlegacy_called, 0, " try legacy");
+
+ /* Enter altfw menu and select firmware 0 */
+ ResetMocks();
+ sd->gbb_flags |= VB2_GBB_FLAG_FORCE_DEV_BOOT_LEGACY;
+ mock_keypress[0] = 0x0c;
+ mock_keypress[1] = '0';
TEST_EQ(VbBootDeveloper(&ctx), 1002,
"Ctrl+L force legacy");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
TEST_EQ(altfw_num, 0, " check altfw_num");
+ /* Enter altfw menu and then exit it */
+ ResetMocks();
+ vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_LEGACY, 1);
+ mock_keypress[0] = 0x0c;
+ mock_keypress[1] = VB_KEY_ESC;
+ TEST_EQ(VbBootDeveloper(&ctx), 1002,
+ "Ctrl+L nv legacy");
+ TEST_EQ(vbexlegacy_called, 0, " try legacy");
+
+ /* Enter altfw menu and select firmware 0 */
ResetMocks();
vb2_nv_set(&ctx, VB2_NV_DEV_BOOT_LEGACY, 1);
mock_keypress[0] = 0x0c;
+ mock_keypress[1] = '0';
TEST_EQ(VbBootDeveloper(&ctx), 1002,
"Ctrl+L nv legacy");
TEST_EQ(vbexlegacy_called, 1, " try legacy");
TEST_EQ(altfw_num, 0, " check altfw_num");
+ /* Enter altfw menu and select firmware 0 */
ResetMocks();
VbApiKernelGetFwmp()->flags |= FWMP_DEV_ENABLE_LEGACY;
mock_keypress[0] = 0x0c;
+ mock_keypress[1] = '0';
TEST_EQ(VbBootDeveloper(&ctx), 1002,
"Ctrl+L fwmp legacy");
TEST_EQ(vbexlegacy_called, 1, " fwmp legacy");