blob: 490bbffe0e27c31560f0d0943c067a177b6bf071 [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)
29add_subdirectory(suites/its)
30add_subdirectory(suites/qcbor)
31add_subdirectory(suites/ps)
32add_subdirectory(suites/t_cose)
33add_subdirectory(suites/platform)
Sherry Zhang92c499a2021-03-08 18:14:15 +080034add_subdirectory(suites/fwu)
Kevin Penga8604332021-04-23 17:33:30 +080035add_subdirectory(suites/irq)
Sherry Zhang92c499a2021-03-08 18:14:15 +080036
Raef Coles652bb8a2020-09-24 11:27:38 +010037if(TFM_PSA_API)
38 add_subdirectory(suites/ipc)
39endif()
David Hub0bce472021-05-20 14:06:52 +080040if(TFM_MULTI_CORE_TOPOLOGY AND TEST_NS)
41 add_subdirectory(suites/multi_core/non_secure)
Kevin Peng62a87112020-07-07 15:07:46 +080042endif()
43
Mate Toth-Palb3f96d22021-05-12 08:42:34 +020044if (TFM_FUZZER_TOOL_TESTS)
45 if(NOT DEFINED TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH)
46 # The location of the file needs to be defined either from command line
47 # or from config cmake file.
48 message(FATAL_ERROR "Incomplete build configuration: TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH is undefined.")
49 else()
50 add_subdirectory(${TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH} ${CMAKE_BINARY_DIR}/suites/tfm_fuzz)
51 endif()
52endif()
53
David Hu73f259b2020-12-07 10:58:41 +080054add_library(tfm_test_framework_common INTERFACE)
55
56target_sources(tfm_test_framework_common
Raef Coles652bb8a2020-09-24 11:27:38 +010057 INTERFACE
58 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework.c
59 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_helpers.c
60 ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test_helper.c
61)
Kevin Peng62a87112020-07-07 15:07:46 +080062
David Hu73f259b2020-12-07 10:58:41 +080063target_include_directories(tfm_test_framework_common
Raef Coles652bb8a2020-09-24 11:27:38 +010064 INTERFACE
65 framework
66)
Kevin Peng62a87112020-07-07 15:07:46 +080067
David Hu73f259b2020-12-07 10:58:41 +080068target_link_libraries(tfm_test_framework_ns
Raef Coles652bb8a2020-09-24 11:27:38 +010069 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +080070 tfm_test_framework_common
David Hub8dd1712021-02-09 15:07:46 +080071 tfm_api_ns
David Hu73f259b2020-12-07 10:58:41 +080072 tfm_ns_interface
Kevin Pengaf602292020-10-20 17:49:52 +080073 tfm_ns_log
Raef Coles652bb8a2020-09-24 11:27:38 +010074)
Kevin Peng62a87112020-07-07 15:07:46 +080075
Raef Coles652bb8a2020-09-24 11:27:38 +010076target_sources(tfm_ns_tests
77 INTERFACE
78 ${CMAKE_CURRENT_SOURCE_DIR}/framework/non_secure_suites.c
79)
Kevin Peng62a87112020-07-07 15:07:46 +080080
Raef Coles652bb8a2020-09-24 11:27:38 +010081target_link_libraries(tfm_ns_tests
82 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +080083 tfm_test_framework_ns
Raef Coles652bb8a2020-09-24 11:27:38 +010084 tfm_partition_defs
85)
Kevin Peng62a87112020-07-07 15:07:46 +080086
Raef Coles652bb8a2020-09-24 11:27:38 +010087target_compile_definitions(tfm_ns_tests
88 INTERFACE
89 $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
Raef Colesce57e062020-10-02 10:39:41 +010090 $<$<BOOL:${TFM_INTERACTIVE_TEST}>:CORE_TEST_INTERACTIVE>
Mate Toth-Palb3f96d22021-05-12 08:42:34 +020091 $<$<BOOL:${TFM_FUZZER_TOOL_TESTS}>:TFM_FUZZER_TOOL_TESTS>
Raef Coles652bb8a2020-09-24 11:27:38 +010092)
Kevin Peng62a87112020-07-07 15:07:46 +080093
Raef Coles652bb8a2020-09-24 11:27:38 +010094####################### Secure #################################################
Kevin Peng62a87112020-07-07 15:07:46 +080095
David Hu73f259b2020-12-07 10:58:41 +080096target_link_libraries(tfm_test_framework_s
97 INTERFACE
98 psa_interface
99 tfm_test_framework_common
100 tfm_s_log
101)
102
David Hu4f538e42020-11-09 16:46:17 +0800103if (TEST_S)
104 target_sources(tfm_s_tests
105 INTERFACE
106 ${CMAKE_CURRENT_SOURCE_DIR}/framework/secure_suites.c
107 )
Kevin Peng62a87112020-07-07 15:07:46 +0800108
David Hu4f538e42020-11-09 16:46:17 +0800109 target_link_libraries(tfm_s_tests
110 INTERFACE
David Hu73f259b2020-12-07 10:58:41 +0800111 tfm_test_framework_s
David Hu4f538e42020-11-09 16:46:17 +0800112 tfm_partition_defs
113 tfm_spm
114 )
Jamie Fox9d688172020-10-22 23:26:24 +0100115
David Hu4f538e42020-11-09 16:46:17 +0800116 target_compile_definitions(tfm_s_tests
117 INTERFACE
118 $<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS>
119 )
120endif()