aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Hu <david.hu@arm.com>2019-10-10 14:14:47 +0800
committerDavid Hu <david.hu@arm.com>2020-02-20 09:10:20 +0800
commit8b2d6ab08c2635fe5b07d11a8bebab6b8fad0d7c (patch)
tree7abb46994523e751efa7df9748dc063a514e84f4 /test
parent240f58e8f36d4b759b39aa1e0b02a8e9a3a0a9b5 (diff)
downloadtrusted-firmware-m-8b2d6ab08c2635fe5b07d11a8bebab6b8fad0d7c.tar.gz
Test: Add NS test interface of multi-core topology
Add Non-secure test interface of multi-core topology. Add a dummy non-secure test case. Change-Id: Ie51fa92e4ed2ec034d886b3fc5a0fabdce80fa94 Signed-off-by: David Hu <david.hu@arm.com>
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.inc3
-rw-r--r--test/CMakeLists.txt4
-rw-r--r--test/framework/non_secure_suites.c7
-rw-r--r--test/suites/multi_core/CMakeLists.inc31
-rw-r--r--test/suites/multi_core/non_secure/multi_core_ns_interface_testsuite.c39
-rw-r--r--test/suites/multi_core/non_secure/multi_core_ns_test.h29
6 files changed, 113 insertions, 0 deletions
diff --git a/test/CMakeLists.inc b/test/CMakeLists.inc
index 208c02c107..4e0c9a4125 100644
--- a/test/CMakeLists.inc
+++ b/test/CMakeLists.inc
@@ -52,6 +52,9 @@ endif()
if (ENABLE_PLATFORM_SERVICE_TESTS)
include(${CMAKE_CURRENT_LIST_DIR}/suites/platform/CMakeLists.inc)
endif()
+if (TFM_MULTI_CORE_TEST)
+ include(${CMAKE_CURRENT_LIST_DIR}/suites/multi_core/CMakeLists.inc)
+endif()
# Include the test partitions
include(${CMAKE_CURRENT_LIST_DIR}/test_services/CMakeLists.inc)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 2790fffd5a..e2cd2bf885 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -133,6 +133,10 @@ if (ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ENABLE_AUDIT_LOGGING_SERVICE_TESTS APPEND)
endif()
+if (TFM_MULTI_CORE_TEST)
+ embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES TFM_MULTI_CORE_TEST APPEND)
+endif()
+
if (NOT DEFINED TFM_BUILD_IN_SPE)
message(FATAL_ERROR "TFM_BUILD_IN_SPE is not set. Cannot specify current building status")
endif()
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index 7c83648310..58e474c92c 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -20,6 +20,7 @@
#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
@@ -82,6 +83,12 @@ static struct test_suite_t test_suites[] = {
/* Non-secure IPC test cases */
{&register_testsuite_ns_ipc_interface, 0, 0, 0},
#endif
+
+#ifdef TFM_MULTI_CORE_TEST
+ /* Multi-core topology test cases */
+ {&register_testsuite_multi_core_ns_interface, 0, 0, 0},
+#endif
+
/* End of test suites */
{0, 0, 0, 0}
};
diff --git a/test/suites/multi_core/CMakeLists.inc b/test/suites/multi_core/CMakeLists.inc
new file mode 100644
index 0000000000..521354a747
--- /dev/null
+++ b/test/suites/multi_core/CMakeLists.inc
@@ -0,0 +1,31 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Definitions to compile the "multi-core 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(MULTI_CORE_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()
+
+list(APPEND ALL_SRC_C_NS "${MULTI_CORE_TEST_DIR}/non_secure/multi_core_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)
diff --git a/test/suites/multi_core/non_secure/multi_core_ns_interface_testsuite.c b/test/suites/multi_core/non_secure/multi_core_ns_interface_testsuite.c
new file mode 100644
index 0000000000..38929c83e8
--- /dev/null
+++ b/test/suites/multi_core/non_secure/multi_core_ns_interface_testsuite.c
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#include "psa/client.h"
+#include "psa_manifest/sid.h"
+#include "test/framework/test_framework_helpers.h"
+
+/* List of tests */
+static void tfm_multi_core_dummy_test(struct test_result_t *ret);
+
+static struct test_t multi_core_tests[] = {
+ {&tfm_multi_core_dummy_test, "TFM_MULTI_CORE_TEST_DUMMY_TEST",
+ "A dummy test in multi-core test service", {0}},
+};
+
+void register_testsuite_multi_core_ns_interface(
+ struct test_suite_t *p_test_suite)
+{
+ uint32_t list_size;
+
+ list_size = (sizeof(multi_core_tests) / sizeof(multi_core_tests[0]));
+
+ set_testsuite("TF-M test cases for multi-core topology",
+ multi_core_tests, list_size, p_test_suite);
+}
+
+/**
+ * \brief A dummy test case. It will be replaced by actual test cases.
+ */
+static void tfm_multi_core_dummy_test(struct test_result_t *ret)
+{
+ TEST_LOG("A fake test and of course it succeeds\r\n");
+
+ ret->val = TEST_PASSED;
+}
diff --git a/test/suites/multi_core/non_secure/multi_core_ns_test.h b/test/suites/multi_core/non_secure/multi_core_ns_test.h
new file mode 100644
index 0000000000..44dda5d824
--- /dev/null
+++ b/test/suites/multi_core/non_secure/multi_core_ns_test.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2019, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ */
+
+#ifndef __MULTI_CORE_NS_TESTS_H__
+#define __MULTI_CORE_NS_TESTS_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "test/framework/test_framework.h"
+
+/**
+ * \brief Register testsuite for multi-core topology.
+ *
+ * \param[in] p_test_suite The test suite to be executed.
+ */
+void register_testsuite_multi_core_ns_interface(
+ struct test_suite_t *p_test_suite);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MULTI_CORE_NS_TESTS_H__ */