@@ -38,9 +38,6 @@ static void pits_test()
38
38
struct psa_its_info_t info = {0 , PSA_ITS_FLAG_WRITE_ONCE};
39
39
memset (read_buff, 0 , TEST_BUFF_SIZE);
40
40
41
- status = mbed_psa_reboot_and_request_new_security_state (PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
42
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
43
-
44
41
status = psa_its_get_info (5 , &info);
45
42
TEST_ASSERT_EQUAL (PSA_ITS_ERROR_UID_NOT_FOUND, status);
46
43
@@ -78,9 +75,6 @@ static void pits_write_once_test()
78
75
uint8_t read_buff[TEST_BUFF_SIZE] = {0 };
79
76
struct psa_its_info_t info = {0 , 0 };
80
77
81
- status = mbed_psa_reboot_and_request_new_security_state (PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
82
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
83
-
84
78
status = psa_its_get_info (5 , &info);
85
79
TEST_ASSERT_EQUAL (PSA_ITS_ERROR_UID_NOT_FOUND, status);
86
80
@@ -113,60 +107,27 @@ static void pits_write_once_test()
113
107
TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
114
108
TEST_ASSERT_EQUAL (TEST_BUFF_SIZE, info.size );
115
109
TEST_ASSERT_EQUAL (PSA_ITS_FLAG_WRITE_ONCE, info.flags );
110
+ }
116
111
112
+ utest::v1::status_t case_teardown_handler (const Case *const source, const size_t passed, const size_t failed, const failure_t reason)
113
+ {
114
+ psa_status_t status;
117
115
status = mbed_psa_reboot_and_request_new_security_state (PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
118
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
116
+ TEST_ASSERT_EQUAL (PSA_LIFECYCLE_SUCCESS, status);
117
+ return greentea_case_teardown_handler (source, passed, failed, reason);
119
118
}
120
119
121
- static void pits_migrate_version ( void )
120
+ utest::v1:: status_t case_setup_handler ( const Case * const source, const size_t index_of_case )
122
121
{
123
- uint32_t major = 0 ;
124
- uint32_t minor = 1 ;
125
- int kv_status = 0 ;
126
- struct psa_its_info_t info = {0 , PSA_ITS_FLAG_NONE};
127
- psa_its_status_t status = test_psa_its_reset ();
128
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
129
-
130
- // Setting fake ITS old version
131
- // Expect migration to update to current version
132
-
133
- status = test_psa_its_deinit ();
134
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
135
-
136
- status = test_psa_its_set_ver (major, minor);
137
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
138
-
139
- status = psa_its_get_info (5 , &info);
140
- TEST_ASSERT_EQUAL (PSA_ITS_ERROR_UID_NOT_FOUND, status);
141
-
142
- status = test_psa_its_get_ver (&major, &minor);
143
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
144
- TEST_ASSERT_EQUAL (PSA_ITS_API_VERSION_MAJOR, major);
145
- TEST_ASSERT_EQUAL (PSA_ITS_API_VERSION_MINOR, minor);
146
-
147
- // De-initializes ITS's KVStore instance with existing version file
148
- // Expects the version to remain at current version
149
- major = 0 ;
150
- minor = 0 ;
151
- status = test_psa_its_deinit ();
152
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
153
-
154
- status = psa_its_get_info (5 , &info);
155
- TEST_ASSERT_EQUAL (PSA_ITS_ERROR_UID_NOT_FOUND, status);
156
-
157
- status = test_psa_its_get_ver (&major, &minor);
158
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
159
- TEST_ASSERT_EQUAL (PSA_ITS_API_VERSION_MAJOR, major);
160
- TEST_ASSERT_EQUAL (PSA_ITS_API_VERSION_MINOR, minor);
161
-
162
- status = test_psa_its_reset ();
163
- TEST_ASSERT_EQUAL (PSA_ITS_SUCCESS, status);
122
+ psa_status_t status;
123
+ status = mbed_psa_reboot_and_request_new_security_state (PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
124
+ TEST_ASSERT_EQUAL (PSA_LIFECYCLE_SUCCESS, status);
125
+ return greentea_case_setup_handler (source, index_of_case);
164
126
}
165
127
166
128
Case cases[] = {
167
- Case (" PSA prot internal storage - Basic" , pits_test),
168
- Case (" PSA prot internal storage - Write-once" , pits_write_once_test),
169
- Case (" PSA prot internal storage - Version migration" , pits_migrate_version),
129
+ Case (" PSA prot internal storage - Basic" , case_setup_handler, pits_test, case_teardown_handler),
130
+ Case (" PSA prot internal storage - Write-once" , case_setup_handler, pits_write_once_test, case_teardown_handler)
170
131
};
171
132
172
133
utest::v1::status_t greentea_test_setup (const size_t number_of_cases)
0 commit comments