Merge "Added SYSTEM_RESET test case"
diff --git a/tftf/tests/runtime_services/standard_service/psci/api_tests/system_reset/test_system_reset.c b/tftf/tests/runtime_services/standard_service/psci/api_tests/system_reset/test_system_reset.c
new file mode 100644
index 0000000..41eb7af
--- /dev/null
+++ b/tftf/tests/runtime_services/standard_service/psci/api_tests/system_reset/test_system_reset.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <psci.h>
+#include <smccc.h>
+#include <tftf_lib.h>
+
+/*
+ * @Test_Aim@ Validate the SYSTEM_RESET call.
+ * Test SUCCESS in case of system reset.
+ * Test FAIL in case of execution not terminated.
+ */
+test_result_t test_system_reset(void)
+{
+	smc_args args = { SMC_PSCI_SYSTEM_RESET };
+
+	if (tftf_is_rebooted() == 1) {
+		/* Successfully resumed from SYSTEM_RESET */
+		return TEST_RESULT_SUCCESS;
+	}
+
+	tftf_notify_reboot();
+	tftf_smc(&args);
+
+	/* The PSCI SYSTEM_RESET call is not supposed to return */
+	tftf_testcase_printf("System didn't reboot properly\n");
+
+	return TEST_RESULT_FAIL;
+}
diff --git a/tftf/tests/tests-manual.mk b/tftf/tests/tests-manual.mk
index bd8132b..67e2460 100644
--- a/tftf/tests/tests-manual.mk
+++ b/tftf/tests/tests-manual.mk
@@ -1,11 +1,12 @@
 #
-# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
 
 TESTS_SOURCES	+=							\
 	$(addprefix tftf/tests/runtime_services/standard_service/psci/api_tests/, \
+	        system_reset/test_system_reset.c 			\
 		mem_protect/test_mem_protect.c				\
 		psci_stat/test_psci_stat.c				\
 		reset2/reset2.c 					\
@@ -18,4 +19,4 @@
 
 ifeq (${NEW_TEST_SESSION},1)
 $(error Manual tests require NEW_TEST_SESSION=0 to persist test results across reboots)
-endif
\ No newline at end of file
+endif
diff --git a/tftf/tests/tests-manual.xml b/tftf/tests/tests-manual.xml
index 15a9609..e7c29e0 100644
--- a/tftf/tests/tests-manual.xml
+++ b/tftf/tests/tests-manual.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 
 <!--
-  Copyright (c) 2018, Arm Limited. All rights reserved.
+  Copyright (c) 2018-2019, Arm Limited. All rights reserved.
 
   SPDX-License-Identifier: BSD-3-Clause
 -->
@@ -9,6 +9,10 @@
 <testsuites>
 
 
+  <testsuite name="System Reset Test" description="Validate SYSTEM_RESET PSCI call">
+    <testcase name="System Reset" function="test_system_reset" />
+  </testsuite>
+
   <testsuite name="PSCI STAT" description="Test PSCI STAT support System level">
     <testcase name="for stats after system reset" function="test_psci_stats_after_reset" />
     <testcase name="for stats after system shutdown" function="test_psci_stats_after_shutdown" />
diff --git a/tftf/tests/tests-reboot.mk b/tftf/tests/tests-reboot.mk
index b0f5738..ad80973 100644
--- a/tftf/tests/tests-reboot.mk
+++ b/tftf/tests/tests-reboot.mk
@@ -6,6 +6,7 @@
 
 TESTS_SOURCES	+=							\
 	$(addprefix tftf/tests/runtime_services/standard_service/psci/api_tests/, \
+		system_reset/test_system_reset.c			\
 		mem_protect/test_mem_protect.c				\
 		psci_stat/test_psci_stat.c				\
 		reset2/reset2.c 					\
diff --git a/tftf/tests/tests-reboot.xml b/tftf/tests/tests-reboot.xml
index fa4da13..a072872 100644
--- a/tftf/tests/tests-reboot.xml
+++ b/tftf/tests/tests-reboot.xml
@@ -9,6 +9,10 @@
 <testsuites>
 
 
+  <testsuite name="System Reset Test" description="Validate SYSTEM_RESET PSCI call">
+    <testcase name="System Reset" function="test_system_reset" />
+  </testsuite>
+
   <testsuite name="PSCI STAT" description="Test PSCI STAT support System level">
     <testcase name="for stats after system reset" function="test_psci_stats_after_reset" />
   </testsuite>