Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
David Hu | b8dd171 | 2021-02-09 15:07:46 +0800 | [diff] [blame] | 2 | # Copyright (c) 2020-2021, Arm Limited. All rights reserved. |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 8 | cmake_minimum_required(VERSION 3.13) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 9 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 10 | add_library(tfm_ns_tests INTERFACE) |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 11 | add_library(tfm_test_framework_ns INTERFACE) |
| 12 | add_library(tfm_test_framework_s INTERFACE) |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 13 | |
| 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. |
| 18 | if (TFM_MULTI_CORE_TOPOLOGY) |
| 19 | include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake) |
Raef Coles | 34cffa7 | 2020-10-28 10:27:19 +0000 | [diff] [blame] | 20 | tfm_toolchain_reload_compiler() |
Kevin Peng | ae997e4 | 2020-07-08 17:06:37 +0800 | [diff] [blame] | 21 | endif() |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 22 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 23 | add_subdirectory(test_services) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 24 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 25 | add_subdirectory(suites/attestation) |
| 26 | add_subdirectory(suites/audit) |
| 27 | add_subdirectory(suites/core) |
| 28 | add_subdirectory(suites/crypto) |
Jianliang Shen | 2959c1f | 2021-09-01 10:14:06 +0800 | [diff] [blame] | 29 | add_subdirectory(suites/extra) |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 30 | add_subdirectory(suites/its) |
| 31 | add_subdirectory(suites/qcbor) |
| 32 | add_subdirectory(suites/ps) |
| 33 | add_subdirectory(suites/t_cose) |
| 34 | add_subdirectory(suites/platform) |
Sherry Zhang | 92c499a | 2021-03-08 18:14:15 +0800 | [diff] [blame] | 35 | add_subdirectory(suites/fwu) |
Kevin Peng | a860433 | 2021-04-23 17:33:30 +0800 | [diff] [blame] | 36 | add_subdirectory(suites/irq) |
Xinyu Zhang | 92fe758 | 2021-09-24 17:11:49 +0800 | [diff] [blame] | 37 | add_subdirectory(suites/nsid) |
Sherry Zhang | 92c499a | 2021-03-08 18:14:15 +0800 | [diff] [blame] | 38 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 39 | if(TFM_PSA_API) |
| 40 | add_subdirectory(suites/ipc) |
| 41 | endif() |
shejia01 | e0dd80a | 2021-07-12 17:47:50 +0800 | [diff] [blame] | 42 | if(TEST_NS_MULTI_CORE) |
David Hu | b0bce47 | 2021-05-20 14:06:52 +0800 | [diff] [blame] | 43 | add_subdirectory(suites/multi_core/non_secure) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 44 | endif() |
| 45 | |
Mate Toth-Pal | b3f96d2 | 2021-05-12 08:42:34 +0200 | [diff] [blame] | 46 | if (TFM_FUZZER_TOOL_TESTS) |
| 47 | if(NOT DEFINED TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH) |
| 48 | # The location of the file needs to be defined either from command line |
| 49 | # or from config cmake file. |
| 50 | message(FATAL_ERROR "Incomplete build configuration: TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH is undefined.") |
| 51 | else() |
| 52 | add_subdirectory(${TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH} ${CMAKE_BINARY_DIR}/suites/tfm_fuzz) |
| 53 | endif() |
| 54 | endif() |
| 55 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 56 | add_library(tfm_test_framework_common INTERFACE) |
| 57 | |
| 58 | target_sources(tfm_test_framework_common |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 59 | INTERFACE |
| 60 | ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework.c |
| 61 | ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_helpers.c |
| 62 | ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test_helper.c |
| 63 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 64 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 65 | target_include_directories(tfm_test_framework_common |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 66 | INTERFACE |
| 67 | framework |
| 68 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 69 | |
David Hu | 1a74bc5 | 2021-08-19 11:17:42 +0800 | [diff] [blame] | 70 | target_compile_definitions(tfm_test_framework_ns |
| 71 | INTERFACE |
| 72 | DOMAIN_NS=1 |
| 73 | ) |
| 74 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 75 | target_link_libraries(tfm_test_framework_ns |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 76 | INTERFACE |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 77 | tfm_test_framework_common |
David Hu | b8dd171 | 2021-02-09 15:07:46 +0800 | [diff] [blame] | 78 | tfm_api_ns |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 79 | tfm_ns_interface |
Kevin Peng | af60229 | 2020-10-20 17:49:52 +0800 | [diff] [blame] | 80 | tfm_ns_log |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 81 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 82 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 83 | target_sources(tfm_ns_tests |
| 84 | INTERFACE |
| 85 | ${CMAKE_CURRENT_SOURCE_DIR}/framework/non_secure_suites.c |
| 86 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 87 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 88 | target_link_libraries(tfm_ns_tests |
| 89 | INTERFACE |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 90 | tfm_test_framework_ns |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 91 | tfm_partition_defs |
| 92 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 93 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 94 | target_compile_definitions(tfm_ns_tests |
| 95 | INTERFACE |
| 96 | $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION> |
Mate Toth-Pal | b3f96d2 | 2021-05-12 08:42:34 +0200 | [diff] [blame] | 97 | $<$<BOOL:${TFM_FUZZER_TOOL_TESTS}>:TFM_FUZZER_TOOL_TESTS> |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 98 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 99 | |
Raef Coles | 652bb8a | 2020-09-24 11:27:38 +0100 | [diff] [blame] | 100 | ####################### Secure ################################################# |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 101 | |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 102 | target_link_libraries(tfm_test_framework_s |
| 103 | INTERFACE |
| 104 | psa_interface |
| 105 | tfm_test_framework_common |
David Hu | 1a74bc5 | 2021-08-19 11:17:42 +0800 | [diff] [blame] | 106 | tfm_sp_log_raw |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 107 | ) |
| 108 | |
shejia01 | e0dd80a | 2021-07-12 17:47:50 +0800 | [diff] [blame] | 109 | if (TEST_FRAMEWORK_S) |
David Hu | 4f538e4 | 2020-11-09 16:46:17 +0800 | [diff] [blame] | 110 | target_sources(tfm_s_tests |
| 111 | INTERFACE |
| 112 | ${CMAKE_CURRENT_SOURCE_DIR}/framework/secure_suites.c |
| 113 | ) |
Kevin Peng | 62a8711 | 2020-07-07 15:07:46 +0800 | [diff] [blame] | 114 | |
David Hu | 4f538e4 | 2020-11-09 16:46:17 +0800 | [diff] [blame] | 115 | target_link_libraries(tfm_s_tests |
| 116 | INTERFACE |
David Hu | 73f259b | 2020-12-07 10:58:41 +0800 | [diff] [blame] | 117 | tfm_test_framework_s |
David Hu | 4f538e4 | 2020-11-09 16:46:17 +0800 | [diff] [blame] | 118 | tfm_partition_defs |
| 119 | tfm_spm |
| 120 | ) |
Jamie Fox | 9d68817 | 2020-10-22 23:26:24 +0100 | [diff] [blame] | 121 | |
David Hu | 4f538e4 | 2020-11-09 16:46:17 +0800 | [diff] [blame] | 122 | target_compile_definitions(tfm_s_tests |
| 123 | INTERFACE |
| 124 | $<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS> |
| 125 | ) |
| 126 | endif() |