summaryrefslogtreecommitdiff
path: root/tests/vboot_api_kernel2_tests.c
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2013-12-13 14:41:47 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-16 22:57:58 +0000
commit04171532583052935121a3e33550cc39ef2625ec (patch)
tree9e8b9350d8c2e16a9114150a552e97604340cb49 /tests/vboot_api_kernel2_tests.c
parent1aa59b0ea545d571f24a64af71f412fb214e4f82 (diff)
downloadvboot-04171532583052935121a3e33550cc39ef2625ec.tar.gz
There is some inherent latency between the time the USB root hub is initialized and the time USB devices are detected. This can lead to a situation where USB media is attached, yet not found when we do our initial device poll. The device may be detected in subsequent polls, so the media can be booted and no 'remove' screen will be displayed. With this change, if no media to remove is initially found, a second poll will be made after a 500ms delay. This will be enough time for USB devices to be correctly detected in our test cases. Also, it is necessary to change the unit test due to the fact that we now call VbExDiskGetInfo twice before actually displaying any screen. TEST=Manual on Monroe. Insert USB media and trigger recovery boot. Verify 'remove' screen is seen, 'insert' screen is seen after removing media, and system boots after re-inserting media. Also passes vboot_reference unit tests. BUG=chrome-os-partner:23840 BRANCH=Panther, Monroe Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ia902c3a126588cd7ea618f2dbbca6b38d35d6ea0 Reviewed-on: https://chromium-review.googlesource.com/179757 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'tests/vboot_api_kernel2_tests.c')
-rw-r--r--tests/vboot_api_kernel2_tests.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/vboot_api_kernel2_tests.c b/tests/vboot_api_kernel2_tests.c
index 1cb2d835..21ea3063 100644
--- a/tests/vboot_api_kernel2_tests.c
+++ b/tests/vboot_api_kernel2_tests.c
@@ -419,6 +419,7 @@ static void VbBootRecTest(void)
shutdown_request_calls_left = 100;
mock_num_disks[0] = 1;
mock_num_disks[1] = 1;
+ mock_num_disks[2] = 1;
vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
TEST_EQ(VbBootRecovery(&cparams, &lkp), VBERROR_SHUTDOWN_REQUESTED,
"Remove");
@@ -455,6 +456,21 @@ static void VbBootRecTest(void)
TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_INSERT,
" insert screen");
+ /* Removal if no disk initially found, but found on second attempt */
+ ResetMocks();
+ shutdown_request_calls_left = 100;
+ mock_num_disks[0] = 0;
+ mock_num_disks[1] = 1;
+ vbtlk_retval = VBERROR_NO_DISK_FOUND - VB_DISK_FLAG_REMOVABLE;
+ TEST_EQ(VbBootRecovery(&cparams, &lkp), VBERROR_SHUTDOWN_REQUESTED,
+ "Remove");
+ TEST_EQ(screens_displayed[0], VB_SCREEN_RECOVERY_REMOVE,
+ " remove screen");
+ TEST_EQ(screens_displayed[1], VB_SCREEN_BLANK,
+ " blank screen");
+ TEST_EQ(screens_displayed[2], VB_SCREEN_RECOVERY_INSERT,
+ " insert screen");
+
/* Bad disk count doesn't require removal */
ResetMocks();
mock_num_disks[0] = -1;