diff options
author | Mate Toth-Pal <mate.toth-pal@arm.com> | 2020-06-05 21:22:39 +0200 |
---|---|---|
committer | Máté Tóth-Pál <Mate.Toth-Pal@arm.com> | 2020-06-11 14:34:19 +0000 |
commit | 894e642e20ed371a088e7e6d59205e85e826ed35 (patch) | |
tree | f9a41c5a223e3ca524f33acab2eeacca49840b85 /test | |
parent | 9a5a9b9ea2bdce4ce5d20c78eba8a051ebb912b9 (diff) | |
download | trusted-firmware-m-894e642e20ed371a088e7e6d59205e85e826ed35.tar.gz |
Test: Modify IRQ test flow for tool
Modify the flow of the IRQ test case so it can be executed with the IRQ
testing tool.
Change-Id: Ibc646baf2b979a0c054cc969b5a061e3c0e79081
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
Diffstat (limited to 'test')
3 files changed, 35 insertions, 5 deletions
diff --git a/test/suites/core/non_secure/core_ns_positive_testsuite.c b/test/suites/core/non_secure/core_ns_positive_testsuite.c index 794e7d97dc..0e8370a203 100644 --- a/test/suites/core/non_secure/core_ns_positive_testsuite.c +++ b/test/suites/core/non_secure/core_ns_positive_testsuite.c @@ -517,7 +517,8 @@ void TIMER1_Handler (void) static int32_t tfm_core_test_irq_scenario( enum irq_test_scenario_t test_scenario) { - struct irq_test_execution_data_t *execution_data_address = &irq_test_execution_data; + struct irq_test_execution_data_t *execution_data_address = + &irq_test_execution_data; uint32_t scenario = test_scenario; psa_invec in_vec[] = { @@ -587,6 +588,15 @@ static void tfm_core_test_irq(struct test_result_t *ret) { int32_t err; + struct irq_test_execution_data_t *execution_data_address = + &irq_test_execution_data; + uint32_t scenario = IRQ_TEST_SCENARIO_NONE; + + psa_invec in_vec[] = { + {&scenario, sizeof(uint32_t)}, + {&execution_data_address, + sizeof(struct irq_test_execution_data_t *)} }; + NVIC_EnableIRQ(TFM_TIMER1_IRQ); err = tfm_core_test_irq_scenario(IRQ_TEST_SCENARIO_1); @@ -619,6 +629,19 @@ static void tfm_core_test_irq(struct test_result_t *ret) return; } + /* finally call prepare with scenario none as a teardown */ +#ifdef TFM_PSA_API + err = psa_test_common(SPM_CORE_IRQ_TEST_1_PREPARE_TEST_SCENARIO_SID, + SPM_CORE_IRQ_TEST_1_PREPARE_TEST_SCENARIO_VERSION, + in_vec, 2, NULL, 0); +#else + err = tfm_spm_irq_test_1_prepare_test_scenario_veneer(in_vec, 2, NULL, 0); +#endif + if (err != CORE_TEST_ERRNO_SUCCESS) { + TEST_FAIL("Failed to tear down IRQ tests"); + return; + } + ret->val = TEST_PASSED; } #endif diff --git a/test/test_services/tfm_core_test/tfm_ss_core_test.c b/test/test_services/tfm_core_test/tfm_ss_core_test.c index 0a6d85e71a..dbbdd442e1 100644 --- a/test/test_services/tfm_core_test/tfm_ss_core_test.c +++ b/test/test_services/tfm_core_test/tfm_ss_core_test.c @@ -26,6 +26,8 @@ static int32_t partition_init_done; #define INVALID_NS_CLIENT_ID 0x49abcdef #define EXPECTED_NS_CLIENT_ID (-1) +#define IRQ_TEST_TOOL_CODE_LOCATION(name) + #ifndef TFM_PSA_API /* Don't initialise caller_partition_id_zi and expect it to be linked in the * zero-initialised data area @@ -270,6 +272,7 @@ static psa_status_t test_ss_to_ss(void) { int32_t ret; /* Call to a different service, should be successful */ + IRQ_TEST_TOOL_CODE_LOCATION(example_secure_service_start); #ifdef TFM_PSA_API ret = psa_test_common(SPM_CORE_TEST_2_SLAVE_SERVICE_SID, SPM_CORE_TEST_2_SLAVE_SERVICE_VERSION, @@ -277,6 +280,7 @@ static psa_status_t test_ss_to_ss(void) #else /* defined(TFM_PSA_API) */ ret = tfm_spm_core_test_2_slave_service_veneer(NULL, 0, NULL, 0); #endif /* defined(TFM_PSA_API) */ + IRQ_TEST_TOOL_CODE_LOCATION(example_secure_service_end); if (ret == CORE_TEST_ERRNO_SUCCESS_2) { return CORE_TEST_ERRNO_SUCCESS; } else { diff --git a/test/test_services/tfm_irq_test_service_1/tfm_irq_test_service_1.c b/test/test_services/tfm_irq_test_service_1/tfm_irq_test_service_1.c index a8ffcf5d7e..4be0801bfb 100644 --- a/test/test_services/tfm_irq_test_service_1/tfm_irq_test_service_1.c +++ b/test/test_services/tfm_irq_test_service_1/tfm_irq_test_service_1.c @@ -17,6 +17,8 @@ #include "psa_manifest/tfm_irq_test_service_1.h" #include "tfm_plat_test.h" +#define IRQ_TEST_TOOL_CODE_LOCATION(name) + static enum irq_test_scenario_t current_scenario = IRQ_TEST_SCENARIO_NONE; static struct irq_test_execution_data_t *current_execution_data; @@ -42,6 +44,7 @@ static void halt_test_execution(void) */ static void stop_timer(void) { + IRQ_TEST_TOOL_CODE_LOCATION(stop_secure_timer); tfm_plat_test_secure_timer_stop(); } @@ -56,7 +59,7 @@ int32_t spm_irq_test_1_prepare_test_scenario_internal( switch (irq_test_scenario) { case IRQ_TEST_SCENARIO_NONE: - return CORE_TEST_ERRNO_INVALID_PARAMETER; + break; /* uninitialised scenario */ case IRQ_TEST_SCENARIO_1: case IRQ_TEST_SCENARIO_2: case IRQ_TEST_SCENARIO_3: @@ -165,7 +168,7 @@ void SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ_isr(void) switch (current_scenario) { case IRQ_TEST_SCENARIO_NONE: - halt_test_execution(); + psa_eoi(SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ); break; case IRQ_TEST_SCENARIO_1: case IRQ_TEST_SCENARIO_2: @@ -222,11 +225,11 @@ void TIMER_0_isr_ipc(void) { current_execution_data->timer0_triggered = 1; - tfm_plat_test_secure_timer_stop(); + stop_timer(); switch (current_scenario) { case IRQ_TEST_SCENARIO_NONE: - halt_test_execution(); + psa_eoi(SPM_CORE_IRQ_TEST_1_SIGNAL_TIMER_0_IRQ); break; case IRQ_TEST_SCENARIO_1: case IRQ_TEST_SCENARIO_2: |