diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ec_sync_tests.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ec_sync_tests.c b/tests/ec_sync_tests.c index 56f3baae..1d5f8c1b 100644 --- a/tests/ec_sync_tests.c +++ b/tests/ec_sync_tests.c @@ -33,6 +33,7 @@ static VbSharedDataHeader *shared = (VbSharedDataHeader *)shared_data; static GoogleBinaryBlockHeader gbb; static int mock_in_rw; +static VbError_t in_rw_retval; static int protect_retval; static int ec_ro_protected; static int ec_rw_protected; @@ -94,6 +95,7 @@ static void ResetMocks(void) ec_run_image = 0; /* 0 = RO, 1 = RW */ ec_ro_updated = 0; ec_rw_updated = 0; + in_rw_retval = VBERROR_SUCCESS; protect_retval = VBERROR_SUCCESS; update_retval = VBERROR_SUCCESS; run_retval = VBERROR_SUCCESS; @@ -142,6 +144,12 @@ int VbExTrustEC(int devidx) return !mock_in_rw; } +VbError_t VbExEcRunningRW(int devidx, int *in_rw) +{ + *in_rw = mock_in_rw; + return in_rw_retval; +} + VbError_t VbExEcProtect(int devidx, enum VbSelectFirmware_t select) { if (select == VB_SELECT_FIRMWARE_READONLY) @@ -159,6 +167,7 @@ VbError_t VbExEcDisableJump(int devidx) VbError_t VbExEcJumpToRW(int devidx) { ec_run_image = 1; + mock_in_rw = 1; return run_retval; } @@ -237,6 +246,12 @@ static void test_ssync(VbError_t retval, int recovery_reason, const char *desc) static void VbSoftwareSyncTest(void) { + /* AP-RO cases */ + ResetMocks(); + in_rw_retval = VBERROR_SIMULATED; + test_ssync(VBERROR_EC_REBOOT_TO_RO_REQUIRED, + VBNV_RECOVERY_EC_UNKNOWN_IMAGE, "Unknown EC image"); + /* Calculate hashes */ ResetMocks(); mock_ec_rw_hash_size = 0; |