blob: 01b3bd93a3ae1629f7184277445757a4de156cb3 [file] [log] [blame]
Kevin Peng62a87112020-07-07 15:07:46 +08001#-------------------------------------------------------------------------------
David Hub8dd1712021-02-09 15:07:46 +08002# Copyright (c) 2020-2021, 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)
Jianliang Shen2959c1f2021-09-01 10:14:06 +080029add_subdirectory(suites/extra)
Raef Coles652bb8a2020-09-24 11:27:38 +010030add_subdirectory(suites/its)
31add_subdirectory(suites/qcbor)
32add_subdirectory(suites/ps)
33add_subdirectory(suites/t_cose)
34add_subdirectory(suites/platform)
Sherry Zhang92c499a2021-03-08 18:14:15 +080035add_subdirectory(suites/fwu)
Kevin Penga8604332021-04-23 17:33:30 +080036add_subdirectory(suites/irq)
Sherry Zhang92c499a2021-03-08 18:14:15 +080037
Raef Coles652bb8a2020-09-24 11:27:38 +010038if(TFM_PSA_API)
39 add_subdirectory(suites/ipc)
40endif()
shejia01e0dd80a2021-07-12 17:47:50 +080041if(TEST_NS_MULTI_CORE)
David Hub0bce472021-05-20 14:06:52 +080042 add_subdirectory(suites/multi_core/non_secure)
Kevin Peng62a87112020-07-07 15:07:46 +080043endif()
44
Mate Toth-Palb3f96d22021-05-12 08:42:34 +020045if (TFM_FUZZER_TOOL_TESTS)
46 if(NOT DEFINED TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH)
47 # The location of the file needs to be defined either from command line
48 # or from config cmake file.
49 message(FATAL_ERROR "Incomplete build configuration: TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH is undefined.")
50 else()
51 add_subdirectory(${TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH} ${CMAKE_BINARY_DIR}/suites/tfm_fuzz)
52 endif()
53endif()
54
David Hu73f259b2020-12-07 10:58:41 +080055add_library(tfm_test_framework_common INTERFACE)
56
57target_sources(tfm_test_framework_common
Raef Coles652bb8a2020-09-24 11:27:38 +010058 INTERFACE
59 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework.c
60 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_helpers.c
61 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test_helper.c
62)
Kevin Peng62a87112020-07-07 15:07:46 +080063
David Hu73f259b2020-12-07 10:58:41 +080064target_include_directories(tfm_test_framework_common
Raef Coles652bb8a2020-09-24 11:27:38 +010065 INTERFACE
66 framework
67)
Kevin Peng62a87112020-07-07 15:07:46 +080068
David Hu1a74bc52021-08-19 11:17:42 +080069target_compile_definitions(tfm_test_framework_ns
70 INTERFACE
71 DOMAIN_NS=1
72)
73
David Hu73f259b2020-12-07 10:58:41 +080074target_link_libraries(tfm_test_framework_ns
Raef Coles652bb8a2020-09-24 11:27:38 +010075 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +080076 tfm_test_framework_common
David Hub8dd1712021-02-09 15:07:46 +080077 tfm_api_ns
David Hu73f259b2020-12-07 10:58:41 +080078 tfm_ns_interface
Kevin Pengaf602292020-10-20 17:49:52 +080079 tfm_ns_log
Raef Coles652bb8a2020-09-24 11:27:38 +010080)
Kevin Peng62a87112020-07-07 15:07:46 +080081
Raef Coles652bb8a2020-09-24 11:27:38 +010082target_sources(tfm_ns_tests
83 INTERFACE
84 ${CMAKE_CURRENT_SOURCE_DIR}/framework/non_secure_suites.c
85)
Kevin Peng62a87112020-07-07 15:07:46 +080086
Raef Coles652bb8a2020-09-24 11:27:38 +010087target_link_libraries(tfm_ns_tests
88 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +080089 tfm_test_framework_ns
Raef Coles652bb8a2020-09-24 11:27:38 +010090 tfm_partition_defs
91)
Kevin Peng62a87112020-07-07 15:07:46 +080092
Raef Coles652bb8a2020-09-24 11:27:38 +010093target_compile_definitions(tfm_ns_tests
94 INTERFACE
95 $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
Mate Toth-Palb3f96d22021-05-12 08:42:34 +020096 $<$<BOOL:${TFM_FUZZER_TOOL_TESTS}>:TFM_FUZZER_TOOL_TESTS>
Raef Coles652bb8a2020-09-24 11:27:38 +010097)
Kevin Peng62a87112020-07-07 15:07:46 +080098
Raef Coles652bb8a2020-09-24 11:27:38 +010099####################### Secure #################################################
Kevin Peng62a87112020-07-07 15:07:46 +0800100
David Hu73f259b2020-12-07 10:58:41 +0800101target_link_libraries(tfm_test_framework_s
102 INTERFACE
103 psa_interface
104 tfm_test_framework_common
David Hu1a74bc52021-08-19 11:17:42 +0800105 tfm_sp_log_raw
David Hu73f259b2020-12-07 10:58:41 +0800106)
107
shejia01e0dd80a2021-07-12 17:47:50 +0800108if (TEST_FRAMEWORK_S)
David Hu4f538e42020-11-09 16:46:17 +0800109 target_sources(tfm_s_tests
110 INTERFACE
111 ${CMAKE_CURRENT_SOURCE_DIR}/framework/secure_suites.c
112 )
Kevin Peng62a87112020-07-07 15:07:46 +0800113
David Hu4f538e42020-11-09 16:46:17 +0800114 target_link_libraries(tfm_s_tests
115 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +0800116 tfm_test_framework_s
David Hu4f538e42020-11-09 16:46:17 +0800117 tfm_partition_defs
118 tfm_spm
119 )
Jamie Fox9d688172020-10-22 23:26:24 +0100120
David Hu4f538e42020-11-09 16:46:17 +0800121 target_compile_definitions(tfm_s_tests
122 INTERFACE
123 $<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS>
124 )
125endif()