Skip to content

Commit 1668a9d

Browse files
Netanel Gonen0xc0170
authored andcommitted
move init of test into greentea init function
1 parent a04507a commit 1668a9d

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

TESTS/psa/attestation/main.cpp

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,10 @@ utest::v1::status_t case_teardown_handler(const Case *const source, const size_t
127127
return greentea_case_teardown_handler(source, passed, failed, reason);
128128
}
129129

130-
Case cases[] = {
131-
Case("PSA attestation get token", check_initial_attestation_get_token, case_teardown_handler),
132-
};
133-
134-
Specification specification(greentea_test_setup, cases);
135-
136-
int main()
130+
utest::v1::status_t case_setup_handler(const Case *const source, const size_t index_of_case)
137131
{
138-
psa_status_t status = mbed_psa_reboot_and_request_new_security_state(PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
132+
psa_status_t status;
133+
status = mbed_psa_reboot_and_request_new_security_state(PSA_LIFECYCLE_ASSEMBLY_AND_TEST);
139134
TEST_ASSERT_EQUAL(PSA_SUCCESS, status);
140135
#if (defined(COMPONENT_PSA_SRV_IPC) || defined(MBEDTLS_ENTROPY_NV_SEED))
141136
uint8_t seed[MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE] = {0};
@@ -147,5 +142,17 @@ int main()
147142
/* don't really care if this succeeds this is just to make crypto init pass*/
148143
mbedtls_psa_inject_entropy(seed, MBEDTLS_PSA_INJECT_ENTROPY_MIN_SIZE);
149144
#endif
145+
return greentea_case_setup_handler(source, index_of_case);
146+
}
147+
148+
149+
Case cases[] = {
150+
Case("PSA attestation get token", case_setup_handler, check_initial_attestation_get_token, case_teardown_handler),
151+
};
152+
153+
Specification specification(greentea_test_setup, cases);
154+
155+
int main()
156+
{
150157
return !Harness::run(specification);
151158
}

0 commit comments

Comments
 (0)