diff options
author | Julius Werner <jwerner@chromium.org> | 2018-03-22 14:38:11 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-26 20:16:25 -0700 |
commit | 3f896a5b638c26632098ff9fdf563686a55c10dd (patch) | |
tree | fda5cb41a2c31c90a634848e233802a0a2e28e55 /tests | |
parent | 754e56bff6911fdd667b6c03d8b7ba1269dba966 (diff) | |
download | vboot-3f896a5b638c26632098ff9fdf563686a55c10dd.tar.gz |
Add new GBB_FLAG_FORCE_MANUAL_RECOVERY
It seems like there are some testing use cases where we want the device
to boot into the recovery installer but it is impractical to fully
simulate a user-triggered recovery. This has become impossible with the
recent change to always require manual recovery to boot an image, even
when the developer mode switch is enabled (CL:924458).
This patch adds a new GBB flag to support this use case. When the flag
is set, all recovery mode is manual recovery mode, regardless of wheter
the developer mode switch is on or not.
Since the GBB_FLAG_ENABLE_SERIAL was killed off before it ever really
worked anyway, we can safely reuse the bit reserved for it.
BRANCH=None
BUG=None
TEST=make runtests, manually confirmed on Kevin
Change-Id: I4f51dfd20b4ff04c522f53596896dccbceee52dc
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/976660
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/vboot_api_kernel2_tests.c | 11 | ||||
-rw-r--r-- | tests/vboot_detach_menu_tests.c | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c index 2a714baa..b9e05157 100644 --- a/tests/vboot_api_kernel2_tests.c +++ b/tests/vboot_api_kernel2_tests.c @@ -605,6 +605,17 @@ static void VbBootRecTest(void) TEST_EQ(screens_displayed[0], VB_SCREEN_OS_BROKEN, " broken screen"); + /* Force insert screen with GBB flag */ + ResetMocks(); + shutdown_request_calls_left = 100; + sd->gbb_flags |= VB2_GBB_FLAG_FORCE_MANUAL_RECOVERY; + vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE; + TEST_EQ(VbBootRecovery(&ctx), + VBERROR_SHUTDOWN_REQUESTED, + "Insert (forced by GBB)"); + TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT, + " insert screen"); + /* No removal if recovery button physically pressed */ ResetMocks(); shutdown_request_calls_left = 100; diff --git a/tests/vboot_detach_menu_tests.c b/tests/vboot_detach_menu_tests.c index 3d30683a..f494dc91 100644 --- a/tests/vboot_detach_menu_tests.c +++ b/tests/vboot_detach_menu_tests.c @@ -1333,6 +1333,20 @@ static void VbBootRecTest(void) TEST_EQ(screens_count, 2, " no extra screens"); TEST_EQ(beeps_count, 0, " no beep on shutdown"); + /* go to INSERT if forced by GBB flag */ + ResetMocks(); + vbtlk_retval[0] = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE; + sd->gbb_flags |= GBB_FLAG_FORCE_MANUAL_RECOVERY; + TEST_EQ(VbBootRecoveryMenu(&ctx), VBERROR_SHUTDOWN_REQUESTED, + "Shutdown requested in INSERT forced by GBB flag"); + TEST_EQ(vb2_nv_get(&ctx, VB2_NV_RECOVERY_REQUEST), 0, " no recovery"); + TEST_EQ(debug_info_displayed, 0, " no debug info"); + TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT, + " insert screen"); + TEST_EQ(screens_displayed[1], VB_SCREEN_BLANK, " final blank screen"); + TEST_EQ(screens_count, 2, " no extra screens"); + TEST_EQ(beeps_count, 0, " no beep on shutdown"); + /* Stay at BROKEN if recovery button not physically pressed */ ResetMocksForManualRecovery(); vbtlk_retval[0] = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE; |