Test/App: Add the original test and app codes from tf-m
The version of the tf-m is:
ac9ccf207e153726b8dc1f5569f702f56d94297f
Change-Id: I445ada360540da55bbe74b3e7aa8d622e8fda501
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/test/framework/CMakeLists.inc b/test/framework/CMakeLists.inc
new file mode 100644
index 0000000..50fafb3
--- /dev/null
+++ b/test/framework/CMakeLists.inc
@@ -0,0 +1,45 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "test framework" module.
+#This file assumes it will be included from a project specific cmakefile, and
+#will not create a library or executable.
+#Inputs:
+# TFM_ROOT_DIR - root directory of the TF-M repo.
+#
+#Outputs:
+# Will modify include directories to make the source compile.
+# ALL_SRC_C: C source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_CXX: C++ source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# ALL_SRC_ASM: assembly source files to be compiled will be added to this list. This shall be added to your add_executable or add_library command.
+# Include directories will be modified by using the include_directories() commands as needed.
+
+#Get the current directory where this file is located.
+set(TEST_FRAMEWORK_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+set (TEST_FRAMEWORK_C_SRC "${TEST_FRAMEWORK_DIR}/test_framework_helpers.c"
+ "${TEST_FRAMEWORK_DIR}/test_framework_integ_test_helper.c"
+ "${TEST_FRAMEWORK_DIR}/test_framework.c"
+ )
+
+set (TEST_FRAMEWORK_C_SRC_NS "${TEST_FRAMEWORK_DIR}/non_secure_suites.c"
+ )
+
+set (TEST_FRAMEWORK_C_SRC_S "${TEST_FRAMEWORK_DIR}/secure_suites.c"
+ )
+
+#Append all our source files to global lists.
+list(APPEND ALL_SRC_C ${TEST_FRAMEWORK_C_SRC})
+list(APPEND ALL_SRC_C_S ${TEST_FRAMEWORK_C_SRC_S})
+list(APPEND ALL_SRC_C_NS ${TEST_FRAMEWORK_C_SRC_NS})
+
+#Setting include directories
+embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
new file mode 100644
index 0000000..ef3a94c
--- /dev/null
+++ b/test/framework/non_secure_suites.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "test_framework_integ_test.h"
+#include "test_framework_integ_test_helper.h"
+#include "test_framework.h"
+
+/* Service specific includes */
+#include "test/suites/ps/non_secure/ps_ns_tests.h"
+#include "test/suites/its/non_secure/its_ns_tests.h"
+#include "test/suites/audit/non_secure/audit_ns_tests.h"
+#include "test/suites/crypto/non_secure/crypto_ns_tests.h"
+#include "test/suites/attestation/non_secure/attestation_ns_tests.h"
+#include "test/suites/qcbor/non_secure/qcbor_ns_tests.h"
+#include "test/suites/t_cose/non_secure/t_cose_ns_tests.h"
+#include "test/suites/core/non_secure/core_ns_tests.h"
+#include "test/suites/ipc/non_secure/ipc_ns_tests.h"
+#include "test/suites/platform/non_secure/platform_ns_tests.h"
+#include "test/suites/multi_core/non_secure/multi_core_ns_test.h"
+
+static struct test_suite_t test_suites[] = {
+#ifdef SERVICES_TEST_NS
+ /* List test cases which are compliant with level 1 isolation */
+
+#ifdef ENABLE_PROTECTED_STORAGE_SERVICE_TESTS
+ {®ister_testsuite_ns_psa_ps_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS
+ /* Non-secure ITS test cases */
+ {®ister_testsuite_ns_psa_its_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_CRYPTO_SERVICE_TESTS
+ /* Non-secure Crypto test cases */
+ {®ister_testsuite_ns_crypto_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_ATTESTATION_SERVICE_TESTS
+ /* Non-secure initial attestation service test cases */
+ {®ister_testsuite_ns_attestation_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_PLATFORM_SERVICE_TESTS
+ /* Non-secure platform service test cases */
+ {®ister_testsuite_ns_platform_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_QCBOR_TESTS
+ /* Non-secure QCBOR library test cases */
+ {®ister_testsuite_ns_qcbor, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_T_COSE_TESTS
+ /* Non-secure T_COSE library test cases */
+ {®ister_testsuite_ns_t_cose, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS
+ /* Non-secure Audit Logging test cases */
+ {®ister_testsuite_ns_audit_interface, 0, 0, 0},
+#endif
+
+#endif /* SERVICES_TEST_NS */
+
+#ifdef CORE_TEST_POSITIVE
+ /* Non-secure core test cases */
+ {®ister_testsuite_ns_core_positive, 0, 0, 0},
+#endif
+
+#ifdef CORE_TEST_INTERACTIVE
+ /* Non-secure interactive test cases */
+ {®ister_testsuite_ns_core_interactive, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_IPC_TEST
+ /* Non-secure IPC test cases */
+ {®ister_testsuite_ns_ipc_interface, 0, 0, 0},
+#endif
+
+#ifdef TFM_MULTI_CORE_TEST
+ /* Multi-core topology test cases */
+ {®ister_testsuite_multi_core_ns_interface, 0, 0, 0},
+#endif
+
+ /* End of test suites */
+ {0, 0, 0, 0}
+};
+
+enum test_suite_err_t start_integ_test(void)
+{
+ return integ_test("Non-secure", test_suites);
+}
+
+/* Service stand-in for NS tests. To be called from a non-secure context */
+enum test_suite_err_t tfm_non_secure_client_run_tests(void)
+{
+ return start_integ_test();
+}
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
new file mode 100644
index 0000000..d89d27b
--- /dev/null
+++ b/test/framework/secure_suites.c
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "test_framework_integ_test.h"
+#include "test_framework_integ_test_helper.h"
+#include "test_framework.h"
+
+/* Service specific includes */
+#include "test/suites/ps/secure/ps_tests.h"
+#include "test/suites/its/secure/its_s_tests.h"
+#include "test/suites/audit/secure/audit_s_tests.h"
+#include "test/suites/attestation/secure/attestation_s_tests.h"
+#include "test/suites/crypto/secure/crypto_s_tests.h"
+#include "test/suites/ipc/secure/ipc_s_tests.h"
+#include "test/suites/platform/secure/platform_s_tests.h"
+
+static struct test_suite_t test_suites[] = {
+#ifdef SERVICES_TEST_S
+ /* List test cases which are compliant with level 1 isolation */
+
+#ifdef ENABLE_PROTECTED_STORAGE_SERVICE_TESTS
+ {®ister_testsuite_s_psa_ps_interface, 0, 0, 0},
+ {®ister_testsuite_s_psa_ps_reliability, 0, 0, 0},
+
+#ifdef PS_TEST_NV_COUNTERS
+ {®ister_testsuite_s_rollback_protection, 0, 0, 0},
+#endif
+#endif
+
+#ifdef ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS
+ /* Secure ITS test cases */
+ {®ister_testsuite_s_psa_its_interface, 0, 0, 0},
+ {®ister_testsuite_s_psa_its_reliability, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_CRYPTO_SERVICE_TESTS
+ /* Crypto test cases */
+ {®ister_testsuite_s_crypto_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_ATTESTATION_SERVICE_TESTS
+ /* Secure initial attestation service test cases */
+ {®ister_testsuite_s_attestation_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_PLATFORM_SERVICE_TESTS
+ /* Secure platform service test cases */
+ {®ister_testsuite_s_platform_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS
+ /* Secure Audit Logging test cases */
+ {®ister_testsuite_s_audit_interface, 0, 0, 0},
+#endif
+
+#ifdef ENABLE_IPC_TEST
+ /* Secure IPC test cases */
+ {®ister_testsuite_s_ipc_interface, 0, 0, 0},
+#endif
+#endif /* SERVICES_TEST_S */
+ /* End of test suites */
+ {0, 0, 0, 0}
+};
+
+static void setup_integ_test(void)
+{
+ /* Left empty intentionally, currently implemented
+ * test suites require no setup
+ */
+}
+
+static void tear_down_integ_test(void)
+{
+ /* Left empty intentionally, currently implemented
+ * test suites require no tear down
+ */
+}
+
+enum test_suite_err_t start_integ_test(void)
+{
+ enum test_suite_err_t retval;
+
+ setup_integ_test();
+ retval = integ_test("Secure", test_suites);
+ tear_down_integ_test();
+ return retval;
+}
diff --git a/test/framework/test_framework.c b/test/framework/test_framework.c
new file mode 100644
index 0000000..85e757f
--- /dev/null
+++ b/test/framework/test_framework.c
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "test_framework.h"
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static void test_failed(const struct test_result_t *ret)
+{
+ printf_set_color(RED);
+ if (ret->info_msg != 0) {
+ TEST_LOG(" %s", ret->info_msg);
+ if (ret->filename != 0) {
+ TEST_LOG(" (Failed at %s:%d)\r\n", ret->filename, ret->line);
+ }
+ } else {
+ if (ret->filename != 0) {
+ TEST_LOG(" Failed at %s:%d\r\n", ret->filename, ret->line);
+ }
+ }
+
+ TEST_LOG(" TEST FAILED!\r\n");
+}
+
+static void print_error(const char *err_msg)
+{
+ printf_set_color(RED);
+ TEST_LOG("Error ( %s )\r\n", err_msg);
+}
+
+const char *test_err_to_str(enum test_suite_err_t err)
+{
+ switch (err) {
+ case TEST_SUITE_ERR_NO_ERROR:
+ return "TEST_SUITE_ERR_NO_ERROR";
+ case TEST_SUITE_ERR_INVALID_DATA:
+ return "TEST_SUITE_ERR_INVALID_DATA";
+ case TEST_SUITE_ERR_INVALID_TEST_DATA:
+ return "TEST_SUITE_ERR_INVALID_TEST_DATA";
+ case TEST_SUITE_ERR_TEST_FAILED:
+ return "TEST_SUITE_ERR_TEST_FAILED";
+ /* default: The default is not defined intentionally to force the
+ * compiler to check that all the enumeration values are
+ * covered in the switch.
+ */
+ }
+}
+
+enum test_suite_err_t set_testsuite(const char *name,
+ struct test_t *test_list, uint32_t size,
+ struct test_suite_t *p_ts)
+{
+ if (p_ts == 0) {
+ print_error("TEST_SUITE_ERR_INVALID_DATA!");
+ return TEST_SUITE_ERR_INVALID_DATA;
+ }
+
+ p_ts->name = name;
+ p_ts->test_list = test_list;
+ p_ts->list_size = size;
+
+ return TEST_SUITE_ERR_NO_ERROR;
+}
+
+void set_test_failed(const char *info_msg, const char *filename, uint32_t line,
+ struct test_result_t *ret)
+{
+ if (ret == 0) {
+ print_error("TEST_SUITE_ERR_INVALID_TEST_DATA!");
+ return;
+ }
+
+ ret->val = TEST_FAILED;
+ ret->info_msg = info_msg;
+ ret->filename = filename;
+ ret->line = line;
+}
+
+enum test_suite_err_t run_testsuite(struct test_suite_t *test_suite)
+{
+ uint32_t failed_tests = 0;
+ uint32_t i;
+ struct test_t *p_test;
+
+ if (test_suite == 0 || test_suite->freg == 0) {
+ print_error("TEST_SUITE_ERR_INVALID_DATA!");
+ return TEST_SUITE_ERR_INVALID_DATA;
+ }
+
+ /* Sets test suite parameters */
+ test_suite->freg(test_suite);
+ if (test_suite->name == 0 || test_suite->list_size == 0) {
+ print_error("TEST_SUITE_ERR_INVALID_DATA!");
+ return TEST_SUITE_ERR_INVALID_DATA;
+ }
+
+ printf_set_color(YELLOW);
+ TEST_LOG("Running Test Suite %s...\r\n", test_suite->name);
+
+ /* Sets pointer to the first test */
+ p_test = test_suite->test_list;
+
+ for (i = 0; i < test_suite->list_size; i++) {
+
+ if (p_test->test == 0 || p_test->name == 0) {
+ print_error("TEST_SUITE_ERR_INVALID_TEST_DATA!");
+ return TEST_SUITE_ERR_INVALID_TEST_DATA;
+ }
+
+ printf_set_color(WHITE);
+ TEST_LOG("> Executing '%s' \r\n Description: '%s'\r\n",
+ p_test->name, p_test->desc);
+
+ /* Sets the default value before the test */
+ p_test->ret.val = TEST_PASSED;
+
+ /* Executes the test */
+ p_test->test(&p_test->ret);
+ if (p_test->ret.val == TEST_FAILED) {
+ test_failed(&p_test->ret);
+ failed_tests++;
+ } else {
+ printf_set_color(GREEN);
+ TEST_LOG(" TEST PASSED!\r\n");
+ }
+
+ /* Sets pointer to the next test */
+ p_test++;
+ }
+
+
+ if (failed_tests == 0) {
+ printf_set_color(GREEN);
+ TEST_LOG("TESTSUITE PASSED!\r\n");
+ test_suite->val = TEST_PASSED;
+ } else {
+ printf_set_color(RED);
+ TEST_LOG("TESTSUITE FAILED!\r\n");
+ printf_set_color(YELLOW);
+ TEST_LOG("Number of failed tests: %d of %d\r\n",
+ failed_tests, test_suite->list_size);
+ test_suite->val = TEST_FAILED;
+ }
+
+ return TEST_SUITE_ERR_NO_ERROR;
+}
diff --git a/test/framework/test_framework.h b/test/framework/test_framework.h
new file mode 100644
index 0000000..9772875
--- /dev/null
+++ b/test/framework/test_framework.h
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TEST_FRAMEWORK_H__
+#define __TEST_FRAMEWORK_H__
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include "log/tfm_log_raw.h"
+#include "test_framework_helpers.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum test_status_t {
+ TEST_PASSED = 0, /*!< Test has passed */
+ TEST_FAILED = 1, /*!< Test has failed */
+};
+
+struct test_result_t {
+ enum test_status_t val; /*!< Test result \ref test_status_t */
+ const char *info_msg; /*!< Information message to show in case of
+ * failure
+ */
+ const char *filename; /*!< Filename where the failure has occured */
+ uint32_t line; /*!< Line where the failure has occured */
+};
+
+/**
+ * \brief Runs the test.
+ *
+ * \param[out] ret Test result value
+ */
+typedef void TEST_FUN(struct test_result_t *ret);
+
+struct test_t {
+ TEST_FUN * const test; /*!< Test function to call */
+ const char *name; /*!< Test name */
+ const char *desc; /*!< Test description */
+ struct test_result_t ret; /*!< Test result */
+};
+
+struct test_suite_t;
+
+/**
+ * \brief Registers test in the testsuite structure and sets the name.
+ *
+ * \param[in] p_test_suite Pointer to the p_test_suite_location.
+ */
+typedef void TESTSUITE_REG(struct test_suite_t *p_test_suite);
+
+struct test_suite_t {
+ TESTSUITE_REG * const freg; /*!< Function to set all follow fields
+ * of the current test suite
+ */
+ struct test_t *test_list; /*!< List of tests */
+ uint32_t list_size; /*!< List size */
+ const char *name; /*!< Test suite name */
+ enum test_status_t val; /*!< Test suite result \ref test_result_t */
+};
+
+enum test_suite_err_t {
+ TEST_SUITE_ERR_NO_ERROR = 0, /*!< No error */
+ TEST_SUITE_ERR_INVALID_DATA = 1, /*!< Invalid test suite if any of the
+ * pointers is NULL
+ */
+ TEST_SUITE_ERR_INVALID_TEST_DATA = 2, /*!< Invalid test if any of the
+ * pointers is NULL
+ */
+ TEST_SUITE_ERR_TEST_FAILED = 3, /*!< Last executed test has failed */
+};
+
+/**
+ * \brief Translates the test suite error into a string.
+ *
+ * \param[in] err Error value \ref test_suite_err_t
+ *
+ * \returns error as string.
+ */
+const char *test_err_to_str(enum test_suite_err_t err);
+
+/**
+ * \brief Sets test suite parameters.
+ *
+ * \param[in] name Test suite name
+ * \param[in] test_list Pointer to the test list
+ * \param[in] size Test list size
+ * \param[in,out] p_ts Pointer to test suite object to fill in the
+ * parameters
+ *
+ * \returns Returns error code as specified in \ref test_suite_err_t
+ */
+enum test_suite_err_t set_testsuite(const char *name,
+ struct test_t *test_list, uint32_t size,
+ struct test_suite_t *p_ts);
+
+/**
+ * \brief Runs the given test suite.
+ *
+ * \param[in,out] test_suite Test suite to run the list of tests and
+ * store test results.
+ *
+ * \returns Returns error code as specified in \ref test_suite_err_t
+ */
+enum test_suite_err_t run_testsuite(struct test_suite_t *test_suite);
+
+/**
+ * \brief Prints all test in the the given test suite.
+ *
+ * \param[in] ts Test suite to print the list of tests
+ */
+void show_tests(const struct test_suite_t *ts);
+
+/**
+ * \brief Sets test failure state and information in the \ref test_result_t
+ * structure.
+ *
+ * \param[in] info_msg Information message to show
+ * \param[in] filename Filename where the error has ocurred
+ * \param[in] line Line in the file where the error has ocurred
+ * \param[out] ret Pointer to \ref test_result_t structure to
+ * set the values
+ *
+ * \note: If info_msg is "" or , info message is not shown. If filename is "",
+ * filename and line are not shown.
+ */
+void set_test_failed(const char *info_msg, const char *filename, uint32_t line,
+ struct test_result_t *ret);
+
+#define TEST_FAIL(info_msg) set_test_failed(info_msg, __FILE__, __LINE__, ret)
+
+#define TEST_LOG(...) tfm_log_printf(__VA_ARGS__)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TEST_FRAMEWORK_H__ */
diff --git a/test/framework/test_framework_helpers.c b/test/framework/test_framework_helpers.c
new file mode 100644
index 0000000..5341058
--- /dev/null
+++ b/test/framework/test_framework_helpers.c
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "test_framework_helpers.h"
+
+#include <stdio.h>
+
+const char *asset_perms_to_str(uint8_t permissions)
+{
+ switch (permissions) {
+ case 0:
+ return "No permissions";
+ case 1:
+ return "SECURE_ASSET_REFERENCE";
+ case 2:
+ return "SECURE_ASSET_WRITE";
+ case 3:
+ return "SECURE_ASSET_REFERENCE | SECURE_ASSET_WRITE";
+ case 4:
+ return "SECURE_ASSET_READ";
+ case 5:
+ return "SECURE_ASSET_REFERENCE | SECURE_ASSET_READ";
+ case 6:
+ return "SECURE_ASSET_WRITE | SECURE_ASSET_READ";
+ case 7:
+ return "SECURE_ASSET_REFERENCE | SECURE_ASSET_WRITE | "
+ "SECURE_ASSET_READ";
+ default:
+ return "Unknown permissions";
+ }
+}
+
+void printf_set_color(enum serial_color_t color_id)
+{
+ TEST_LOG("\33[3%dm", color_id);
+}
diff --git a/test/framework/test_framework_helpers.h b/test/framework/test_framework_helpers.h
new file mode 100644
index 0000000..6a99067
--- /dev/null
+++ b/test/framework/test_framework_helpers.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __TEST_FRAMEWORK_HELPERS_H__
+#define __TEST_FRAMEWORK_HELPERS_H__
+
+#include <stdint.h>
+#include "psa/protected_storage.h"
+#include "test_framework.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum serial_color_t {
+ BLACK = 0,
+ RED = 1,
+ GREEN = 2,
+ YELLOW = 3,
+ BLUE = 4,
+ MAGENDA = 5,
+ CYAN = 6,
+ WHITE = 7,
+};
+
+/**
+ * \brief Translates asset permissions into a string.
+ *
+ * \param[in] permissions Asset permissions value.
+ *
+ * \return asset permissions as string.
+ */
+const char *asset_perms_to_str(uint8_t permissions);
+
+/**
+ * \brief Sets the the text color in the serial port.
+ *
+ * \param[in] color_id Serial foreground color.
+ *
+ * \return 0 if the message is send successfully, 1 otherwise.
+ */
+void printf_set_color(enum serial_color_t color_id);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __TEST_FRAMEWORK_HELPERS_H__ */
diff --git a/test/framework/test_framework_integ_test.h b/test/framework/test_framework_integ_test.h
new file mode 100644
index 0000000..acbcfc0
--- /dev/null
+++ b/test/framework/test_framework_integ_test.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __INTEG_TEST_H__
+#define __INTEG_TEST_H__
+
+#include "test_framework.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Executes integration tests. To be called from appropriate
+ * secure/non-secure service client.
+ *
+ * \returns Returns error code as specified in \ref test_suite_err_t
+ */
+enum test_suite_err_t start_integ_test(void);
+
+/**
+ * \brief Service stand-in shim for non secure tests. To be called from a
+ * non-secure client.
+ *
+ * \returns Returns error code as specified in \ref test_suite_err_t
+ */
+enum test_suite_err_t tfm_non_secure_client_run_tests(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INTEG_TEST_H__ */
diff --git a/test/framework/test_framework_integ_test_helper.c b/test/framework/test_framework_integ_test_helper.c
new file mode 100644
index 0000000..26105cd
--- /dev/null
+++ b/test/framework/test_framework_integ_test_helper.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2017-2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include <stdio.h>
+
+#include "test_framework.h"
+#include "test_framework_integ_test_helper.h"
+
+enum test_suite_err_t integ_test(const char *suite_type,
+ struct test_suite_t test_suites[])
+{
+ uint32_t i;
+ enum test_suite_err_t retval = TEST_SUITE_ERR_NO_ERROR;
+
+ printf_set_color(YELLOW);
+ TEST_LOG("\r\n#### Execute test suites for the %s area ####\r\n",
+ suite_type);
+
+ /* Executes test suites */
+ for (i = 0; test_suites[i].freg != NULL; i++) {
+ retval = run_testsuite(&test_suites[i]);
+ if (retval != TEST_SUITE_ERR_NO_ERROR) {
+ /* End function execution */
+ return retval;
+ }
+ }
+
+ /* Prints test suites summary */
+ printf_set_color(YELLOW);
+ TEST_LOG("\r\n*** %s test suites summary ***\r\n", suite_type);
+ for (i = 0; test_suites[i].freg != NULL; i++) {
+ printf_set_color(WHITE);
+ TEST_LOG("Test suite '%s' has ", test_suites[i].name);
+ if (test_suites[i].val == TEST_PASSED) {
+ printf_set_color(GREEN);
+ TEST_LOG(" PASSED\r\n");
+ } else {
+ printf_set_color(RED);
+ TEST_LOG(" FAILED\r\n");
+ retval = TEST_SUITE_ERR_TEST_FAILED;
+ }
+ }
+
+ printf_set_color(YELLOW);
+ TEST_LOG("\r\n*** End of %s test suites ***\r\n", suite_type);
+ return retval;
+}
diff --git a/test/framework/test_framework_integ_test_helper.h b/test/framework/test_framework_integ_test_helper.h
new file mode 100644
index 0000000..c37aa14
--- /dev/null
+++ b/test/framework/test_framework_integ_test_helper.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2017, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __INTEG_TEST_HELPER_H__
+#define __INTEG_TEST_HELPER_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "test_framework.h"
+
+/**
+ * \brief Executes integration test suites provided in the parameters.
+ *
+ * \param[in] suite_type A string containing the type of the suite
+ * (used for printing).
+ * \param[in] test_suites The suites to be executed.
+ * \param[in] test_suite_cnt The number of test suites to be executed.
+ *
+ * \returns Returns error code as specified in \ref test_suite_err_t
+ */
+enum test_suite_err_t integ_test(const char *suite_type,
+ struct test_suite_t test_suites[]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __INTEG_TEST_HELPER_H__ */