blob: 23c2c7ecadc0c8e59961ed509a46920eff67a143 [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)
David Hu73f259b2020-12-07 10:58:41 +080011add_library(tfm_test_framework_ns INTERFACE)
12add_library(tfm_test_framework_s INTERFACE)
Raef Coles652bb8a2020-09-24 11:27:38 +010013
14# For multi-core projects, the NS app can be run on a different CPU to the
15# Secure code. To facilitate this, we once again reload the compiler to load the
16# setting for the NS CPU. Cmake settings are directory scoped so this affects
17# anything loaded from or declared in this dir.
18if (TFM_MULTI_CORE_TOPOLOGY)
19 include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
Raef Coles34cffa72020-10-28 10:27:19 +000020 tfm_toolchain_reload_compiler()
Kevin Pengae997e42020-07-08 17:06:37 +080021endif()
Kevin Peng62a87112020-07-07 15:07:46 +080022
Raef Coles652bb8a2020-09-24 11:27:38 +010023add_subdirectory(test_services)
Kevin Peng62a87112020-07-07 15:07:46 +080024
Raef Coles652bb8a2020-09-24 11:27:38 +010025add_subdirectory(suites/attestation)
26add_subdirectory(suites/audit)
27add_subdirectory(suites/core)
28add_subdirectory(suites/crypto)
29add_subdirectory(suites/its)
30add_subdirectory(suites/qcbor)
31add_subdirectory(suites/ps)
32add_subdirectory(suites/t_cose)
33add_subdirectory(suites/platform)
34if(TFM_PSA_API)
35 add_subdirectory(suites/ipc)
36endif()
37if(TFM_MULTI_CORE_TOPOLOGY)
38 add_subdirectory(suites/multi_core)
Kevin Peng62a87112020-07-07 15:07:46 +080039endif()
40
David Hu73f259b2020-12-07 10:58:41 +080041add_library(tfm_test_framework_common INTERFACE)
42
43target_sources(tfm_test_framework_common
Raef Coles652bb8a2020-09-24 11:27:38 +010044 INTERFACE
45 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework.c
46 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_helpers.c
47 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test_helper.c
48)
Kevin Peng62a87112020-07-07 15:07:46 +080049
David Hu73f259b2020-12-07 10:58:41 +080050target_include_directories(tfm_test_framework_common
Raef Coles652bb8a2020-09-24 11:27:38 +010051 INTERFACE
52 framework
53)
Kevin Peng62a87112020-07-07 15:07:46 +080054
David Hu73f259b2020-12-07 10:58:41 +080055target_link_libraries(tfm_test_framework_ns
Raef Coles652bb8a2020-09-24 11:27:38 +010056 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +080057 tfm_test_framework_common
58 tfm_ns_interface
Kevin Pengaf602292020-10-20 17:49:52 +080059 tfm_ns_log
Raef Coles652bb8a2020-09-24 11:27:38 +010060)
Kevin Peng62a87112020-07-07 15:07:46 +080061
Raef Coles652bb8a2020-09-24 11:27:38 +010062target_sources(tfm_ns_tests
63 INTERFACE
64 ${CMAKE_CURRENT_SOURCE_DIR}/framework/non_secure_suites.c
65)
Kevin Peng62a87112020-07-07 15:07:46 +080066
Raef Coles652bb8a2020-09-24 11:27:38 +010067target_link_libraries(tfm_ns_tests
68 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +080069 tfm_test_framework_ns
Raef Coles652bb8a2020-09-24 11:27:38 +010070 tfm_partition_defs
71)
Kevin Peng62a87112020-07-07 15:07:46 +080072
Raef Coles652bb8a2020-09-24 11:27:38 +010073target_compile_definitions(tfm_ns_tests
74 INTERFACE
75 $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
Raef Colesce57e062020-10-02 10:39:41 +010076 $<$<BOOL:${TFM_INTERACTIVE_TEST}>:CORE_TEST_INTERACTIVE>
Raef Coles652bb8a2020-09-24 11:27:38 +010077)
Kevin Peng62a87112020-07-07 15:07:46 +080078
Raef Coles652bb8a2020-09-24 11:27:38 +010079####################### Secure #################################################
Kevin Peng62a87112020-07-07 15:07:46 +080080
David Hu73f259b2020-12-07 10:58:41 +080081target_link_libraries(tfm_test_framework_s
82 INTERFACE
83 psa_interface
84 tfm_test_framework_common
85 tfm_s_log
86)
87
David Hu4f538e42020-11-09 16:46:17 +080088if (TEST_S)
89 target_sources(tfm_s_tests
90 INTERFACE
91 ${CMAKE_CURRENT_SOURCE_DIR}/framework/secure_suites.c
92 )
Kevin Peng62a87112020-07-07 15:07:46 +080093
David Hu4f538e42020-11-09 16:46:17 +080094 target_link_libraries(tfm_s_tests
95 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +080096 tfm_test_framework_s
David Hu4f538e42020-11-09 16:46:17 +080097 tfm_partition_defs
98 tfm_spm
99 )
Jamie Fox9d688172020-10-22 23:26:24 +0100100
David Hu4f538e42020-11-09 16:46:17 +0800101 target_compile_definitions(tfm_s_tests
102 INTERFACE
103 $<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS>
104 )
105endif()