summaryrefslogtreecommitdiff
path: root/framework/main.c
diff options
context:
space:
mode:
authorVikram Kanigiri <vikram.kanigiri@arm.com>2015-03-26 16:54:02 +0000
committerSandrine Bailleux <sandrine.bailleux@arm.com>2015-04-24 14:18:43 +0100
commit689828b73096573d6a9d0e0b5559991dd8f4b69a (patch)
tree5704c7d99ce36e03816c6919316161c406a80289 /framework/main.c
parentf08a8fc3c57581216df76ce2b05cc035e2c9216b (diff)
Reset the platform after execution of each testcase
To provide a clean state for each testcase, it would be good if we reset the platform after each testcase and execute the test. This patch adds the above support in scenarios which satisfy the following conditions: 1. we are using flash to store results 2. testing platform supports platform reset from EL2 3. testing is not being done in a new test session mode. Change-Id: I941eddb7ac587300661ea4dfcf01b9a3858eca67
Diffstat (limited to 'framework/main.c')
-rw-r--r--framework/main.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/framework/main.c b/framework/main.c
index ff221a1..8c66fbe 100644
--- a/framework/main.c
+++ b/framework/main.c
@@ -107,6 +107,7 @@ static void prepare_next_test(void)
/* Save the current testcase in case of crash */
tftf_set_current_testcase(current_testcase()->test);
+ tftf_set_next_testcase(NULL);
/* Populate the test entrypoint for the lead CPU */
core_pos = platform_get_core_pos(lead_cpu_mpid);
@@ -176,6 +177,9 @@ static TEST_RESULT get_overall_test_result(void)
* This function is executed by the last CPU to exit the test only.
* It does the necessary bookkeeping and reports the overall test result.
* If it was the last test, it will also generate the final test report.
+ * Otherwise, it will reset the platform, provided that the platform
+ * supports reset from non-trusted world. This ensures that the next test
+ * runs in a clean environment
*
* Return 1 if this was the last test, 0 otherwise.
*/
@@ -207,6 +211,18 @@ static unsigned int close_test(void)
tftf_report_generate();
tftf_clean_nvm();
return 1;
+ } else {
+#if (PLAT_SUPPORTS_NS_RESET && !NEW_TEST_SESSION && USE_NVM)
+ /*
+ * Set next testcase and reset, So that next test runs with
+ * clean environment.
+ */
+ tftf_set_next_testcase(next_test->test);
+ INFO("Reset platform before executing next test:%p\n",
+ (void *) &(next_test->test));
+ tftf_plat_reset();
+ bug_unreachable();
+#endif
}
/* TODO: Update lead CPU for next test */