blob: 9499398809e20d2dc46379799ac76752d8920bdd [file] [log] [blame]
Kevin Peng62a87112020-07-07 15:07:46 +08001#-------------------------------------------------------------------------------
Raef Coles652bb8a2020-09-24 11:27:38 +01002# Copyright (c) 2020, Arm Limited. All rights reserved.
Kevin Peng62a87112020-07-07 15:07:46 +08003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
Raef Coles652bb8a2020-09-24 11:27:38 +01008cmake_minimum_required(VERSION 3.13)
Kevin Peng62a87112020-07-07 15:07:46 +08009
Raef Coles652bb8a2020-09-24 11:27:38 +010010add_library(tfm_ns_tests INTERFACE)
11add_library(tfm_test_framework INTERFACE)
12
13# For multi-core projects, the NS app can be run on a different CPU to the
14# Secure code. To facilitate this, we once again reload the compiler to load the
15# setting for the NS CPU. Cmake settings are directory scoped so this affects
16# anything loaded from or declared in this dir.
17if (TFM_MULTI_CORE_TOPOLOGY)
18 include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
Raef Coles34cffa72020-10-28 10:27:19 +000019 tfm_toolchain_reload_compiler()
Kevin Pengae997e42020-07-08 17:06:37 +080020endif()
Kevin Peng62a87112020-07-07 15:07:46 +080021
Raef Coles652bb8a2020-09-24 11:27:38 +010022add_subdirectory(test_services)
Kevin Peng62a87112020-07-07 15:07:46 +080023
Raef Coles652bb8a2020-09-24 11:27:38 +010024add_subdirectory(suites/attestation)
25add_subdirectory(suites/audit)
26add_subdirectory(suites/core)
27add_subdirectory(suites/crypto)
28add_subdirectory(suites/its)
29add_subdirectory(suites/qcbor)
30add_subdirectory(suites/ps)
31add_subdirectory(suites/t_cose)
32add_subdirectory(suites/platform)
33if(TFM_PSA_API)
34 add_subdirectory(suites/ipc)
35endif()
36if(TFM_MULTI_CORE_TOPOLOGY)
37 add_subdirectory(suites/multi_core)
Kevin Peng62a87112020-07-07 15:07:46 +080038endif()
39
Raef Coles652bb8a2020-09-24 11:27:38 +010040target_sources(tfm_test_framework
41 INTERFACE
42 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework.c
43 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_helpers.c
44 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test_helper.c
45)
Kevin Peng62a87112020-07-07 15:07:46 +080046
Raef Coles652bb8a2020-09-24 11:27:38 +010047target_include_directories(tfm_test_framework
48 INTERFACE
49 framework
50)
Kevin Peng62a87112020-07-07 15:07:46 +080051
Raef Coles652bb8a2020-09-24 11:27:38 +010052target_link_libraries(tfm_test_framework
53 INTERFACE
54 psa_interface
Kevin Pengaf602292020-10-20 17:49:52 +080055 tfm_ns_log
Raef Coles652bb8a2020-09-24 11:27:38 +010056)
Kevin Peng62a87112020-07-07 15:07:46 +080057
Raef Coles652bb8a2020-09-24 11:27:38 +010058target_sources(tfm_ns_tests
59 INTERFACE
60 ${CMAKE_CURRENT_SOURCE_DIR}/framework/non_secure_suites.c
61)
Kevin Peng62a87112020-07-07 15:07:46 +080062
Raef Coles652bb8a2020-09-24 11:27:38 +010063target_link_libraries(tfm_ns_tests
64 INTERFACE
65 tfm_test_framework
66 tfm_partition_defs
67)
Kevin Peng62a87112020-07-07 15:07:46 +080068
Raef Coles652bb8a2020-09-24 11:27:38 +010069target_compile_definitions(tfm_ns_tests
70 INTERFACE
71 $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
Raef Colesce57e062020-10-02 10:39:41 +010072 $<$<BOOL:${TFM_INTERACTIVE_TEST}>:CORE_TEST_INTERACTIVE>
David Hu1f098cc2020-10-14 15:00:35 +080073 $<$<BOOL:${TFM_MULTI_CORE_MULTI_CLIENT_CALL}>:TFM_MULTI_CORE_MULTI_CLIENT_CALL>
Raef Coles652bb8a2020-09-24 11:27:38 +010074)
Kevin Peng62a87112020-07-07 15:07:46 +080075
Raef Coles652bb8a2020-09-24 11:27:38 +010076####################### Secure #################################################
Kevin Peng62a87112020-07-07 15:07:46 +080077
David Hu4f538e42020-11-09 16:46:17 +080078if (TEST_S)
79 target_sources(tfm_s_tests
80 INTERFACE
81 ${CMAKE_CURRENT_SOURCE_DIR}/framework/secure_suites.c
82 )
Kevin Peng62a87112020-07-07 15:07:46 +080083
David Hu4f538e42020-11-09 16:46:17 +080084 target_link_libraries(tfm_s_tests
85 INTERFACE
86 tfm_test_framework
87 tfm_partition_defs
88 tfm_spm
89 )
Jamie Fox9d688172020-10-22 23:26:24 +010090
David Hu4f538e42020-11-09 16:46:17 +080091 target_compile_definitions(tfm_s_tests
92 INTERFACE
93 $<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS>
94 )
95endif()