Test: Add running image state check in FWU test suite
After checking running image state is supported in Firmware
Update partition, update the FWU test suites accordingly.
Signed-off-by: Sherry Zhang <sherry.zhang2@arm.com>
Change-Id: If505ca25a26cb929d38fd90a540ef73291dc1e71
diff --git a/test/suites/fwu/mcuboot/fwu_tests_common.c b/test/suites/fwu/mcuboot/fwu_tests_common.c
index c08c83d..bc2f95d 100644
--- a/test/suites/fwu/mcuboot/fwu_tests_common.c
+++ b/test/suites/fwu/mcuboot/fwu_tests_common.c
@@ -571,14 +571,31 @@
void tfm_fwu_test_common_012(struct test_result_t *ret)
{
psa_status_t status;
+ psa_image_info_t info = { 0 };
+ psa_image_id_t running_image = \
+ (psa_image_id_t)FWU_CALCULATE_IMAGE_ID(FWU_IMAGE_ID_SLOT_ACTIVE,
+ image_type_test,
+ 0);
/* Accept the running image. */
- status = psa_fwu_accept();
+ status = psa_fwu_accept(running_image);
if (status != PSA_SUCCESS) {
TEST_FAIL("Accept should not fail");
return;
}
+ /* Query the running image. */
+ status = psa_fwu_query(running_image, &info);
+ if (status != PSA_SUCCESS) {
+ TEST_FAIL("Query should success");
+ return;
+ }
+
+ if (info.state != PSA_IMAGE_INSTALLED) {
+ TEST_FAIL("The active image should be in INSTALLED state");
+ return;
+ }
+
ret->val = TEST_PASSED;
}