Build: Convert test dir to modern cmake
Alters cmake files inside the test directory. Alters some headers
where the include paths have changed. Alter how test enablement and
disablement is handled.
WARNING: This change will not build in isolation, it requires _all_
other cmake changes to successfully build. It is split out only for
clarity of changes.
Change-Id: Ib57e570d7265edd227c1e0712c0cee4e979e00a0
Signed-off-by: Raef Coles <raef.coles@arm.com>
diff --git a/test/CMakeLists.inc b/test/CMakeLists.inc
deleted file mode 100644
index a41642b..0000000
--- a/test/CMakeLists.inc
+++ /dev/null
@@ -1,61 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "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.
-if(NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-if (NOT DEFINED ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_AUDIT_LOGGING_SERVICE_TESTS is undefined.")
-endif()
-
-if (NOT DEFINED ENABLE_PLATFORM_SERVICE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_PLATFORM_SERVICE_TESTS is undefined.")
-endif()
-
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/bl2/include ABSOLUTE)
-embedded_include_directories(PATH ${TEST_DIR}/.. ABSOLUTE)
-
-# Include the test framework
-include(${CMAKE_CURRENT_LIST_DIR}/framework/CMakeLists.inc)
-
-# Include the test suites
-include(${CMAKE_CURRENT_LIST_DIR}/suites/core/CMakeLists.inc)
-include(${CMAKE_CURRENT_LIST_DIR}/suites/ps/CMakeLists.inc)
-include(${CMAKE_CURRENT_LIST_DIR}/suites/its/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}/suites/qcbor/CMakeLists.inc)
-include(${CMAKE_CURRENT_LIST_DIR}/suites/t_cose/CMakeLists.inc)
-include(${CMAKE_CURRENT_LIST_DIR}/suites/ipc/CMakeLists.inc)
-if (ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
- include(${CMAKE_CURRENT_LIST_DIR}/suites/audit/CMakeLists.inc)
-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 02b3bc5..ea6b32b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,223 +1,84 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-cmake_minimum_required(VERSION 3.7)
+cmake_minimum_required(VERSION 3.13)
-if (NOT DEFINED TFM_ROOT_DIR)
- set(TFM_ROOT_DIR ${CMAKE_SOURCE_DIR})
+add_library(tfm_ns_tests INTERFACE)
+add_library(tfm_test_framework INTERFACE)
+
+# For multi-core projects, the NS app can be run on a different CPU to the
+# Secure code. To facilitate this, we once again reload the compiler to load the
+# setting for the NS CPU. Cmake settings are directory scoped so this affects
+# anything loaded from or declared in this dir.
+if (TFM_MULTI_CORE_TOPOLOGY)
+ include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
endif()
-#Tell cmake where our modules can be found
-list(APPEND CMAKE_MODULE_PATH ${TFM_ROOT_DIR}/cmake)
+add_subdirectory(test_services)
-#Include common stuff to control cmake.
-include("Common/BuildSys")
-
-#Start an embedded project.
-embedded_project_start(CONFIG "${TFM_ROOT_DIR}/configs/ConfigDefault.cmake")
-project(tfm_tests LANGUAGES ASM C)
-embedded_project_fixup()
-
-#Check incoming configuration options
-if (NOT DEFINED SERVICES_TEST_ENABLED)
- message(FATAL_ERROR "Incomplete build configuration: SERVICES_TEST_ENABLED is undefined. ")
+add_subdirectory(suites/attestation)
+add_subdirectory(suites/audit)
+add_subdirectory(suites/core)
+add_subdirectory(suites/crypto)
+add_subdirectory(suites/its)
+add_subdirectory(suites/qcbor)
+add_subdirectory(suites/ps)
+add_subdirectory(suites/t_cose)
+add_subdirectory(suites/platform)
+if(TFM_PSA_API)
+ add_subdirectory(suites/ipc)
+endif()
+if(TFM_MULTI_CORE_TOPOLOGY)
+ add_subdirectory(suites/multi_core)
endif()
-if (NOT DEFINED CORE_TEST_INTERACTIVE)
- message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_INTERACTIVE is undefined. ")
-endif()
+target_sources(tfm_test_framework
+ INTERFACE
+ ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_helpers.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test_helper.c
+)
-if (NOT DEFINED CORE_TEST_POSITIVE)
- message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_POSITIVE is undefined. ")
-endif()
+target_include_directories(tfm_test_framework
+ INTERFACE
+ framework
+)
-if (NOT DEFINED TFM_LVL)
- message(FATAL_ERROR "Incomplete build configuration: TFM_LVL is undefined. ")
-endif()
+target_link_libraries(tfm_test_framework
+ INTERFACE
+ psa_interface
+)
-if (NOT DEFINED TFM_PARTITION_AUDIT_LOG)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_AUDIT_LOG is undefined.")
-endif()
+target_sources(tfm_ns_tests
+ INTERFACE
+ ${CMAKE_CURRENT_SOURCE_DIR}/framework/non_secure_suites.c
+)
-if (NOT DEFINED TFM_PARTITION_PROTECTED_STORAGE)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_PROTECTED_STORAGE is undefined.")
-endif()
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_framework
+ tfm_partition_defs
+)
-if (NOT DEFINED TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_INTERNAL_TRUSTED_STORAGE is undefined.")
-endif()
+target_compile_definitions(tfm_ns_tests
+ INTERFACE
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
+)
-if (NOT DEFINED TFM_PARTITION_CRYPTO)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_CRYPTO is undefined.")
-endif()
+####################### Secure #################################################
-if (NOT DEFINED TFM_PARTITION_INITIAL_ATTESTATION)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_INITIAL_ATTESTATION is undefined.")
-endif()
+target_sources(tfm_s_tests
+ INTERFACE
+ ${CMAKE_CURRENT_SOURCE_DIR}/framework/secure_suites.c
+)
-if (NOT DEFINED TFM_ENABLE_IRQ_TEST)
- message(FATAL_ERROR "Incomplete build configuration: TFM_ENABLE_IRQ_TEST is undefined.")
-endif()
-
-#Configure our options as needed.
-if (CORE_TEST_INTERACTIVE OR CORE_TEST_POSITIVE)
- set(ENABLE_CORE_TESTS True)
- set(ENABLE_CORE_TESTS_2 True)
-else()
- set(ENABLE_CORE_TESTS False)
- set(ENABLE_CORE_TESTS_2 False)
-endif()
-
-if (TFM_ENABLE_IRQ_TEST)
- set(ENABLE_IRQ_TEST_SERVICES ON)
-else()
- set(ENABLE_IRQ_TEST_SERVICES OFF)
-endif()
-
-if (ENABLE_CORE_TESTS)
- # If the platform doesn't specify whether the peripheral test is enabled
- # or not, select it by default.
- if (NOT DEFINED TFM_ENABLE_PERIPH_ACCESS_TEST)
- set(TFM_ENABLE_PERIPH_ACCESS_TEST TRUE)
- endif()
-
- if (TFM_ENABLE_PERIPH_ACCESS_TEST)
- add_definitions(-DTFM_ENABLE_PERIPH_ACCESS_TEST)
- endif()
-else()
- set(TFM_ENABLE_PERIPH_ACCESS_TEST FALSE)
-endif()
-
-include(${CMAKE_CURRENT_LIST_DIR}/TestConfig.cmake)
-include(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.inc)
-
-if (ENABLE_PROTECTED_STORAGE_SERVICE_TESTS)
- embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES ENABLE_PROTECTED_STORAGE_SERVICE_TESTS APPEND)
- embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ENABLE_PROTECTED_STORAGE_SERVICE_TESTS APPEND)
-endif()
-
-if (ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS)
- embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS APPEND)
- embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS APPEND)
-endif()
-
-if (ENABLE_CRYPTO_SERVICE_TESTS)
- embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES ENABLE_CRYPTO_SERVICE_TESTS APPEND)
- embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ENABLE_CRYPTO_SERVICE_TESTS APPEND)
-endif()
-
-if (ENABLE_ATTESTATION_SERVICE_TESTS)
- embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES ENABLE_ATTESTATION_SERVICE_TESTS APPEND)
- embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ENABLE_ATTESTATION_SERVICE_TESTS APPEND)
-endif()
-
-if (ENABLE_PLATFORM_SERVICE_TESTS)
- embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES ENABLE_PLATFORM_SERVICE_TESTS APPEND)
- embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ENABLE_PLATFORM_SERVICE_TESTS APPEND)
-endif()
-
-if (ENABLE_QCBOR_TESTS)
- embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES ENABLE_QCBOR_TESTS APPEND)
- embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ENABLE_QCBOR_TESTS APPEND)
-endif()
-
-if (ENABLE_T_COSE_TESTS)
- embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ENABLE_T_COSE_TESTS APPEND)
-endif()
-
-if (ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
- embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES ENABLE_AUDIT_LOGGING_SERVICE_TESTS APPEND)
- 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()
-
-if (NOT TARGET tfm_t_cose_verify AND (ENABLE_ATTESTATION_SERVICE_TESTS OR ENABLE_T_COSE_TESTS))
- add_subdirectory(${TFM_ROOT_DIR}/lib/ext/t_cose ${CMAKE_CURRENT_BINARY_DIR}/t_cose)
-endif()
-
-if ((NOT TARGET tfm_qcbor_encode OR NOT TARGET tfm_qcbor_decode) AND (ENABLE_ATTESTATION_SERVICE_TESTS OR ENABLE_QCBOR_TESTS OR ENABLE_T_COSE_TESTS))
- add_subdirectory(${TFM_ROOT_DIR}/lib/ext/qcbor ${CMAKE_CURRENT_BINARY_DIR}/qcbor)
-endif()
-
-set(TEST_SRC "${CMAKE_CURRENT_LIST_DIR}/../log/tfm_log_raw.c")
-if (TFM_BUILD_IN_SPE)
- #Build the secure library. Even though secure tests files depend on
- #tfm_qcbor, this is not expressed here as the tfm_attest library is expected
- #to hold the compiled tfm_qcbor files.
- add_library(tfm_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_S} ${TEST_SRC})
- if (ENABLE_ATTESTATION_SERVICE_TESTS)
- target_sources(tfm_secure_tests PRIVATE $<TARGET_OBJECTS:tfm_t_cose_verify> $<TARGET_OBJECTS:tfm_qcbor_decode>)
- endif()
-
- #Set common compiler and linker flags
- if (DEFINED CMSE_FLAGS)
- embedded_set_target_compile_flags(TARGET tfm_secure_tests LANGUAGE C APPEND FLAGS ${CMSE_FLAGS})
- endif()
- config_setting_shared_compiler_flags(tfm_secure_tests)
- config_setting_shared_linker_flags(tfm_secure_tests)
-
- embedded_set_target_compile_defines(TARGET tfm_secure_tests LANGUAGE C DEFINES __thumb2__ TFM_LVL=${TFM_LVL} APPEND)
-
- if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE
- PATH "Default install location for tfm_storage."
- FORCE)
- endif()
-
- install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test.h
- ${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_secure_client_service/tfm_secure_client_service_api.h
- DESTINATION export/tfm/test/inc)
-
- embedded_project_end(tfm_secure_tests)
-else ()
- #Build the non-secure library
- set(CMAKE_STATIC_LIBRARY_PREFIX_C "lib")
- add_library(tfm_non_secure_tests STATIC ${ALL_SRC_C} ${ALL_SRC_C_NS} ${TEST_SRC})
-
- embedded_target_include_directories(TARGET tfm_non_secure_tests PATH ${CMSIS_DIR}/RTOS2/Include ABSOLUTE APPEND)
-
- if (ENABLE_ATTESTATION_SERVICE_TESTS OR ENABLE_T_COSE_TESTS)
- target_sources(tfm_non_secure_tests PRIVATE $<TARGET_OBJECTS:tfm_t_cose_verify> PRIVATE $<TARGET_OBJECTS:tfm_t_cose_sign>)
- endif()
- if (ENABLE_ATTESTATION_SERVICE_TESTS OR ENABLE_QCBOR_TESTS OR ENABLE_T_COSE_TESTS)
- target_sources(tfm_non_secure_tests PRIVATE $<TARGET_OBJECTS:tfm_qcbor_decode> PRIVATE $<TARGET_OBJECTS:tfm_qcbor_encode>)
- endif()
-
- #Set common compiler and linker flags
- config_setting_shared_compiler_flags(tfm_non_secure_tests)
- config_setting_shared_linker_flags(tfm_non_secure_tests)
-
- #Set macro definitions
- set(TARGET_COMPILE_DEFINITIONS __thumb2__ __DOMAIN_NS=1 DOMAIN_NS=__DOMAIN_NS TFM_LVL=${TFM_LVL})
- embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES ${TARGET_COMPILE_DEFINITIONS} APPEND)
-
- if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE
- PATH "Default install location for tfm_storage."
- FORCE)
- endif()
-
- install(TARGETS tfm_non_secure_tests
- DESTINATION export/tfm/test/lib
- PUBLIC_HEADER DESTINATION export/tfm/test/inc)
-
- if(ENABLE_PROTECTED_STORAGE_SERVICE_TESTS)
- #only PS tests are using semaphore and thread APIs
- install(FILES ${TFM_ROOT_DIR}/interface/include/os_wrapper/semaphore.h
- ${TFM_ROOT_DIR}/interface/include/os_wrapper/thread.h
- DESTINATION export/tfm/include/os_wrapper)
- endif()
-
- embedded_project_end(tfm_non_secure_tests)
-endif()
+target_link_libraries(tfm_s_tests
+ INTERFACE
+ tfm_test_framework
+ tfm_partition_defs
+ tfm_spm
+)
diff --git a/test/framework/CMakeLists.inc b/test/framework/CMakeLists.inc
deleted file mode 100644
index 50fafb3..0000000
--- a/test/framework/CMakeLists.inc
+++ /dev/null
@@ -1,45 +0,0 @@
-#-------------------------------------------------------------------------------
-# 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
index 0bf20a9..37655bb 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -10,63 +10,77 @@
#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/attest_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"
+#ifdef TFM_PARTITION_PROTECTED_STORAGE
+#include "ps_ns_tests.h"
+#endif
+#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
+#include "its_ns_tests.h"
+#endif
+#ifdef TFM_PARTITION_CRYPTO
+#include "crypto_ns_tests.h"
+#endif
+#ifdef TFM_PARTITION_INITIAL_ATTESTATION
+#include "attest_ns_tests.h"
+#include "qcbor_ns_tests.h"
+#ifndef SYMMETRIC_INITIAL_ATTESTATION
+#include "t_cose_ns_tests.h"
+#endif /* !SYMMETRIC_INITIAL_ATTESTATION */
+#endif
+#ifdef TFM_PARTITION_PLATFORM
+#include "platform_ns_tests.h"
+#endif
+#include "core_ns_tests.h"
+#ifdef TFM_PSA_API
+#include "ipc_ns_tests.h"
+#else
+#ifdef TFM_PARTITION_AUDIT_LOG
+#include "audit_ns_tests.h"
+#endif
+#endif /* TFM_PSA_API */
+#ifdef TFM_MULTI_CORE_TOPOLOGY
+#include "multi_core_ns_test.h"
+#endif /* TFM_MULTI_CORE_TOPOLOGY */
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
+#ifdef TFM_PARTITION_PROTECTED_STORAGE
{®ister_testsuite_ns_psa_ps_interface, 0, 0, 0},
#endif
-#ifdef ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS
+#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
/* Non-secure ITS test cases */
{®ister_testsuite_ns_psa_its_interface, 0, 0, 0},
#endif
-#ifdef ENABLE_CRYPTO_SERVICE_TESTS
+#ifdef TFM_PARTITION_CRYPTO
/* 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
+#ifdef TFM_PARTITION_PLATFORM
/* Non-secure platform service test cases */
{®ister_testsuite_ns_platform_interface, 0, 0, 0},
#endif
-#ifdef ENABLE_QCBOR_TESTS
+#ifdef TFM_PARTITION_INITIAL_ATTESTATION
+ /* Non-secure initial attestation service test cases */
+ {®ister_testsuite_ns_attestation_interface, 0, 0, 0},
+
/* Non-secure QCBOR library test cases */
{®ister_testsuite_ns_qcbor, 0, 0, 0},
-#endif
-#ifdef ENABLE_T_COSE_TESTS
+#ifndef SYMMETRIC_INITIAL_ATTESTATION
/* Non-secure T_COSE library test cases */
{®ister_testsuite_ns_t_cose, 0, 0, 0},
+#endif /* !SYMMETRIC_INITIAL_ATTESTATION */
#endif
-#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS
+#ifdef TFM_PARTITION_AUDIT_LOG
/* 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},
@@ -77,12 +91,12 @@
{®ister_testsuite_ns_core_interactive, 0, 0, 0},
#endif
-#ifdef ENABLE_IPC_TEST
+#ifdef TFM_PSA_API
/* Non-secure IPC test cases */
{®ister_testsuite_ns_ipc_interface, 0, 0, 0},
#endif
-#ifdef TFM_MULTI_CORE_TEST
+#ifdef TFM_MULTI_CORE_TOPOLOGY
/* Multi-core topology test cases */
{®ister_testsuite_multi_core_ns_interface, 0, 0, 0},
#endif
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
index dc574c0..2e2eb17 100644
--- a/test/framework/secure_suites.c
+++ b/test/framework/secure_suites.c
@@ -10,19 +10,32 @@
#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/attest_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"
+#ifdef TFM_PARTITION_PROTECTED_STORAGE
+#include "ps_tests.h"
+#endif
+#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
+#include "its_s_tests.h"
+#endif
+#ifdef TFM_PARTITION_INITIAL_ATTESTATION
+#include "attest_s_tests.h"
+#endif
+#ifdef TFM_PARTITION_CRYPTO
+#include "crypto_s_tests.h"
+#endif
+#ifdef TFM_PARTITION_PLATFORM
+#include "platform_s_tests.h"
+#endif
+#ifdef TFM_PSA_API
+#include "ipc_s_tests.h"
+#else
+#ifdef TFM_PARTITION_AUDIT_LOG
+#include "audit_s_tests.h"
+#endif
+#endif /* TFM_PSA_API */
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
+#ifdef TFM_PARTITION_PROTECTED_STORAGE
{®ister_testsuite_s_psa_ps_interface, 0, 0, 0},
{®ister_testsuite_s_psa_ps_reliability, 0, 0, 0},
@@ -31,28 +44,28 @@
#endif
#endif
-#ifdef ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS
+#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
/* 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
+#ifdef TFM_PARTITION_CRYPTO
/* Crypto test cases */
{®ister_testsuite_s_crypto_interface, 0, 0, 0},
#endif
-#ifdef ENABLE_ATTESTATION_SERVICE_TESTS
+#ifdef TFM_PARTITION_INITIAL_ATTESTATION
/* Secure initial attestation service test cases */
{®ister_testsuite_s_attestation_interface, 0, 0, 0},
#endif
-#ifdef ENABLE_PLATFORM_SERVICE_TESTS
+#ifdef TFM_PARTITION_PLATFORM
/* Secure platform service test cases */
{®ister_testsuite_s_platform_interface, 0, 0, 0},
#endif
-#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS
+#ifdef TFM_PARTITION_AUDIT_LOG
/* Secure Audit Logging test cases */
{®ister_testsuite_s_audit_interface, 0, 0, 0},
#endif
@@ -61,7 +74,6 @@
/* 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}
};
diff --git a/test/suites/attestation/CMakeLists.inc b/test/suites/attestation/CMakeLists.inc
deleted file mode 100644
index 46744d4..0000000
--- a/test/suites/attestation/CMakeLists.inc
+++ /dev/null
@@ -1,95 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "secure attestation 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(ATTESTATION_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 ATTEST_INCLUDE_TEST_CODE)
- message(FATAL_ERROR "Incomplete build configuration: ATTEST_INCLUDE_TEST_CODE is undefined. ")
-endif()
-
-if (NOT DEFINED ATTEST_CLAIM_VALUE_CHECK)
- message(FATAL_ERROR "Incomplete build configuration: ATTEST_CLAIM_VALUE_CHECK is undefined. ")
-endif()
-
-if (NOT DEFINED ENABLE_ATTESTATION_SERVICE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_ATTESTATION_SERVICE_TESTS is undefined. ")
-elseif(ENABLE_ATTESTATION_SERVICE_TESTS)
- list(APPEND ATTEST_TEST_SRC_S
- "${ATTESTATION_TEST_DIR}/attest_token_test.c"
- "${ATTESTATION_TEST_DIR}/attest_token_decode_common.c"
- "${TFM_ROOT_DIR}/lib/ext/qcbor/util/qcbor_util.c"
- )
-
- list(APPEND ATTEST_TEST_SRC_NS
- "${ATTESTATION_TEST_DIR}/attest_token_test.c"
- "${ATTESTATION_TEST_DIR}/attest_token_decode_common.c"
- "${TFM_ROOT_DIR}/lib/ext/qcbor/util/qcbor_util.c"
- )
-
- if (SYMMETRIC_INITIAL_ATTESTATION)
- list(APPEND ATTEST_TEST_SRC_S
- "${ATTESTATION_TEST_DIR}/secure/attest_symmetric_s_interface_testsuite.c"
- "${ATTESTATION_TEST_DIR}/attest_token_decode_symmetric.c"
- )
- list(APPEND ATTEST_TEST_SRC_NS
- "${ATTESTATION_TEST_DIR}/non_secure/attest_symmetric_ns_interface_testsuite.c"
- "${ATTESTATION_TEST_DIR}/attest_token_decode_symmetric.c"
- )
- else()
- list(APPEND ATTEST_TEST_SRC_S
- "${ATTESTATION_TEST_DIR}/secure/attest_asymmetric_s_interface_testsuite.c"
- "${ATTESTATION_TEST_DIR}/attest_public_key.c"
- "${ATTESTATION_TEST_DIR}/attest_token_decode_asymmetric.c"
- )
- list(APPEND ATTEST_TEST_SRC_NS
- "${ATTESTATION_TEST_DIR}/non_secure/attest_asymmetric_ns_interface_testsuite.c"
- "${ATTESTATION_TEST_DIR}/attest_public_key.c"
- "${ATTESTATION_TEST_DIR}/attest_token_decode_asymmetric.c"
- )
- endif()
-
- if (ATTEST_INCLUDE_TEST_CODE)
- set_property(SOURCE ${ATTEST_TEST_SRC_S} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_TEST_CODE)
- set_property(SOURCE ${ATTEST_TEST_SRC_NS} APPEND PROPERTY COMPILE_DEFINITIONS INCLUDE_TEST_CODE)
- endif()
-
- if (ATTEST_CLAIM_VALUE_CHECK)
- set_property(SOURCE ${ATTEST_TEST_SRC_S} APPEND PROPERTY COMPILE_DEFINITIONS CLAIM_VALUE_CHECK)
- set_property(SOURCE ${ATTEST_TEST_SRC_NS} APPEND PROPERTY COMPILE_DEFINITIONS CLAIM_VALUE_CHECK)
- endif()
-
- #Setting include directories
- embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/partitions/initial_attestation ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/lib/ext/qcbor/inc ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/lib/ext/qcbor/util ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/lib/ext/t_cose/inc ABSOLUTE)
-
- #Append all our source files to global lists.
- list(APPEND ALL_SRC_C_S ${ATTEST_TEST_SRC_S})
- list(APPEND ALL_SRC_C_NS ${ATTEST_TEST_SRC_NS})
- unset(ATTEST_TEST_SRC_S)
- unset(ATTEST_TEST_SRC_NS)
-endif()
diff --git a/test/suites/attestation/CMakeLists.txt b/test/suites/attestation/CMakeLists.txt
new file mode 100644
index 0000000..2eca79a
--- /dev/null
+++ b/test/suites/attestation/CMakeLists.txt
@@ -0,0 +1,99 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+if (NOT TFM_PARTITION_INITIAL_ATTESTATION)
+ return()
+endif()
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_attestation_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_attestation_ns
+ PRIVATE
+ attest_public_key.c
+ attest_token_test.c
+ attest_token_decode_common.c
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:attest_token_decode_symmetric.c>
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:non_secure/attest_symmetric_ns_interface_testsuite.c>
+ $<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:attest_token_decode_asymmetric.c>
+ $<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:non_secure/attest_asymmetric_ns_interface_testsuite.c>
+)
+
+target_include_directories(tfm_test_suite_attestation_ns
+ PUBLIC
+ non_secure
+ PRIVATE
+ .
+)
+
+target_compile_definitions(tfm_test_suite_attestation_ns
+ PRIVATE
+ DOMAIN_NS=1
+ $<$<CONFIG:Debug>:INCLUDE_TEST_CODE>
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
+)
+
+target_link_libraries(tfm_test_suite_attestation_ns
+ PRIVATE
+ tfm_qcbor
+ tfm_t_cose
+ tfm_test_framework
+ #TODO I'm not sure this should _really_ be linked here
+ tfm_attestation_defs
+ tfm_boot_status
+ platform_ns
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_attestation_ns
+)
+
+####################### Secure #################################################
+
+target_sources(tfm_test_suite_attestation_s
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/attest_public_key.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/attest_token_test.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_common.c
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_symmetric.c>
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:${CMAKE_CURRENT_SOURCE_DIR}/secure/attest_symmetric_s_interface_testsuite.c>
+ $<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_asymmetric.c>
+ $<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/secure/attest_asymmetric_s_interface_testsuite.c>
+)
+
+target_include_directories(tfm_test_suite_attestation_s
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+target_compile_definitions(tfm_test_suite_attestation_s
+ PRIVATE
+ $<$<CONFIG:Debug>:INCLUDE_TEST_CODE>
+ $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
+)
+
+target_link_libraries(tfm_test_suite_attestation_s
+ PRIVATE
+ tfm_qcbor
+ tfm_t_cose
+ tfm_test_framework
+ tfm_partition_attestation
+ tfm_boot_status
+ tfm_partition_crypto
+ platform_s
+)
+
+target_link_libraries(tfm_s_tests
+ INTERFACE
+ tfm_test_suite_attestation_s
+)
diff --git a/test/suites/attestation/non_secure/attest_ns_tests.h b/test/suites/attestation/non_secure/attest_ns_tests.h
index c2d5a3e..c2737ee 100644
--- a/test/suites/attestation/non_secure/attest_ns_tests.h
+++ b/test/suites/attestation/non_secure/attest_ns_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __ATTESTATION_NS_TESTS_H__
#define __ATTESTATION_NS_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/attestation/non_secure/attest_symmetric_ns_interface_testsuite.c b/test/suites/attestation/non_secure/attest_symmetric_ns_interface_testsuite.c
index 7929dfa..d3f3914 100644
--- a/test/suites/attestation/non_secure/attest_symmetric_ns_interface_testsuite.c
+++ b/test/suites/attestation/non_secure/attest_symmetric_ns_interface_testsuite.c
@@ -7,10 +7,10 @@
#include "attest_ns_tests.h"
#include "psa/initial_attestation.h"
-#include "secure_fw/partitions/initial_attestation/attest.h"
-#include "../attest_tests_common.h"
-#include "../attest_token_test_values.h"
-#include "../attest_token_test.h"
+#include "attest.h"
+#include "attest_tests_common.h"
+#include "attest_token_test_values.h"
+#include "attest_token_test.h"
/* Define test suite for attestation service tests */
/* List of tests */
diff --git a/test/suites/attestation/secure/attest_asymmetric_s_interface_testsuite.c b/test/suites/attestation/secure/attest_asymmetric_s_interface_testsuite.c
index ea277a8..78dfbb3 100644
--- a/test/suites/attestation/secure/attest_asymmetric_s_interface_testsuite.c
+++ b/test/suites/attestation/secure/attest_asymmetric_s_interface_testsuite.c
@@ -7,7 +7,7 @@
#include "attest_s_tests.h"
#include "psa/initial_attestation.h"
-#include "secure_fw/partitions/initial_attestation/attest.h"
+#include "attest.h"
#include "../attest_tests_common.h"
#include "../attest_token_test_values.h"
#include "../attest_token_test.h"
diff --git a/test/suites/attestation/secure/attest_s_tests.h b/test/suites/attestation/secure/attest_s_tests.h
index 97e8c40..4b29506 100644
--- a/test/suites/attestation/secure/attest_s_tests.h
+++ b/test/suites/attestation/secure/attest_s_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __ATTESTATION_S_TESTS_H__
#define __ATTESTATION_S_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/attestation/secure/attest_symmetric_s_interface_testsuite.c b/test/suites/attestation/secure/attest_symmetric_s_interface_testsuite.c
index 1eff550..1852098 100644
--- a/test/suites/attestation/secure/attest_symmetric_s_interface_testsuite.c
+++ b/test/suites/attestation/secure/attest_symmetric_s_interface_testsuite.c
@@ -7,10 +7,10 @@
#include "attest_s_tests.h"
#include "psa/initial_attestation.h"
-#include "secure_fw/partitions/initial_attestation/attest.h"
-#include "../attest_tests_common.h"
-#include "../attest_token_test_values.h"
-#include "../attest_token_test.h"
+#include "attest.h"
+#include "attest_tests_common.h"
+#include "attest_token_test_values.h"
+#include "attest_token_test.h"
/* Define test suite for attestation service tests */
/* List of tests */
diff --git a/test/suites/audit/CMakeLists.inc b/test/suites/audit/CMakeLists.inc
deleted file mode 100644
index b1a8f46..0000000
--- a/test/suites/audit/CMakeLists.inc
+++ /dev/null
@@ -1,32 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "audit logging 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(AUDIT_LOGGING_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_S "${AUDIT_LOGGING_TEST_DIR}/secure/audit_s_interface_testsuite.c")
-list(APPEND ALL_SRC_C_NS "${AUDIT_LOGGING_TEST_DIR}/non_secure/audit_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/audit/CMakeLists.txt b/test/suites/audit/CMakeLists.txt
new file mode 100644
index 0000000..6750343
--- /dev/null
+++ b/test/suites/audit/CMakeLists.txt
@@ -0,0 +1,70 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+#TODO AUDIT should support IPC
+if(TFM_PSA_API)
+ return()
+endif()
+
+if (NOT TFM_PARTITION_AUDIT_LOG)
+ return()
+endif()
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_audit_ns STATIC)
+
+target_sources(tfm_test_suite_audit_ns
+ PRIVATE
+ non_secure/audit_ns_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_audit_ns
+ PUBLIC
+ non_secure
+)
+
+target_compile_definitions(tfm_test_suite_audit_ns
+ PRIVATE
+ DOMAIN_NS=1
+)
+
+target_link_libraries(tfm_test_suite_audit_ns
+ PRIVATE
+ tfm_test_framework
+ tfm_partition_audit
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_audit_ns
+)
+
+####################### Secure #################################################
+
+target_sources(tfm_test_suite_audit_s
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/audit_s_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_audit_s
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure
+)
+
+target_link_libraries(tfm_test_suite_audit_s
+ PRIVATE
+ tfm_test_framework
+ tfm_partition_audit
+)
+
+target_link_libraries(tfm_s_tests
+ INTERFACE
+ tfm_test_suite_audit_s
+)
diff --git a/test/suites/audit/non_secure/audit_ns_interface_testsuite.c b/test/suites/audit/non_secure/audit_ns_interface_testsuite.c
index a6179ac..337eaaf 100644
--- a/test/suites/audit/non_secure/audit_ns_interface_testsuite.c
+++ b/test/suites/audit/non_secure/audit_ns_interface_testsuite.c
@@ -5,11 +5,11 @@
*
*/
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#include "psa_audit_api.h"
#include "audit_ns_tests.h"
#include "tfm_api.h"
-#include "secure_fw/partitions/audit_logging/audit_core.h"
+#include "audit_core.h"
#include "../audit_tests_common.h"
diff --git a/test/suites/audit/non_secure/audit_ns_tests.h b/test/suites/audit/non_secure/audit_ns_tests.h
index 3578bbe..7c4c67c 100644
--- a/test/suites/audit/non_secure/audit_ns_tests.h
+++ b/test/suites/audit/non_secure/audit_ns_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
/**
* \brief Register testsuite for audit logging non-secure interface.
diff --git a/test/suites/audit/secure/audit_s_interface_testsuite.c b/test/suites/audit/secure/audit_s_interface_testsuite.c
index 550ec10..8299c59 100644
--- a/test/suites/audit/secure/audit_s_interface_testsuite.c
+++ b/test/suites/audit/secure/audit_s_interface_testsuite.c
@@ -5,12 +5,12 @@
*
*/
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#include "psa_audit_api.h"
#include "audit_s_tests.h"
#include "tfm_api.h"
#include "psa_audit_api.h"
-#include "secure_fw/partitions/audit_logging/audit_core.h"
+#include "audit_core.h"
#include "../audit_tests_common.h"
diff --git a/test/suites/audit/secure/audit_s_tests.h b/test/suites/audit/secure/audit_s_tests.h
index 87bc904..70e5569 100644
--- a/test/suites/audit/secure/audit_s_tests.h
+++ b/test/suites/audit/secure/audit_s_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
/**
* \brief Register testsuite for audit logging secure interface.
diff --git a/test/suites/core/CMakeLists.inc b/test/suites/core/CMakeLists.inc
deleted file mode 100644
index 3c7d267..0000000
--- a/test/suites/core/CMakeLists.inc
+++ /dev/null
@@ -1,53 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2019, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "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(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()
-
-if (NOT DEFINED TFM_PARTITION_TEST_CORE)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_CORE is undefined. ")
-elseif (TFM_PARTITION_TEST_CORE)
- list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/non_secure/core_test_api.c")
-endif()
-
-if (NOT DEFINED CORE_TEST_POSITIVE)
- message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_POSITIVE is undefined. ")
-elseif (CORE_TEST_POSITIVE)
- list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/non_secure/core_ns_positive_testsuite.c")
-endif()
-
-if (NOT DEFINED CORE_TEST_INTERACTIVE)
- message(FATAL_ERROR "Incomplete build configuration: CORE_TEST_INTERACTIVE is undefined. ")
-elseif (CORE_TEST_INTERACTIVE)
- list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/non_secure/core_ns_interactive_testsuite.c")
-endif()
-
-# Disable recursion test from core test by default
-if (ENABLE_TFM_CORE_RECURSION_TESTS)
- add_definitions(-DENABLE_TFM_CORE_RECURSION_TESTS)
-endif()
-
-#Setting include directories
-embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/test/interface/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
diff --git a/test/suites/core/CMakeLists.txt b/test/suites/core/CMakeLists.txt
new file mode 100644
index 0000000..002d215
--- /dev/null
+++ b/test/suites/core/CMakeLists.txt
@@ -0,0 +1,44 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_core_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_core_ns
+ PRIVATE
+ non_secure/core_ns_interactive_testsuite.c
+ non_secure/core_ns_positive_testsuite.c
+ non_secure/core_test_api.c
+)
+
+target_include_directories(tfm_test_suite_core_ns
+ PUBLIC
+ non_secure
+)
+
+target_compile_definitions(tfm_test_suite_core_ns
+ PRIVATE
+ DOMAIN_NS=1
+)
+
+target_link_libraries(tfm_test_suite_core_ns
+ PRIVATE
+ psa_api_ns
+ tfm_test_framework
+ tfm_ns_integration_test
+ CMSIS_5_tfm_ns
+ tfm_partition_defs
+)
+
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_core_ns
+)
diff --git a/test/suites/core/non_secure/core_ns_interactive_testsuite.c b/test/suites/core/non_secure/core_ns_interactive_testsuite.c
index a9464ee..0f40a1c 100644
--- a/test/suites/core/non_secure/core_ns_interactive_testsuite.c
+++ b/test/suites/core/non_secure/core_ns_interactive_testsuite.c
@@ -10,8 +10,8 @@
#include "cmsis_os2.h"
#include "tfm_nspm_api.h"
#include "tfm_veneers.h"
-#include "test/suites/core/non_secure/core_test_api.h"
-#include "test/test_services/tfm_core_test/core_test_defs.h"
+#include "core_test_api.h"
+#include "core_test_defs.h"
#include <stdio.h>
#include <string.h>
@@ -23,7 +23,7 @@
#ifdef TEST_FRAMEWORK_S
#include \
- "test/test_services/tfm_secure_client_service/tfm_secure_client_service_api.h"
+ "tfm_secure_client_service_api.h"
#endif
#define TRY_SFN(fn, ...) \
diff --git a/test/suites/core/non_secure/core_ns_positive_testsuite.c b/test/suites/core/non_secure/core_ns_positive_testsuite.c
index 82b5fac..1f881b9 100644
--- a/test/suites/core/non_secure/core_ns_positive_testsuite.c
+++ b/test/suites/core/non_secure/core_ns_positive_testsuite.c
@@ -13,8 +13,8 @@
#include "cmsis.h"
#include "tfm_api.h"
#include "tfm_plat_test.h"
-#include "test/suites/core/non_secure/core_test_api.h"
-#include "test/test_services/tfm_core_test/core_test_defs.h"
+#include "core_test_api.h"
+#include "core_test_defs.h"
#ifdef TFM_PSA_API
#include "psa_manifest/sid.h"
#else /* TFM_PSA_API */
diff --git a/test/suites/core/non_secure/core_ns_tests.h b/test/suites/core/non_secure/core_ns_tests.h
index 52d10b5..08a3fc9 100644
--- a/test/suites/core/non_secure/core_ns_tests.h
+++ b/test/suites/core/non_secure/core_ns_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
/**
* \brief Register testsuite for the core positive tests.
diff --git a/test/suites/core/non_secure/core_test_api.c b/test/suites/core/non_secure/core_test_api.c
index b49af5d..7a7aa0b 100644
--- a/test/suites/core/non_secure/core_test_api.c
+++ b/test/suites/core/non_secure/core_test_api.c
@@ -6,7 +6,7 @@
*/
#include "core_test_api.h"
-#include "test/test_services/tfm_core_test/core_test_defs.h"
+#include "core_test_defs.h"
int32_t tfm_core_test_call(int32_t (*fn_ptr)(struct psa_invec*, size_t,
struct psa_outvec*, size_t),
diff --git a/test/suites/crypto/CMakeLists.inc b/test/suites/crypto/CMakeLists.inc
deleted file mode 100644
index ae6baf3..0000000
--- a/test/suites/crypto/CMakeLists.inc
+++ /dev/null
@@ -1,84 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "Crypto 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(CRYPTO_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 ENABLE_CRYPTO_SERVICE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_CRYPTO_SERVICE_TESTS is undefined. ")
-elseif (ENABLE_CRYPTO_SERVICE_TESTS)
- list(APPEND ALL_SRC_C_S "${CRYPTO_TEST_DIR}/secure/crypto_sec_interface_testsuite.c"
- "${CRYPTO_TEST_DIR}/crypto_tests_common.c")
- list(APPEND ALL_SRC_C_NS "${CRYPTO_TEST_DIR}/non_secure/crypto_ns_interface_testsuite.c"
- "${CRYPTO_TEST_DIR}/crypto_tests_common.c")
-
- #Enable the test cases by default
- if (NOT DEFINED TFM_CRYPTO_TEST_ALG_CBC)
- set(TFM_CRYPTO_TEST_ALG_CBC ON)
- endif()
- if (NOT DEFINED TFM_CRYPTO_TEST_ALG_CCM)
- set(TFM_CRYPTO_TEST_ALG_CCM ON)
- endif()
- if (NOT DEFINED TFM_CRYPTO_TEST_ALG_CFB)
- set(TFM_CRYPTO_TEST_ALG_CFB ON)
- endif()
- if (NOT DEFINED TFM_CRYPTO_TEST_ALG_CTR)
- set(TFM_CRYPTO_TEST_ALG_CTR ON)
- endif()
- if (NOT DEFINED TFM_CRYPTO_TEST_ALG_GCM)
- set(TFM_CRYPTO_TEST_ALG_GCM ON)
- endif()
- if (NOT DEFINED TFM_CRYPTO_TEST_ALG_SHA_512)
- set(TFM_CRYPTO_TEST_ALG_SHA_512 ON)
- endif()
- if (NOT DEFINED TFM_CRYPTO_TEST_HKDF)
- set(TFM_CRYPTO_TEST_HKDF ON)
- endif()
-
- if (TFM_CRYPTO_TEST_ALG_CBC)
- add_definitions(-DTFM_CRYPTO_TEST_ALG_CBC)
- endif()
- if (TFM_CRYPTO_TEST_ALG_CCM)
- add_definitions(-DTFM_CRYPTO_TEST_ALG_CCM)
- endif()
- if (TFM_CRYPTO_TEST_ALG_CFB)
- add_definitions(-DTFM_CRYPTO_TEST_ALG_CFB)
- endif()
- if (TFM_CRYPTO_TEST_ALG_CTR)
- add_definitions(-DTFM_CRYPTO_TEST_ALG_CTR)
- endif()
- if (TFM_CRYPTO_TEST_ALG_GCM)
- add_definitions(-DTFM_CRYPTO_TEST_ALG_GCM)
- endif()
- if (TFM_CRYPTO_TEST_ALG_SHA_512)
- add_definitions(-DTFM_CRYPTO_TEST_ALG_SHA_512)
- endif()
- if (TFM_CRYPTO_TEST_HKDF)
- add_definitions(-DTFM_CRYPTO_TEST_HKDF)
- endif()
-
- #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/crypto/CMakeLists.txt b/test/suites/crypto/CMakeLists.txt
new file mode 100644
index 0000000..953d5bf
--- /dev/null
+++ b/test/suites/crypto/CMakeLists.txt
@@ -0,0 +1,87 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+if (NOT TFM_PARTITION_CRYPTO)
+ return()
+endif()
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_crypto_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_crypto_ns
+ PRIVATE
+ ./crypto_tests_common.c
+ ./non_secure/crypto_ns_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_crypto_ns
+ PUBLIC
+ ./non_secure
+)
+
+target_link_libraries(tfm_test_suite_crypto_ns
+ PRIVATE
+ tfm_test_framework
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_crypto_ns
+)
+
+target_compile_definitions(tfm_test_suite_crypto_ns
+ PRIVATE
+ DOMAIN_NS=1
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CBC}>:TFM_CRYPTO_TEST_ALG_CBC>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CCM}>:TFM_CRYPTO_TEST_ALG_CCM>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CFB}>:TFM_CRYPTO_TEST_ALG_CFB>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CTR}>:TFM_CRYPTO_TEST_ALG_CTR>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_GCM}>:TFM_CRYPTO_TEST_ALG_GCM>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_SHA_512}>:TFM_CRYPTO_TEST_ALG_SHA_512>
+ $<$<BOOL:${TFM_CRYPTO_TEST_HKDF}>:TFM_CRYPTO_TEST_HKDF>
+)
+
+####################### Secure #################################################
+
+target_sources(tfm_test_suite_crypto_s
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/crypto_tests_common.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/crypto_sec_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_crypto_s
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure
+)
+
+target_link_libraries(tfm_test_suite_crypto_s
+ PRIVATE
+ tfm_secure_api
+ tfm_test_framework
+ tfm_partition_secure_client_2
+ platform_s
+)
+
+target_link_libraries(tfm_s_tests
+ INTERFACE
+ tfm_test_suite_crypto_s
+)
+
+target_compile_definitions(tfm_test_suite_crypto_s
+ PRIVATE
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CBC}>:TFM_CRYPTO_TEST_ALG_CBC>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CCM}>:TFM_CRYPTO_TEST_ALG_CCM>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CFB}>:TFM_CRYPTO_TEST_ALG_CFB>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_CTR}>:TFM_CRYPTO_TEST_ALG_CTR>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_GCM}>:TFM_CRYPTO_TEST_ALG_GCM>
+ $<$<BOOL:${TFM_CRYPTO_TEST_ALG_SHA_512}>:TFM_CRYPTO_TEST_ALG_SHA_512>
+ $<$<BOOL:${TFM_CRYPTO_TEST_HKDF}>:TFM_CRYPTO_TEST_HKDF>
+)
+
diff --git a/test/suites/crypto/crypto_tests_common.h b/test/suites/crypto/crypto_tests_common.h
index 67e6a33..dea3cf2 100644
--- a/test/suites/crypto/crypto_tests_common.h
+++ b/test/suites/crypto/crypto_tests_common.h
@@ -13,7 +13,7 @@
#endif
#include "psa/crypto.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
/**
* \brief Size of the key to use in tests in bits
diff --git a/test/suites/crypto/non_secure/crypto_ns_interface_testsuite.c b/test/suites/crypto/non_secure/crypto_ns_interface_testsuite.c
index 22a0c9d..30cacad 100644
--- a/test/suites/crypto/non_secure/crypto_ns_interface_testsuite.c
+++ b/test/suites/crypto/non_secure/crypto_ns_interface_testsuite.c
@@ -5,7 +5,7 @@
*
*/
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#include "tfm_api.h"
#include "../crypto_tests_common.h"
diff --git a/test/suites/crypto/non_secure/crypto_ns_tests.h b/test/suites/crypto/non_secure/crypto_ns_tests.h
index aba8c87..c20cf52 100644
--- a/test/suites/crypto/non_secure/crypto_ns_tests.h
+++ b/test/suites/crypto/non_secure/crypto_ns_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
/**
* \brief Register testsuite for Crypto non-secure interface.
diff --git a/test/suites/crypto/secure/crypto_s_tests.h b/test/suites/crypto/secure/crypto_s_tests.h
index 6f5f359..12ffc75 100644
--- a/test/suites/crypto/secure/crypto_s_tests.h
+++ b/test/suites/crypto/secure/crypto_s_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
void register_testsuite_s_crypto_interface(struct test_suite_t *p_test_suite);
diff --git a/test/suites/crypto/secure/crypto_sec_interface_testsuite.c b/test/suites/crypto/secure/crypto_sec_interface_testsuite.c
index bd314e0..5efd0e2 100644
--- a/test/suites/crypto/secure/crypto_sec_interface_testsuite.c
+++ b/test/suites/crypto/secure/crypto_sec_interface_testsuite.c
@@ -5,8 +5,8 @@
*
*/
-#include "test/framework/test_framework_helpers.h"
-#include "test/test_services/tfm_secure_client_2/tfm_secure_client_2_api.h"
+#include "test_framework_helpers.h"
+#include "tfm_secure_client_2_api.h"
#include "tfm_api.h"
#include "../crypto_tests_common.h"
diff --git a/test/suites/ipc/CMakeLists.inc b/test/suites/ipc/CMakeLists.inc
deleted file mode 100644
index c7a48be..0000000
--- a/test/suites/ipc/CMakeLists.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2018-2019, 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 IPC_TEST)
- message(FATAL_ERROR "Incomplete build configuration: IPC_TEST is undefined. ")
-elseif(IPC_TEST)
- 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/CMakeLists.txt b/test/suites/ipc/CMakeLists.txt
new file mode 100644
index 0000000..8d3ac83
--- /dev/null
+++ b/test/suites/ipc/CMakeLists.txt
@@ -0,0 +1,63 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+if(NOT TFM_PSA_API)
+ return()
+endif()
+
+cmake_policy(SET CMP0079 NEW)
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_ipc_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_ipc_ns
+ PRIVATE
+ non_secure/ipc_ns_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_ipc_ns
+ PUBLIC
+ non_secure
+)
+
+target_compile_definitions(tfm_test_suite_ipc_ns
+ PRIVATE
+ DOMAIN_NS=1
+)
+
+target_link_libraries(tfm_test_suite_ipc_ns
+ PRIVATE
+ tfm_test_framework
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_ipc_ns
+)
+
+####################### Secure #################################################
+
+target_sources(tfm_test_suite_ipc_s
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/ipc_s_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_ipc_s
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure
+)
+
+target_link_libraries(tfm_test_suite_ipc_s
+ PRIVATE
+ tfm_test_framework
+)
+
+target_link_libraries(tfm_s_tests
+ INTERFACE
+ tfm_test_suite_ipc_s
+)
diff --git a/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c b/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c
index d051b78..2fba328 100644
--- a/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c
+++ b/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c
@@ -8,7 +8,7 @@
#include <stdio.h>
#include "ipc_ns_tests.h"
#include "psa/client.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#ifdef TFM_PSA_API
#include "psa_manifest/sid.h"
#endif
diff --git a/test/suites/ipc/non_secure/ipc_ns_tests.h b/test/suites/ipc/non_secure/ipc_ns_tests.h
index 12f3bb6..6cb9df9 100644
--- a/test/suites/ipc/non_secure/ipc_ns_tests.h
+++ b/test/suites/ipc/non_secure/ipc_ns_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
/**
* \brief Register testsuite for ipc non-secure interface.
diff --git a/test/suites/ipc/secure/ipc_s_interface_testsuite.c b/test/suites/ipc/secure/ipc_s_interface_testsuite.c
index 213dfff..03b1289 100644
--- a/test/suites/ipc/secure/ipc_s_interface_testsuite.c
+++ b/test/suites/ipc/secure/ipc_s_interface_testsuite.c
@@ -7,7 +7,7 @@
#include "ipc_s_tests.h"
#include "psa/client.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
/* List of tests */
static void tfm_ipc_test_1001(struct test_result_t *ret);
diff --git a/test/suites/ipc/secure/ipc_s_tests.h b/test/suites/ipc/secure/ipc_s_tests.h
index 3b6a755..8a15bc4 100644
--- a/test/suites/ipc/secure/ipc_s_tests.h
+++ b/test/suites/ipc/secure/ipc_s_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
+ * Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
/**
* \brief Register testsuite for ipc secure interface.
diff --git a/test/suites/its/CMakeLists.inc b/test/suites/its/CMakeLists.inc
deleted file mode 100644
index b79140c..0000000
--- a/test/suites/its/CMakeLists.inc
+++ /dev/null
@@ -1,40 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "internal trusted storage 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(ITS_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 ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS is undefined. ")
-elseif (ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS)
- list(APPEND ALL_SRC_C_NS "${ITS_TEST_DIR}/non_secure/psa_its_ns_interface_testsuite.c"
- "${ITS_TEST_DIR}/its_tests_common.c")
-
- list(APPEND ALL_SRC_C_S "${ITS_TEST_DIR}/secure/psa_its_s_interface_testsuite.c"
- "${ITS_TEST_DIR}/secure/psa_its_s_reliability_testsuite.c"
- "${ITS_TEST_DIR}/its_tests_common.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/its/CMakeLists.txt b/test/suites/its/CMakeLists.txt
new file mode 100644
index 0000000..9ef8031
--- /dev/null
+++ b/test/suites/its/CMakeLists.txt
@@ -0,0 +1,72 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+if (NOT TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
+ return()
+endif()
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_its_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_its_ns
+ PRIVATE
+ its_tests_common.c
+ non_secure/psa_its_ns_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_its_ns
+ PUBLIC
+ non_secure
+)
+
+target_compile_definitions(tfm_test_suite_its_ns
+ PRIVATE
+ DOMAIN_NS=1
+)
+
+target_link_libraries(tfm_test_suite_its_ns
+ PRIVATE
+ tfm_test_framework
+ CMSIS_5_tfm_ns
+ platform_region_defs
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_its_ns
+)
+
+####################### Secure #################################################
+
+target_sources(tfm_test_suite_its_s
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/its_tests_common.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/psa_its_s_interface_testsuite.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/psa_its_s_reliability_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_its_s
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure
+)
+
+target_link_libraries(tfm_test_suite_its_s
+ PRIVATE
+ tfm_secure_api
+ tfm_test_framework
+ platform_region_defs
+ tfm_partition_secure_client_2
+ platform_s
+)
+
+target_link_libraries(tfm_s_tests
+ INTERFACE
+ tfm_test_suite_its_s
+)
diff --git a/test/suites/its/its_tests_common.h b/test/suites/its/its_tests_common.h
index f1b0845..b6b1a24 100644
--- a/test/suites/its/its_tests_common.h
+++ b/test/suites/its/its_tests_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __ITS_TESTS_COMMON_H__
#define __ITS_TESTS_COMMON_H__
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/its/non_secure/its_ns_tests.h b/test/suites/its/non_secure/its_ns_tests.h
index 534dd17..0423ef0 100644
--- a/test/suites/its/non_secure/its_ns_tests.h
+++ b/test/suites/its/non_secure/its_ns_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __ITS_NS_TESTS_H__
#define __ITS_NS_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/its/non_secure/psa_its_ns_interface_testsuite.c b/test/suites/its/non_secure/psa_its_ns_interface_testsuite.c
index 3891600..486797e 100644
--- a/test/suites/its/non_secure/psa_its_ns_interface_testsuite.c
+++ b/test/suites/its/non_secure/psa_its_ns_interface_testsuite.c
@@ -6,7 +6,7 @@
*/
#include "its_ns_tests.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#include "../its_tests_common.h"
static struct test_t psa_its_ns_tests[] = {
diff --git a/test/suites/its/secure/its_s_tests.h b/test/suites/its/secure/its_s_tests.h
index 42d739f..3e63657 100644
--- a/test/suites/its/secure/its_s_tests.h
+++ b/test/suites/its/secure/its_s_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __ITS_S_TESTS_H__
#define __ITS_S_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/its/secure/psa_its_s_interface_testsuite.c b/test/suites/its/secure/psa_its_s_interface_testsuite.c
index 187ee48..d558008 100644
--- a/test/suites/its/secure/psa_its_s_interface_testsuite.c
+++ b/test/suites/its/secure/psa_its_s_interface_testsuite.c
@@ -7,8 +7,8 @@
#include "its_s_tests.h"
#include "psa/internal_trusted_storage.h"
-#include "test/framework/test_framework_helpers.h"
-#include "test/test_services/tfm_secure_client_2/tfm_secure_client_2_api.h"
+#include "test_framework_helpers.h"
+#include "tfm_secure_client_2_api.h"
#include "../its_tests_common.h"
#include "tfm_memory_utils.h"
diff --git a/test/suites/its/secure/psa_its_s_reliability_testsuite.c b/test/suites/its/secure/psa_its_s_reliability_testsuite.c
index 4528424..378bc8c 100644
--- a/test/suites/its/secure/psa_its_s_reliability_testsuite.c
+++ b/test/suites/its/secure/psa_its_s_reliability_testsuite.c
@@ -7,7 +7,7 @@
#include "its_s_tests.h"
#include "psa/internal_trusted_storage.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#include "tfm_memory_utils.h"
/* Test UIDs */
diff --git a/test/suites/multi_core/CMakeLists.inc b/test/suites/multi_core/CMakeLists.inc
deleted file mode 100644
index 521354a..0000000
--- a/test/suites/multi_core/CMakeLists.inc
+++ /dev/null
@@ -1,31 +0,0 @@
-#-------------------------------------------------------------------------------
-# 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/CMakeLists.txt b/test/suites/multi_core/CMakeLists.txt
new file mode 100644
index 0000000..3751674
--- /dev/null
+++ b/test/suites/multi_core/CMakeLists.txt
@@ -0,0 +1,45 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+if (NOT TFM_MULTI_CORE_TOPOLOGY)
+ return()
+endif()
+
+add_library(tfm_test_suite_multi_core_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_multi_core_ns
+ PRIVATE
+ non_secure/multi_core_ns_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_multi_core_ns
+ PUBLIC
+ non_secure
+)
+
+target_compile_definitions(tfm_test_suite_multi_core_ns
+ PRIVATE
+ DOMAIN_NS=1
+)
+
+target_link_libraries(tfm_test_suite_multi_core_ns
+ PRIVATE
+ tfm_test_framework
+ psa_api_ns
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_multi_core_ns
+)
+
+target_compile_definitions(psa_interface
+ INTERFACE
+ TFM_MULTI_CORE_TEST
+)
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
index 3b83487..5df7975 100644
--- 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
@@ -13,7 +13,7 @@
#include "psa/client.h"
#include "psa/internal_trusted_storage.h"
#include "psa_manifest/sid.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#include "tfm_ns_mailbox.h"
#ifdef TFM_MULTI_CORE_MULTI_CLIENT_CALL
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
index 44dda5d..4b076e0 100644
--- a/test/suites/multi_core/non_secure/multi_core_ns_test.h
+++ b/test/suites/multi_core/non_secure/multi_core_ns_test.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
/**
* \brief Register testsuite for multi-core topology.
diff --git a/test/suites/platform/CMakeLists.inc b/test/suites/platform/CMakeLists.inc
deleted file mode 100644
index 82d19ba..0000000
--- a/test/suites/platform/CMakeLists.inc
+++ /dev/null
@@ -1,52 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2019, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "secure platform service 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(PLATFORM_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 ENABLE_PLATFORM_SERVICE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_PLATFORM_SERVICE_TESTS is undefined. ")
-elseif(ENABLE_PLATFORM_SERVICE_TESTS)
- list(APPEND PLATFORM_TEST_SRC_S
- "${PLATFORM_TEST_DIR}/secure/platform_s_interface_testsuite.c"
- )
-
- list(APPEND PLATFORM_TEST_SRC_NS
- "${PLATFORM_TEST_DIR}/non_secure/platform_ns_interface_testsuite.c"
- )
-
- list(APPEND PLATFORM_TEST_SRC
- "${PLATFORM_TEST_DIR}/platform_tests_common.c"
- )
-
- #Setting include directories
- embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
- embedded_include_directories(PATH ${PLATFORM_TEST_DIR} ABSOLUTE)
-
- #Append all our source files to global lists.
- list(APPEND ALL_SRC_C_S ${PLATFORM_TEST_SRC_S} ${PLATFORM_TEST_SRC})
- list(APPEND ALL_SRC_C_NS ${PLATFORM_TEST_SRC_NS} ${PLATFORM_TEST_SRC})
- unset(PLATFORM_TEST_SRC_S)
- unset(PLATFORM_TEST_SRC_NS)
-endif()
diff --git a/test/suites/platform/CMakeLists.txt b/test/suites/platform/CMakeLists.txt
new file mode 100644
index 0000000..0fa3632
--- /dev/null
+++ b/test/suites/platform/CMakeLists.txt
@@ -0,0 +1,66 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+if (NOT TFM_PARTITION_PLATFORM)
+ return()
+endif()
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_platform_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_platform_ns
+ PRIVATE
+ ./platform_tests_common.c
+ ./non_secure/platform_ns_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_platform_ns
+ PUBLIC
+ ./non_secure
+ PRIVATE
+ .
+)
+
+target_link_libraries(tfm_test_suite_platform_ns
+ PRIVATE
+ tfm_test_framework
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_platform_ns
+)
+
+####################### Secure #################################################
+
+target_sources(tfm_test_suite_platform_s
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/platform_tests_common.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/platform_s_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_platform_s
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}
+)
+
+target_link_libraries(tfm_test_suite_platform_s
+ PRIVATE
+ tfm_test_framework
+ tfm_secure_api
+ platform_s
+)
+
+target_link_libraries(tfm_s_tests
+ INTERFACE
+ tfm_test_suite_platform_s
+)
diff --git a/test/suites/platform/non_secure/platform_ns_tests.h b/test/suites/platform/non_secure/platform_ns_tests.h
index ac54aca..f7abfef 100644
--- a/test/suites/platform/non_secure/platform_ns_tests.h
+++ b/test/suites/platform/non_secure/platform_ns_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __PLATFORM_NS_TESTS_H__
#define __PLATFORM_NS_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/platform/platform_tests_common.h b/test/suites/platform/platform_tests_common.h
index 348788c..6ff529e 100644
--- a/test/suites/platform/platform_tests_common.h
+++ b/test/suites/platform/platform_tests_common.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
extern "C" {
#endif
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#define INVALID_REQUEST 0xffffffff
diff --git a/test/suites/platform/secure/platform_s_tests.h b/test/suites/platform/secure/platform_s_tests.h
index 2ca23dc..64671bf 100644
--- a/test/suites/platform/secure/platform_s_tests.h
+++ b/test/suites/platform/secure/platform_s_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __PLATFORM_S_TESTS_H__
#define __PLATFORM_S_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/ps/CMakeLists.inc b/test/suites/ps/CMakeLists.inc
deleted file mode 100644
index 41a29c9..0000000
--- a/test/suites/ps/CMakeLists.inc
+++ /dev/null
@@ -1,52 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "protected storage 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(PROTECTED_STORAGE_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 ENABLE_PROTECTED_STORAGE_SERVICE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_PROTECTED_STORAGE_SERVICE_TESTS is undefined. ")
-elseif (ENABLE_PROTECTED_STORAGE_SERVICE_TESTS)
- list(APPEND ALL_SRC_C_NS "${PROTECTED_STORAGE_TEST_DIR}/non_secure/ns_test_helpers.c"
- "${PROTECTED_STORAGE_TEST_DIR}/non_secure/psa_ps_ns_interface_testsuite.c")
-
- list(APPEND ALL_SRC_C_S "${PROTECTED_STORAGE_TEST_DIR}/secure/psa_ps_s_interface_testsuite.c"
- "${PROTECTED_STORAGE_TEST_DIR}/secure/psa_ps_s_reliability_testsuite.c")
-
- if (PS_ENCRYPTION AND PS_ROLLBACK_PROTECTION AND PS_TEST_NV_COUNTERS)
- list(APPEND ALL_SRC_C_S "${PROTECTED_STORAGE_TEST_DIR}/secure/ps_rollback_protection_testsuite.c"
- "${PROTECTED_STORAGE_TEST_DIR}/secure/nv_counters/test_ps_nv_counters.c")
- set_property(SOURCE ${ALL_SRC_C_S} APPEND PROPERTY COMPILE_DEFINITIONS PS_TEST_NV_COUNTERS)
- endif()
-
- if (NOT DEFINED TFM_NS_CLIENT_IDENTIFICATION)
- message(FATAL_ERROR "Incomplete build configuration: TFM_NS_CLIENT_IDENTIFICATION is undefined.")
- elseif (TFM_NS_CLIENT_IDENTIFICATION)
- set_property(SOURCE ${ALL_SRC_C_NS} APPEND PROPERTY COMPILE_DEFINITIONS TFM_NS_CLIENT_IDENTIFICATION)
- endif()
-
- #Setting include directories
- embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/test/interface/include ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-endif()
diff --git a/test/suites/ps/CMakeLists.txt b/test/suites/ps/CMakeLists.txt
new file mode 100644
index 0000000..3ec97cd
--- /dev/null
+++ b/test/suites/ps/CMakeLists.txt
@@ -0,0 +1,77 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+if (NOT TFM_PARTITION_PROTECTED_STORAGE)
+ return()
+endif()
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_ps_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_ps_ns
+ PRIVATE
+ non_secure/ns_test_helpers.c
+ non_secure/psa_ps_ns_interface_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_ps_ns
+ PUBLIC
+ non_secure
+)
+
+target_compile_definitions(tfm_test_suite_ps_ns
+ PRIVATE
+ DOMAIN_NS=1
+)
+
+target_link_libraries(tfm_test_suite_ps_ns
+ PRIVATE
+ tfm_test_framework
+ platform_region_defs
+ tfm_test_suite_its_ns
+ psa_api_ns
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_ps_ns
+)
+
+####################### Secure #################################################
+
+target_sources(tfm_test_suite_ps_s
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/nv_counters/test_ps_nv_counters.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/psa_ps_s_interface_testsuite.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/psa_ps_s_reliability_testsuite.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/ps_rollback_protection_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_ps_s
+ PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/secure/nv_counters
+)
+
+target_link_libraries(tfm_test_suite_ps_s
+ PRIVATE
+ tfm_test_framework
+ platform_region_defs
+ tfm_partition_ps
+ tfm_partition_ps_test
+ tfm_spm
+ platform_s
+)
+
+target_link_libraries(tfm_s_tests
+ INTERFACE
+ tfm_test_suite_ps_s
+)
diff --git a/test/suites/ps/non_secure/ns_test_helpers.h b/test/suites/ps/non_secure/ns_test_helpers.h
index 22226f4..61d013d 100644
--- a/test/suites/ps/non_secure/ns_test_helpers.h
+++ b/test/suites/ps/non_secure/ns_test_helpers.h
@@ -8,7 +8,7 @@
#ifndef __NS_TEST_HELPERS_H__
#define __NS_TEST_HELPERS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/ps/non_secure/ps_ns_tests.h b/test/suites/ps/non_secure/ps_ns_tests.h
index 7153827..5127810 100644
--- a/test/suites/ps/non_secure/ps_ns_tests.h
+++ b/test/suites/ps/non_secure/ps_ns_tests.h
@@ -8,7 +8,7 @@
#ifndef __PS_NS_TESTS_H__
#define __PS_NS_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/ps/non_secure/psa_ps_ns_interface_testsuite.c b/test/suites/ps/non_secure/psa_ps_ns_interface_testsuite.c
index 638ab8e..ac437ac 100644
--- a/test/suites/ps/non_secure/psa_ps_ns_interface_testsuite.c
+++ b/test/suites/ps/non_secure/psa_ps_ns_interface_testsuite.c
@@ -12,7 +12,7 @@
#include "ns_test_helpers.h"
#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#include "flash_layout.h"
/* Test UIDs */
diff --git a/test/suites/ps/secure/nv_counters/test_ps_nv_counters.c b/test/suites/ps/secure/nv_counters/test_ps_nv_counters.c
index a2a86b3..6ff4469 100644
--- a/test/suites/ps/secure/nv_counters/test_ps_nv_counters.c
+++ b/test/suites/ps/secure/nv_counters/test_ps_nv_counters.c
@@ -8,8 +8,8 @@
#include "test_ps_nv_counters.h"
#include <limits.h>
-#include "secure_fw/partitions/protected_storage/nv_counters/ps_nv_counters.h"
-#include "secure_fw/partitions/protected_storage/ps_utils.h"
+#include "nv_counters/ps_nv_counters.h"
+#include "ps_utils.h"
#define DISABLE_INCREMENT 0
#define ENABLE_INCREMENT 1
diff --git a/test/suites/ps/secure/nv_counters/test_ps_nv_counters.h b/test/suites/ps/secure/nv_counters/test_ps_nv_counters.h
index 2f3b332..0c46db2 100644
--- a/test/suites/ps/secure/nv_counters/test_ps_nv_counters.h
+++ b/test/suites/ps/secure/nv_counters/test_ps_nv_counters.h
@@ -10,7 +10,7 @@
#include <stdint.h>
#include "psa/protected_storage.h"
-#include "platform/include/tfm_plat_nv_counters.h"
+#include "tfm_plat_nv_counters.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/ps/secure/ps_rollback_protection_testsuite.c b/test/suites/ps/secure/ps_rollback_protection_testsuite.c
index d8c1bd9..605c8fc 100644
--- a/test/suites/ps/secure/ps_rollback_protection_testsuite.c
+++ b/test/suites/ps/secure/ps_rollback_protection_testsuite.c
@@ -9,8 +9,8 @@
#include <stdio.h>
-#include "secure_fw/partitions/protected_storage/nv_counters/ps_nv_counters.h"
-#include "nv_counters/test_ps_nv_counters.h"
+#include "nv_counters/ps_nv_counters.h"
+#include "test_ps_nv_counters.h"
#include "psa/protected_storage.h"
#include "tfm_memory_utils.h"
#include "s_test_helpers.h"
@@ -19,9 +19,9 @@
* tfm_ps_test_system_prepare API, to simulate a reboot in the system.
* ps_system_prepare is called when the PS service is initialized.
*/
-#include "test/test_services/tfm_ps_test_service/tfm_ps_test_service_api.h"
+#include "tfm_ps_test_service_api.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
/* Test UIDs */
#define TEST_UID 2UL /* UID 1 cannot be used as it references a write once
diff --git a/test/suites/ps/secure/ps_tests.h b/test/suites/ps/secure/ps_tests.h
index f2b9959..6e5da58 100644
--- a/test/suites/ps/secure/ps_tests.h
+++ b/test/suites/ps/secure/ps_tests.h
@@ -8,7 +8,7 @@
#ifndef __PS_TESTS_H__
#define __PS_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
@@ -28,7 +28,6 @@
*/
void register_testsuite_s_psa_ps_reliability(struct test_suite_t *p_test_suite);
-#ifdef PS_TEST_NV_COUNTERS
/**
* \brief Register testsuite for the ps rollback protection tests.
*
@@ -36,7 +35,6 @@
*/
void register_testsuite_s_rollback_protection(
struct test_suite_t *p_test_suite);
-#endif
#ifdef __cplusplus
}
diff --git a/test/suites/ps/secure/psa_ps_s_interface_testsuite.c b/test/suites/ps/secure/psa_ps_s_interface_testsuite.c
index 7b44d52..bd9a69b 100644
--- a/test/suites/ps/secure/psa_ps_s_interface_testsuite.c
+++ b/test/suites/ps/secure/psa_ps_s_interface_testsuite.c
@@ -12,7 +12,7 @@
#include "s_test_helpers.h"
#include "tfm_memory_utils.h"
#include "psa/protected_storage.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
#include "flash_layout.h"
/* Test UIDs */
diff --git a/test/suites/ps/secure/psa_ps_s_reliability_testsuite.c b/test/suites/ps/secure/psa_ps_s_reliability_testsuite.c
index 658f4f5..7d98466 100644
--- a/test/suites/ps/secure/psa_ps_s_reliability_testsuite.c
+++ b/test/suites/ps/secure/psa_ps_s_reliability_testsuite.c
@@ -12,7 +12,7 @@
#include "psa/protected_storage.h"
#include "tfm_memory_utils.h"
#include "s_test_helpers.h"
-#include "test/framework/test_framework_helpers.h"
+#include "test_framework_helpers.h"
/* Test UIDs */
#define TEST_UID 2UL /* UID 1 cannot be used as it references a write once
diff --git a/test/suites/qcbor/CMakeLists.inc b/test/suites/qcbor/CMakeLists.inc
deleted file mode 100644
index d8fa1f7..0000000
--- a/test/suites/qcbor/CMakeLists.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2019-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the QCBOR 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(QCBOR_TEST_SUIT_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-#Verify input parameters
-if(NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-if (NOT DEFINED ENABLE_QCBOR_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_QCBOR_TESTS is undefined.")
-elseif(ENABLE_QCBOR_TESTS)
- list(APPEND ALL_SRC_C_NS
- "${QCBOR_TEST_SUIT_DIR}/non_secure/qcbor_ns_testsuite.c"
- $<TARGET_OBJECTS:tfm_qcbor_test> #See in lib/ext/qcbor/CMakeList.txt
- )
-endif()
diff --git a/test/suites/qcbor/CMakeLists.txt b/test/suites/qcbor/CMakeLists.txt
new file mode 100644
index 0000000..0515dab
--- /dev/null
+++ b/test/suites/qcbor/CMakeLists.txt
@@ -0,0 +1,38 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_qcbor_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_qcbor_ns
+ PRIVATE
+ non_secure/qcbor_ns_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_qcbor_ns
+ PUBLIC
+ non_secure
+)
+
+target_compile_definitions(tfm_test_suite_qcbor_ns
+ PRIVATE
+ DOMAIN_NS=1
+)
+
+target_link_libraries(tfm_test_suite_qcbor_ns
+ PRIVATE
+ tfm_test_framework
+ tfm_qcbor_test
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_qcbor_ns
+)
diff --git a/test/suites/qcbor/non_secure/qcbor_ns_tests.h b/test/suites/qcbor/non_secure/qcbor_ns_tests.h
index 03d2e46..ef0c9f8 100644
--- a/test/suites/qcbor/non_secure/qcbor_ns_tests.h
+++ b/test/suites/qcbor/non_secure/qcbor_ns_tests.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Arm Limited. All rights reserved.
+ * Copyright (c) 2019-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __QCBOR_NS_TESTS_H__
#define __QCBOR_NS_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/qcbor/non_secure/qcbor_ns_testsuite.c b/test/suites/qcbor/non_secure/qcbor_ns_testsuite.c
index f44994b..0a30f3d 100644
--- a/test/suites/qcbor/non_secure/qcbor_ns_testsuite.c
+++ b/test/suites/qcbor/non_secure/qcbor_ns_testsuite.c
@@ -7,7 +7,7 @@
#include "qcbor_ns_tests.h"
#include <stdio.h>
-#include "lib/ext/qcbor/test/run_tests.h"
+#include "run_tests.h"
/*
* The QCBOR test cases are defined in: lib/ext/qcbor/test/run_test.c
diff --git a/test/suites/t_cose/CMakeLists.inc b/test/suites/t_cose/CMakeLists.inc
deleted file mode 100644
index c030683..0000000
--- a/test/suites/t_cose/CMakeLists.inc
+++ /dev/null
@@ -1,36 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the T_COSE 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(T_COSE_TEST_SUIT_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-#Verify input parameters
-if(NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-if (NOT DEFINED ENABLE_T_COSE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_T_COSE_TESTS is undefined.")
-elseif(ENABLE_T_COSE_TESTS)
- list(APPEND ALL_SRC_C_NS
- "${T_COSE_TEST_SUIT_DIR}/non_secure/t_cose_ns_testsuite.c"
- $<TARGET_OBJECTS:tfm_t_cose_test> #See in lib/ext/t_cose/CMakeList.txt
- )
-endif()
diff --git a/test/suites/t_cose/CMakeLists.txt b/test/suites/t_cose/CMakeLists.txt
new file mode 100644
index 0000000..66d7e62
--- /dev/null
+++ b/test/suites/t_cose/CMakeLists.txt
@@ -0,0 +1,42 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+if(SYMMETRIC_INITIAL_ATTESTATION)
+ return()
+endif()
+
+####################### Non Secure #############################################
+
+add_library(tfm_test_suite_t_cose_ns STATIC EXCLUDE_FROM_ALL)
+
+target_sources(tfm_test_suite_t_cose_ns
+ PRIVATE
+ non_secure/t_cose_ns_testsuite.c
+)
+
+target_include_directories(tfm_test_suite_t_cose_ns
+ PUBLIC
+ non_secure
+)
+
+target_compile_definitions(tfm_test_suite_t_cose_ns
+ PRIVATE
+ DOMAIN_NS=1
+)
+
+target_link_libraries(tfm_test_suite_t_cose_ns
+ PRIVATE
+ tfm_test_framework
+ tfm_t_cose_test
+)
+
+target_link_libraries(tfm_ns_tests
+ INTERFACE
+ tfm_test_suite_t_cose_ns
+)
diff --git a/test/suites/t_cose/non_secure/t_cose_ns_tests.h b/test/suites/t_cose/non_secure/t_cose_ns_tests.h
index 8313797..a5a755f 100644
--- a/test/suites/t_cose/non_secure/t_cose_ns_tests.h
+++ b/test/suites/t_cose/non_secure/t_cose_ns_tests.h
@@ -8,7 +8,7 @@
#ifndef __T_COSE_NS_TESTS_H__
#define __T_COSE_NS_TESTS_H__
-#include "test/framework/test_framework.h"
+#include "test_framework.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/suites/t_cose/non_secure/t_cose_ns_testsuite.c b/test/suites/t_cose/non_secure/t_cose_ns_testsuite.c
index 3428a08..7f44cbc 100644
--- a/test/suites/t_cose/non_secure/t_cose_ns_testsuite.c
+++ b/test/suites/t_cose/non_secure/t_cose_ns_testsuite.c
@@ -7,7 +7,7 @@
#include "t_cose_ns_tests.h"
#include <stdio.h>
-#include "lib/ext/t_cose/test/run_tests.h"
+#include "run_tests.h"
/*
* The t_cose test cases are defined in: lib/ext/t_cose/test/run_test.c
diff --git a/test/test_services/CMakeLists.inc b/test/test_services/CMakeLists.inc
deleted file mode 100644
index afece9f..0000000
--- a/test/test_services/CMakeLists.inc
+++ /dev/null
@@ -1,110 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2017-2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-#Definitions to compile the "secure services" 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 repository.
-#
-#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(CORE_TEST_DIR ${CMAKE_CURRENT_LIST_DIR})
-
-#Check input variables
-if (NOT DEFINED TFM_ROOT_DIR)
- message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
-endif()
-
-if (NOT DEFINED ENABLE_CORE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS is undefined. ")
-elseif(ENABLE_CORE_TESTS)
- list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test/tfm_ss_core_test.c"
- "${CORE_TEST_DIR}/tfm_core_test/auto_generated/intermedia_tfm_ss_core_test.c")
-endif()
-
-if (NOT DEFINED ENABLE_CORE_TESTS_2)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_CORE_TESTS_2 is undefined. ")
-elseif(ENABLE_CORE_TESTS_2)
- list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_core_test_2/tfm_ss_core_test_2.c"
- "${CORE_TEST_DIR}/tfm_core_test_2/auto_generated/intermedia_tfm_ss_core_test_2.c")
-endif()
-
-if (NOT DEFINED ENABLE_IRQ_TEST_SERVICES)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_IRQ_TEST_SERVICES is undefined. ")
-elseif(ENABLE_IRQ_TEST_SERVICES)
- list(APPEND ALL_SRC_C_S
- "${CORE_TEST_DIR}/tfm_irq_test_service_1/tfm_irq_test_service_1.c"
- "${CORE_TEST_DIR}/tfm_irq_test_service_1/auto_generated/intermedia_tfm_irq_test_service_1.c")
-endif()
-
-if (NOT DEFINED TFM_PARTITION_TEST_SECURE_SERVICES)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_SECURE_SERVICES is undefined. ")
-elseif (TFM_PARTITION_TEST_SECURE_SERVICES)
- list(APPEND ALL_SRC_C_S
- "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service.c"
- "${CORE_TEST_DIR}/tfm_secure_client_service/auto_generated/intermedia_tfm_secure_client_service.c"
- "${CORE_TEST_DIR}/tfm_secure_client_2/tfm_secure_client_2.c"
- "${CORE_TEST_DIR}/tfm_secure_client_2/tfm_secure_client_2_api.c"
- "${CORE_TEST_DIR}/tfm_secure_client_2/auto_generated/intermedia_tfm_secure_client_2.c")
-
- list(APPEND ALL_SRC_C_NS "${CORE_TEST_DIR}/tfm_secure_client_service/tfm_secure_client_service_api.c")
-endif()
-
-if (NOT DEFINED TFM_PARTITION_TEST_CORE_IPC)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_CORE_IPC is undefined. ")
-elseif (TFM_PARTITION_TEST_CORE_IPC)
- list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_ipc_service/tfm_ipc_service_test.c"
- "${CORE_TEST_DIR}/tfm_ipc_service/auto_generated/intermedia_tfm_ipc_service_test.c"
- "${CORE_TEST_DIR}/tfm_ipc_client/tfm_ipc_client_test.c"
- "${CORE_TEST_DIR}/tfm_ipc_client/auto_generated/intermedia_tfm_ipc_client_test.c"
- )
-endif()
-
-if (NOT DEFINED TFM_PARTITION_TEST_PS)
- message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_TEST_PS is undefined.")
-elseif (TFM_PARTITION_TEST_PS)
- list(APPEND ALL_SRC_C_S "${CORE_TEST_DIR}/tfm_ps_test_service/tfm_ps_test_service.c"
- "${CORE_TEST_DIR}/tfm_ps_test_service/tfm_ps_test_service_api.c"
- "${CORE_TEST_DIR}/tfm_ps_test_service/auto_generated/intermedia_tfm_ps_test_service.c")
-endif()
-
-embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/platform/include ABSOLUTE)
-embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/include ABSOLUTE)
-
-set(BUILD_CMSIS_CORE Off)
-set(BUILD_RETARGET Off)
-set(BUILD_NATIVE_DRIVERS Off)
-set(BUILD_STARTUP Off)
-set(BUILD_TARGET_CFG Off)
-set(BUILD_TARGET_HARDWARE_KEYS Off)
-set(BUILD_TARGET_NV_COUNTERS Off)
-set(BUILD_CMSIS_DRIVERS Off)
-set(BUILD_UART_STDOUT Off)
-set(BUILD_FLASH Off)
-if (CORE_TEST_POSITIVE OR CORE_TEST_INTERACTIVE)
- set(BUILD_PLAT_TEST On)
- set(BUILD_TIME On)
-else()
- set(BUILD_PLAT_TEST Off)
- set(BUILD_TIME Off)
-endif()
-if(NOT DEFINED PLATFORM_CMAKE_FILE)
- message (FATAL_ERROR "Platform specific CMake is not defined. Please set PLATFORM_CMAKE_FILE.")
-elseif(NOT EXISTS ${PLATFORM_CMAKE_FILE})
- message (FATAL_ERROR "Platform specific CMake \"${PLATFORM_CMAKE_FILE}\" file does not exist. Please fix value of PLATFORM_CMAKE_FILE.")
-else()
- include(${PLATFORM_CMAKE_FILE})
-endif()
diff --git a/test/test_services/CMakeLists.txt b/test/test_services/CMakeLists.txt
new file mode 100644
index 0000000..91e36c6
--- /dev/null
+++ b/test/test_services/CMakeLists.txt
@@ -0,0 +1,50 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+# Since the main test directory is a NS dir, this subdir is specifically made a
+# secure directory as it build the secure side test services
+if (TFM_MULTI_CORE_TOPOLOGY)
+ include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload.cmake)
+endif()
+
+# Secure tests are declared in this dir so that it can use the secure CPU
+# definitions
+add_library(tfm_s_tests INTERFACE)
+if (TFM_PARTITION_CRYPTO)
+ add_library(tfm_test_suite_crypto_s STATIC EXCLUDE_FROM_ALL)
+endif()
+if (TFM_PARTITION_INITIAL_ATTESTATION)
+ add_library(tfm_test_suite_attestation_s STATIC EXCLUDE_FROM_ALL)
+endif()
+if(TFM_PARTITION_INTERNAL_TRUSTED_STORAGE)
+ add_library(tfm_test_suite_its_s STATIC EXCLUDE_FROM_ALL)
+endif()
+if (TFM_PARTITION_PROTECTED_STORAGE)
+ add_library(tfm_test_suite_ps_s STATIC EXCLUDE_FROM_ALL)
+endif()
+if(NOT TFM_PSA_API AND TFM_PARTITION_AUDIT_LOG)
+ add_library(tfm_test_suite_audit_s STATIC EXCLUDE_FROM_ALL)
+endif()
+if(TFM_PARTITION_PLATFORM)
+ add_library(tfm_test_suite_platform_s STATIC EXCLUDE_FROM_ALL)
+endif()
+if(TFM_PSA_API)
+ add_library(tfm_test_suite_ipc_s STATIC EXCLUDE_FROM_ALL)
+endif()
+
+add_subdirectory(tfm_core_test)
+add_subdirectory(tfm_core_test_2)
+add_subdirectory(tfm_ps_test_service)
+add_subdirectory(tfm_secure_client_service)
+add_subdirectory(tfm_secure_client_2)
+if(TFM_PSA_API)
+ add_subdirectory(tfm_ipc_service)
+ add_subdirectory(tfm_ipc_client)
+endif()
+if(TFM_MULTI_CORE_TOPOLOGY)
+ add_subdirectory(tfm_multi_core_test)
+endif()
diff --git a/test/test_services/tfm_core_test/CMakeLists.txt b/test/test_services/tfm_core_test/CMakeLists.txt
new file mode 100644
index 0000000..c566c6f
--- /dev/null
+++ b/test/test_services/tfm_core_test/CMakeLists.txt
@@ -0,0 +1,50 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_policy(SET CMP0079 NEW)
+
+add_library(tfm_partition_core_test STATIC)
+
+target_sources(tfm_partition_core_test
+ PRIVATE
+ tfm_ss_core_test.c
+)
+
+target_include_directories(tfm_partition_core_test
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_core_test
+ PRIVATE
+ tfm_secure_api
+ psa_interface
+ platform_s
+ tfm_arch
+ tfm_test_framework
+)
+
+target_link_libraries(tfm_spm
+ PRIVATE
+ tfm_partition_core_test
+)
+
+target_include_directories(tfm_test_framework
+ INTERFACE
+ .
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_core_test
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_TEST_CORE
+)
diff --git a/test/test_services/tfm_core_test/tfm_ss_core_test.c b/test/test_services/tfm_core_test/tfm_ss_core_test.c
index 7390fc3..10e5049 100644
--- a/test/test_services/tfm_core_test/tfm_ss_core_test.c
+++ b/test/test_services/tfm_core_test/tfm_ss_core_test.c
@@ -8,11 +8,11 @@
#include <stddef.h>
#include "tfm_ss_core_test.h"
#include "tfm_api.h"
-#include "test/test_services/tfm_core_test/core_test_defs.h"
-#include "test/framework/test_framework.h"
+#include "core_test_defs.h"
+#include "test_framework.h"
#include "tfm_veneers.h"
#include "tfm_secure_api.h"
-#include "secure_fw/include/tfm/tfm_spm_services.h"
+#include "tfm/tfm_spm_services.h"
#include "psa/service.h"
#include "tfm_plat_test.h"
#include "psa_manifest/pid.h"
diff --git a/test/test_services/tfm_core_test_2/CMakeLists.txt b/test/test_services/tfm_core_test_2/CMakeLists.txt
new file mode 100644
index 0000000..81bd1e7
--- /dev/null
+++ b/test/test_services/tfm_core_test_2/CMakeLists.txt
@@ -0,0 +1,45 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_policy(SET CMP0079 NEW)
+
+add_library(tfm_partition_core_test_2 STATIC)
+
+target_sources(tfm_partition_core_test_2
+ PRIVATE
+ tfm_ss_core_test_2.c
+)
+
+target_include_directories(tfm_partition_core_test_2
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_core_test_2
+ PRIVATE
+ tfm_secure_api
+ psa_interface
+ platform_s
+ tfm_partition_core_test
+ tfm_arch
+)
+
+target_link_libraries(tfm_spm
+ PRIVATE
+ tfm_partition_core_test_2
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_core_test_2
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_TEST_CORE
+)
diff --git a/test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c b/test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c
index e9d8c95..1cb58ef 100644
--- a/test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c
+++ b/test/test_services/tfm_core_test_2/tfm_ss_core_test_2.c
@@ -6,7 +6,7 @@
*/
#include <stddef.h>
-#include "test/test_services/tfm_core_test/core_test_defs.h"
+#include "core_test_defs.h"
#include "tfm_ss_core_test_2.h"
#include "tfm_api.h"
#include "tfm_secure_api.h"
diff --git a/test/test_services/tfm_ipc_client/CMakeLists.txt b/test/test_services/tfm_ipc_client/CMakeLists.txt
new file mode 100644
index 0000000..4069ea6
--- /dev/null
+++ b/test/test_services/tfm_ipc_client/CMakeLists.txt
@@ -0,0 +1,44 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+add_library(tfm_partition_ipc_client STATIC)
+
+target_sources(tfm_partition_ipc_client
+ PRIVATE
+ ./tfm_ipc_client_test.c
+)
+
+target_include_directories(tfm_partition_ipc_client
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_ipc_client
+ PRIVATE
+ tfm_secure_api
+ psa_interface
+ platform_s
+)
+
+target_link_libraries(tfm_spm
+ PRIVATE
+ tfm_partition_ipc_client
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_ipc_client
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_TEST_CORE_IPC
+)
diff --git a/test/test_services/tfm_ipc_service/CMakeLists.txt b/test/test_services/tfm_ipc_service/CMakeLists.txt
new file mode 100644
index 0000000..777ed42
--- /dev/null
+++ b/test/test_services/tfm_ipc_service/CMakeLists.txt
@@ -0,0 +1,45 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+add_library(tfm_partition_ipc_service STATIC)
+
+target_sources(tfm_partition_ipc_service
+ PRIVATE
+ ./tfm_ipc_service_test.c
+)
+
+target_include_directories(tfm_partition_ipc_service
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_ipc_service
+ PRIVATE
+ tfm_secure_api
+ platform_s
+ tfm_test_framework
+ tfm_arch
+)
+
+target_link_libraries(tfm_spm
+ PRIVATE
+ tfm_partition_ipc_service
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_ipc_service
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_TEST_CORE_IPC
+)
diff --git a/test/test_services/tfm_multi_core_test/CMakeLists.txt b/test/test_services/tfm_multi_core_test/CMakeLists.txt
new file mode 100644
index 0000000..8ae4955
--- /dev/null
+++ b/test/test_services/tfm_multi_core_test/CMakeLists.txt
@@ -0,0 +1,47 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_policy(SET CMP0079 NEW)
+
+if (NOT TFM_MULTI_CORE_TOPOLOGY)
+ return()
+endif()
+
+add_library(tfm_partition_multi_core_test STATIC)
+
+target_sources(tfm_partition_multi_core_test
+ PRIVATE
+ tfm_multi_core_test.c
+)
+
+target_include_directories(tfm_partition_multi_core_test
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_multi_core_test
+ PRIVATE
+ psa_interface
+ tfm_secure_api
+ platform_s
+)
+
+target_link_libraries(tfm_spm
+ PRIVATE
+ tfm_partition_multi_core_test
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_multi_core_test
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_TEST_MULTI_CORE
+)
diff --git a/test/test_services/tfm_ps_test_service/CMakeLists.txt b/test/test_services/tfm_ps_test_service/CMakeLists.txt
new file mode 100644
index 0000000..98f050c
--- /dev/null
+++ b/test/test_services/tfm_ps_test_service/CMakeLists.txt
@@ -0,0 +1,62 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_policy(SET CMP0079 NEW)
+
+if (NOT TFM_PARTITION_PROTECTED_STORAGE)
+ return()
+endif()
+
+add_library(tfm_partition_ps_test STATIC)
+
+target_sources(tfm_partition_ps_test
+ PRIVATE
+ ./tfm_ps_test_service.c
+)
+
+target_include_directories(tfm_partition_ps_test
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_ps_test
+ PRIVATE
+ tfm_secure_api
+ psa_interface
+ platform_s
+ tfm_partition_ps
+)
+
+target_link_libraries(tfm_spm
+ PRIVATE
+ tfm_partition_ps_test
+)
+
+############################ Secure API ########################################
+
+target_sources(psa_api_ns
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_ps_test_service_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_ps_test_service_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_ps_test
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_TEST_PS
+)
diff --git a/test/test_services/tfm_ps_test_service/tfm_ps_test_service.c b/test/test_services/tfm_ps_test_service/tfm_ps_test_service.c
index 2e30796..34e8e66 100644
--- a/test/test_services/tfm_ps_test_service/tfm_ps_test_service.c
+++ b/test/test_services/tfm_ps_test_service/tfm_ps_test_service.c
@@ -12,7 +12,7 @@
#include "psa/client.h"
#endif
-#include "secure_fw/partitions/protected_storage/ps_object_system.h"
+#include "ps_object_system.h"
psa_status_t tfm_ps_test_prepare(psa_invec *in_vec, size_t in_len,
psa_outvec *out_vec, size_t out_len)
diff --git a/test/test_services/tfm_secure_client_2/CMakeLists.txt b/test/test_services/tfm_secure_client_2/CMakeLists.txt
new file mode 100644
index 0000000..88edcc2
--- /dev/null
+++ b/test/test_services/tfm_secure_client_2/CMakeLists.txt
@@ -0,0 +1,57 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+cmake_policy(SET CMP0079 NEW)
+
+add_library(tfm_partition_secure_client_2 STATIC)
+
+target_sources(tfm_partition_secure_client_2
+ PRIVATE
+ ./tfm_secure_client_2.c
+)
+
+target_include_directories(tfm_partition_secure_client_2
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_secure_client_2
+ PRIVATE
+ tfm_secure_api
+ psa_interface
+ platform_s
+)
+
+target_link_libraries(tfm_spm
+ PRIVATE
+ tfm_partition_secure_client_2
+)
+
+############################ Secure API ########################################
+
+target_sources(tfm_secure_api
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_secure_client_2_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_secure_client_2_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_secure_client_2
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_TEST_SECURE_SERVICES
+)
diff --git a/test/test_services/tfm_secure_client_2/tfm_secure_client_2.c b/test/test_services/tfm_secure_client_2/tfm_secure_client_2.c
index 153caac..df98abb 100644
--- a/test/test_services/tfm_secure_client_2/tfm_secure_client_2.c
+++ b/test/test_services/tfm_secure_client_2/tfm_secure_client_2.c
@@ -16,7 +16,7 @@
#include "psa/client.h"
#endif
-#ifdef ENABLE_CRYPTO_SERVICE_TESTS
+#ifdef TFM_PARTITION_CRYPTO
/**
* \brief Tests calling psa_destroy_key() with the supplied key handle.
*
@@ -39,9 +39,9 @@
/* Attempt to destroy the key handle */
return psa_destroy_key(key_handle);
}
-#endif /* ENABLE_CRYPTO_SERVICE_TESTS */
+#endif /* TFM_PARTITION_CRYPTO */
-#ifdef ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS
+#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
/**
* \brief Tests calling psa_its_get() with the supplied uid.
*
@@ -66,7 +66,7 @@
/* Attempt to get one byte from the UID and return the resulting status */
return psa_its_get(uid, 0, sizeof(data), data, &p_data_length);
}
-#endif /* ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS */
+#endif /* TFM_PARTITION_INTERNAL_TRUSTED_STORAGE */
/**
* \brief Calls the test function with the supplied ID and returns the result
@@ -82,11 +82,11 @@
size_t arg_len)
{
switch (id) {
-#ifdef ENABLE_INTERNAL_TRUSTED_STORAGE_SERVICE_TESTS
+#ifdef TFM_PARTITION_INTERNAL_TRUSTED_STORAGE
case TFM_SECURE_CLIENT_2_ID_ITS_ACCESS_CTRL:
return secure_client_2_test_its_access_ctrl(arg, arg_len);
#endif
-#ifdef ENABLE_CRYPTO_SERVICE_TESTS
+#ifdef TFM_PARTITION_CRYPTO
case TFM_SECURE_CLIENT_2_ID_CRYPTO_ACCESS_CTRL:
return secure_client_2_test_crypto_access_ctrl(arg, arg_len);
#endif
diff --git a/test/test_services/tfm_secure_client_service/CMakeLists.txt b/test/test_services/tfm_secure_client_service/CMakeLists.txt
new file mode 100644
index 0000000..3e40a84
--- /dev/null
+++ b/test/test_services/tfm_secure_client_service/CMakeLists.txt
@@ -0,0 +1,65 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+cmake_policy(SET CMP0079 NEW)
+
+add_library(tfm_partition_secure_client_service STATIC)
+
+target_sources(tfm_partition_secure_client_service
+ PRIVATE
+ ./tfm_secure_client_service.c
+)
+
+target_include_directories(tfm_partition_secure_client_service
+ PUBLIC
+ .
+)
+
+target_link_libraries(tfm_partition_secure_client_service
+ PRIVATE
+ tfm_secure_api
+ psa_interface
+ platform_s
+ tfm_test_framework
+ tfm_s_tests
+)
+
+target_link_libraries(tfm_spm
+ PRIVATE
+ tfm_partition_secure_client_service
+)
+
+############################ Secure API ########################################
+
+target_sources(psa_api_ns
+ PRIVATE
+ ${CMAKE_CURRENT_SOURCE_DIR}/tfm_secure_client_service_api.c
+)
+
+# The veneers give warnings about not being properly declared so they get hidden
+# to not overshadow _real_ warnings.
+set_source_files_properties(tfm_secure_client_service_api.c
+ PROPERTIES
+ COMPILE_FLAGS -Wno-implicit-function-declaration
+)
+
+target_include_directories(psa_api_ns
+ PUBLIC
+ .
+)
+
+############################ Partition Defs ####################################
+
+target_link_libraries(tfm_partitions
+ INTERFACE
+ tfm_partition_secure_client_service
+)
+
+target_compile_definitions(tfm_partition_defs
+ INTERFACE
+ TFM_PARTITION_TEST_SECURE_SERVICES
+)
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
index 62a8b5d..a5502ce 100644
--- a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
@@ -6,7 +6,7 @@
*/
#include "tfm_secure_client_service.h"
-#include "test/framework/test_framework_integ_test.h"
+#include "test_framework_integ_test.h"
#ifdef TFM_PSA_API
#include "psa/client.h"
#include "psa/service.h"