summaryrefslogtreecommitdiff
path: root/tests/ec_sync_tests.c
diff options
context:
space:
mode:
authorDuncan Laurie <dlaurie@google.com>2018-03-08 19:23:01 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-03-30 16:53:03 -0700
commit0bdec67fc7778ee55b7dbdacece2d81022fac1b3 (patch)
treec126902bd486d1a2f71f9d9d76f7197c6a7c468b /tests/ec_sync_tests.c
parentbc5a737d39891b5f7384d9662d2ee55cb33b541f (diff)
downloadvboot-0bdec67fc7778ee55b7dbdacece2d81022fac1b3.tar.gz
ec_sync: Go to recovery on aux fw update failure
If an aux firmware update fails enter recovery with a specific reason code so we can identify systems that fail. Also handle the case where the update succeeds and requests a cold reset of the EC, first clearing the oprom flag if necessary in order to prevent a second reset. Unit test was added to check recovery reason for aux firmware update failure. BUG=b:74336712 BRANCH=eve TEST=manual: force update to fail and ensure it goes to recovery mode, and after successful update check that the option rom flag is cleared before the EC reset happens. Unit tests udpated and 'make runtests' passes. Change-Id: I35a93892a0f8bb16eac0925ada5dfbc5c3144f8d Signed-off-by: Duncan Laurie <dlaurie@google.com> Reviewed-on: https://chromium-review.googlesource.com/959671 Reviewed-by: Caveh Jalali <caveh@google.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'tests/ec_sync_tests.c')
-rw-r--r--tests/ec_sync_tests.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c
index eceae78f..4c1775f2 100644
--- a/tests/ec_sync_tests.c
+++ b/tests/ec_sync_tests.c
@@ -56,6 +56,7 @@ static struct vb2_shared_data *sd;
static uint32_t screens_displayed[8];
static uint32_t screens_count = 0;
+static VbError_t ec_aux_fw_retval;
static int ec_aux_fw_update_req;
static VbAuxFwUpdateSeverity_t ec_aux_fw_mock_severity;
static VbAuxFwUpdateSeverity_t ec_aux_fw_update_severity;
@@ -109,6 +110,7 @@ static void ResetMocks(void)
memset(screens_displayed, 0, sizeof(screens_displayed));
screens_count = 0;
+ ec_aux_fw_retval = VBERROR_SUCCESS;
ec_aux_fw_mock_severity = VB_AUX_FW_NO_UPDATE;
ec_aux_fw_update_severity = VB_AUX_FW_NO_UPDATE;
ec_aux_fw_update_req = 0;
@@ -219,7 +221,7 @@ VbError_t VbExUpdateAuxFw()
{
ec_aux_fw_update_req = ec_aux_fw_update_severity != VB_AUX_FW_NO_UPDATE;
ec_aux_fw_protected = 1;
- return VBERROR_SUCCESS;
+ return ec_aux_fw_retval;
}
static void test_ssync(VbError_t retval, int recovery_reason, const char *desc)
@@ -428,6 +430,11 @@ static void VbSoftwareSyncTest(void)
TEST_EQ(ec_aux_fw_protected, 1, " aux fw protected");
TEST_EQ(screens_displayed[0], VB_SCREEN_WAIT,
" wait screen forced");
+
+ ResetMocks();
+ ec_aux_fw_retval = VBERROR_UNKNOWN;
+ test_ssync(VBERROR_UNKNOWN, VB2_RECOVERY_AUX_FW_UPDATE,
+ "Error updating AUX firmware");
}
int main(void)