Raef Coles | c7d8068 | 2021-05-26 14:20:31 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2021-2022, Arm Limited. All rights reserved. |
Chris Brand | 592c98e | 2022-05-20 14:46:54 -0700 | [diff] [blame] | 3 | # Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company) |
| 4 | # or an affiliate of Cypress Semiconductor Corporation. All rights reserved. |
Raef Coles | c7d8068 | 2021-05-26 14:20:31 +0100 | [diff] [blame] | 5 | # |
| 6 | # SPDX-License-Identifier: BSD-3-Clause |
| 7 | # |
| 8 | #------------------------------------------------------------------------------- |
| 9 | |
| 10 | cmake_minimum_required(VERSION 3.13) |
| 11 | |
| 12 | # For multi-core projects, the NS app can be run on a different CPU to the |
| 13 | # Secure code. To facilitate this, we once again reload the compiler to load the |
| 14 | # setting for the NS CPU. Cmake settings are directory scoped so this affects |
| 15 | # anything loaded from or declared in this dir. |
Chris Brand | 592c98e | 2022-05-20 14:46:54 -0700 | [diff] [blame] | 16 | if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake) |
Raef Coles | c7d8068 | 2021-05-26 14:20:31 +0100 | [diff] [blame] | 17 | include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake) |
| 18 | tfm_toolchain_reload_compiler() |
| 19 | endif() |
| 20 | |
| 21 | if (TEST_FRAMEWORK_NS) |
| 22 | add_library(tfm_ns_tests INTERFACE) |
| 23 | add_library(tfm_test_framework_ns INTERFACE) |
| 24 | |
| 25 | target_compile_definitions(tfm_test_framework_ns |
| 26 | INTERFACE |
| 27 | DOMAIN_NS=1 |
| 28 | ) |
| 29 | |
| 30 | target_link_libraries(tfm_test_framework_ns |
| 31 | INTERFACE |
| 32 | tfm_test_framework_common |
| 33 | tfm_api_ns |
| 34 | tfm_ns_interface |
| 35 | tfm_log |
| 36 | ) |
| 37 | |
Raef Coles | c7d8068 | 2021-05-26 14:20:31 +0100 | [diff] [blame] | 38 | target_sources(tfm_ns_tests |
| 39 | INTERFACE |
| 40 | ../non_secure_suites.c |
| 41 | ) |
| 42 | |
| 43 | target_link_libraries(tfm_ns_tests |
| 44 | INTERFACE |
| 45 | tfm_test_framework_ns |
| 46 | tfm_partition_defs |
| 47 | ) |
| 48 | |
| 49 | target_compile_definitions(tfm_ns_tests |
| 50 | INTERFACE |
| 51 | $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION> |
| 52 | $<$<BOOL:${TFM_FUZZER_TOOL_TESTS}>:TFM_FUZZER_TOOL_TESTS> |
| 53 | ) |
| 54 | else() |
| 55 | # Skip building NS regresstion test suites if TEST_FRAMEWORK_NS is OFF. |
| 56 | # NS test flags are kept to select corresponding test services. They are |
| 57 | # unset here to skip building NS regression test suites. |
| 58 | get_cmake_property(CACHE_VARS CACHE_VARIABLES) |
| 59 | |
| 60 | foreach(CACHE_VAR ${CACHE_VARS}) |
| 61 | string(REGEX MATCH "^TEST_NS_.*" _NS_TEST_FOUND "${CACHE_VAR}") |
| 62 | if (_NS_TEST_FOUND AND "${${CACHE_VAR}}") |
| 63 | unset(${CACHE_VAR} CACHE) |
| 64 | endif() |
| 65 | endforeach() |
| 66 | endif() |
| 67 | |
| 68 | # Add test suites. |
| 69 | # Secure test suite library targets shall already be added in secure_tests.cmake |
| 70 | add_subdirectory(attestation) |
| 71 | add_subdirectory(audit) |
Raef Coles | c7d8068 | 2021-05-26 14:20:31 +0100 | [diff] [blame] | 72 | add_subdirectory(crypto) |
| 73 | add_subdirectory(extra) |
| 74 | add_subdirectory(its) |
| 75 | add_subdirectory(qcbor) |
| 76 | add_subdirectory(ps) |
| 77 | add_subdirectory(t_cose) |
| 78 | add_subdirectory(platform) |
| 79 | add_subdirectory(fwu) |
Raef Coles | c7d8068 | 2021-05-26 14:20:31 +0100 | [diff] [blame] | 80 | add_subdirectory(multi_core/non_secure) |
| 81 | add_subdirectory(nsid) |
| 82 | add_subdirectory(fpu) |
| 83 | add_subdirectory(spm) |
| 84 | |
| 85 | if (TFM_FUZZER_TOOL_TESTS AND TEST_FRAMEWORK_NS) |
| 86 | if (NOT DEFINED TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH) |
| 87 | # The location of the file needs to be defined either from command line |
| 88 | # or from config cmake file. |
| 89 | message(FATAL_ERROR "Incomplete build configuration: TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH is undefined.") |
| 90 | else() |
| 91 | add_subdirectory(${TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH} ${CMAKE_BINARY_DIR}/suites/tfm_fuzz) |
| 92 | endif() |
| 93 | endif() |