aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdison Ai <edison.ai@arm.com>2018-06-19 18:06:54 +0800
committerEdison Ai <edison.ai@arm.com>2018-12-17 19:54:48 +0800
commitcf5e34cecc8ef6b70faf141ab3070ce5f6e8f546 (patch)
treee29ec9ec183bc3d82960675c6a58b19e1ee95a7f
parent94e1321d91799d010fc810995fa89cb53dbe3e74 (diff)
downloadtrusted-firmware-m-cf5e34cecc8ef6b70faf141ab3070ce5f6e8f546.tar.gz
Test: skeleton framework addition for IPC testing
Add test framework skeleton for secure and non-secure side IPC validation. Actual tests will be added in subsequent patches. Change-Id: Iaef5668e3d57e50493b72a4977d3f0145ec0cd97 Signed-off-by: Edison Ai <edison.ai@arm.com>
-rw-r--r--test/CMakeLists.inc1
-rw-r--r--test/framework/non_secure_suites.c6
-rw-r--r--test/framework/secure_suites.c6
-rw-r--r--test/suites/ipc/CMakeLists.inc36
-rw-r--r--test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c45
-rw-r--r--test/suites/ipc/non_secure/ipc_ns_tests.h28
-rw-r--r--test/suites/ipc/secure/ipc_s_interface_testsuite.c39
-rw-r--r--test/suites/ipc/secure/ipc_s_tests.h28
8 files changed, 189 insertions, 0 deletions
diff --git a/test/CMakeLists.inc b/test/CMakeLists.inc
index 6c22af7bfb..2307b2a4d0 100644
--- a/test/CMakeLists.inc
+++ b/test/CMakeLists.inc
@@ -34,3 +34,4 @@ include(${CMAKE_CURRENT_LIST_DIR}/suites/audit/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/suites/crypto/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/suites/attestation/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/test_services/CMakeLists.inc)
+include(${CMAKE_CURRENT_LIST_DIR}/suites/ipc/CMakeLists.inc)
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index 496dc4f658..b856cc0f2f 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -16,6 +16,7 @@
#include "test/suites/attestation/non_secure/attestation_ns_tests.h"
#include "test/suites/invert/non_secure/invert_ns_tests.h"
#include "test/suites/core/non_secure/core_ns_tests.h"
+#include "test/suites/ipc/non_secure/ipc_ns_tests.h"
static struct test_suite_t test_suites[] = {
#if TFM_LVL == 3
@@ -74,6 +75,11 @@ static struct test_suite_t test_suites[] = {
/* Non-secure interactive test cases */
{&register_testsuite_ns_core_interactive, 0, 0, 0},
#endif
+
+#ifdef CORE_TEST_IPC
+ /* Non-secure IPC test cases */
+ {&register_testsuite_ns_ipc_interface, 0, 0, 0},
+#endif
};
void start_integ_test(void)
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
index 1dde38de88..83c9eebc8e 100644
--- a/test/framework/secure_suites.c
+++ b/test/framework/secure_suites.c
@@ -17,6 +17,7 @@
#include "test/suites/crypto/secure/crypto_s_tests.h"
#include "secure_fw/services/secure_storage/sst_object_system.h"
+#include "test/suites/ipc/secure/ipc_s_tests.h"
static struct test_suite_t test_suites[] = {
#if TFM_LVL == 3
@@ -52,6 +53,11 @@ static struct test_suite_t test_suites[] = {
/* Note: since this is sample code, only run if test services are enabled */
{&register_testsuite_s_invert_interface, 0, 0, 0},
#endif /* TFM_PARTITION_TEST_CORE*/
+
+#ifdef CORE_TEST_IPC
+ /* Secure IPC test cases */
+ {&register_testsuite_s_ipc_interface, 0, 0, 0},
+#endif
#endif /* SERVICES_TEST_S */
#endif /* TFM_LVL == 3 */
};
diff --git a/test/suites/ipc/CMakeLists.inc b/test/suites/ipc/CMakeLists.inc
new file mode 100644
index 0000000000..c88de5ba01
--- /dev/null
+++ b/test/suites/ipc/CMakeLists.inc
@@ -0,0 +1,36 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "ipc test" 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(IPC_TEST_DIR ${CMAKE_CURRENT_LIST_DIR})
+if(NOT DEFINED TFM_ROOT_DIR)
+ message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
+endif()
+
+if (NOT DEFINED CORE_TEST_IPC)
+ message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_IPC is undefined. ")
+elseif(CORE_TEST_IPC)
+ list(APPEND ALL_SRC_C_S "${IPC_TEST_DIR}/secure/ipc_s_interface_testsuite.c")
+ list(APPEND ALL_SRC_C_NS "${IPC_TEST_DIR}/non_secure/ipc_ns_interface_testsuite.c")
+
+ #Setting include directories
+ embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+ embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
+endif()
diff --git a/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c b/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c
new file mode 100644
index 0000000000..00d6f3f88a
--- /dev/null
+++ b/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include <stdio.h>
+#include "ipc_ns_tests.h"
+#include "psa_client.h"
+#include "test/framework/test_framework_helpers.h"
+
+#define IPC_TEST_MIN_SID (01)
+
+/* List of tests */
+static void tfm_ipc_test_1001(struct test_result_t *ret);
+
+static struct test_t ipc_veneers_tests[] = {
+ {&tfm_ipc_test_1001, "TFM_IPC_TEST_1001", "Non Secure functional", {0} },
+};
+
+void register_testsuite_ns_ipc_interface(struct test_suite_t *p_test_suite)
+{
+ uint32_t list_size;
+
+ list_size = (sizeof(ipc_veneers_tests) / sizeof(ipc_veneers_tests[0]));
+
+ set_testsuite("IPC non-secure interface test (TFM_IPC_TEST_1XXX)",
+ ipc_veneers_tests, list_size, p_test_suite);
+}
+
+/**
+ * \brief Functional test of NS API
+ * \note This is a functional test only and doesn't
+ * mean to test all possible combinations of
+ * input parameters and return values.
+ */
+static void tfm_ipc_test_1001(struct test_result_t *ret)
+{
+ uint32_t min_version;
+
+ min_version = psa_version(IPC_TEST_MIN_SID);
+ printf("TFM service support min version is %d.\r\n", min_version);
+ ret->val = TEST_PASSED;
+}
diff --git a/test/suites/ipc/non_secure/ipc_ns_tests.h b/test/suites/ipc/non_secure/ipc_ns_tests.h
new file mode 100644
index 0000000000..12f3bb6a80
--- /dev/null
+++ b/test/suites/ipc/non_secure/ipc_ns_tests.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __IPC_NS_TESTS_H__
+#define __IPC_NS_TESTS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "test/framework/test_framework.h"
+
+/**
+ * \brief Register testsuite for ipc non-secure interface.
+ *
+ * \param[in] p_test_suite The test suite to be executed.
+ */
+void register_testsuite_ns_ipc_interface(struct test_suite_t *p_test_suite);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IPC_NS_TESTS_H__ */
diff --git a/test/suites/ipc/secure/ipc_s_interface_testsuite.c b/test/suites/ipc/secure/ipc_s_interface_testsuite.c
new file mode 100644
index 0000000000..62258b8b07
--- /dev/null
+++ b/test/suites/ipc/secure/ipc_s_interface_testsuite.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "ipc_s_tests.h"
+#include "psa_client.h"
+#include "test/framework/test_framework_helpers.h"
+
+/* List of tests */
+static void tfm_ipc_test_1001(struct test_result_t *ret);
+
+static struct test_t ipc_veneers_tests[] = {
+ {&tfm_ipc_test_1001, "TFM_IPC_TEST_1001", "Secure functional", {0} },
+};
+
+void register_testsuite_s_ipc_interface(struct test_suite_t *p_test_suite)
+{
+ uint32_t list_size;
+
+ list_size = (sizeof(ipc_veneers_tests) / sizeof(ipc_veneers_tests[0]));
+
+ set_testsuite("IPC secure interface test (TFM_IPC_TEST_1XXX)",
+ ipc_veneers_tests, list_size, p_test_suite);
+}
+
+/**
+ * \brief Functional test of the Secure interface
+ *
+ * \note This is a functional test only and doesn't
+ * mean to test all possible combinations of
+ * input parameters and return values.
+ */
+static void tfm_ipc_test_1001(struct test_result_t *ret)
+{
+ ret->val = TEST_PASSED;
+}
diff --git a/test/suites/ipc/secure/ipc_s_tests.h b/test/suites/ipc/secure/ipc_s_tests.h
new file mode 100644
index 0000000000..3b6a755b81
--- /dev/null
+++ b/test/suites/ipc/secure/ipc_s_tests.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __IPC_S_TESTS_H__
+#define __IPC_S_TESTS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "test/framework/test_framework.h"
+
+/**
+ * \brief Register testsuite for ipc secure interface.
+ *
+ * \param[in] p_test_suite The test suite to be executed.
+ */
+void register_testsuite_s_ipc_interface(struct test_suite_t *p_test_suite);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __IPC_S_TESTS_H__ */