blob: 8795e4a5f0427047561097f15a3a5a521f43248d [file] [log] [blame]
Raef Colesc7d80682021-05-26 14:20:31 +01001#-------------------------------------------------------------------------------
2# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
Chris Brand592c98e2022-05-20 14:46:54 -07003# Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon company)
4# or an affiliate of Cypress Semiconductor Corporation. All rights reserved.
Raef Colesc7d80682021-05-26 14:20:31 +01005#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9
10cmake_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 Brand592c98e2022-05-20 14:46:54 -070016if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
Raef Colesc7d80682021-05-26 14:20:31 +010017 include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
18 tfm_toolchain_reload_compiler()
19endif()
20
21if (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 Colesc7d80682021-05-26 14:20:31 +010038 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 )
54else()
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()
66endif()
67
68# Add test suites.
69# Secure test suite library targets shall already be added in secure_tests.cmake
70add_subdirectory(attestation)
71add_subdirectory(audit)
Raef Colesc7d80682021-05-26 14:20:31 +010072add_subdirectory(crypto)
73add_subdirectory(extra)
74add_subdirectory(its)
75add_subdirectory(qcbor)
76add_subdirectory(ps)
77add_subdirectory(t_cose)
78add_subdirectory(platform)
79add_subdirectory(fwu)
Raef Colesc7d80682021-05-26 14:20:31 +010080add_subdirectory(multi_core/non_secure)
81add_subdirectory(nsid)
82add_subdirectory(fpu)
83add_subdirectory(spm)
84
85if (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()
93endif()