blob: f071623ad9c2a299e8e0f1ddc4d3f312dec3b328 [file] [log] [blame]
David Hucf299b12021-09-12 16:41:48 +08001#-------------------------------------------------------------------------------
Raef Colesc7d80682021-05-26 14:20:31 +01002# 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.
David Hucf299b12021-09-12 16:41:48 +08005#
6# SPDX-License-Identifier: BSD-3-Clause
7#
8#-------------------------------------------------------------------------------
9
10# Since the main test directory is a NS dir, this subdir is specifically made a
11# secure directory as it build the secure side tests and services
Chris Brand592c98e2022-05-20 14:46:54 -070012if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
David Hucf299b12021-09-12 16:41:48 +080013 include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload.cmake)
14 tfm_toolchain_reload_compiler()
15endif()
16
Jianliang Shenc168e762022-01-19 11:31:07 +080017# Install directory for non-secure interface API of test services
18# NS can pick up those interface files to build non-secure test cases
19set(TEST_SERVICE_SRC_INSTALL_DIR ${TFM_INSTALL_PATH}/interface/src/test_service)
20set(TEST_SERVICE_INC_INSTALL_DIR ${TFM_INSTALL_PATH}/interface/include/test_service)
21
David Hucf299b12021-09-12 16:41:48 +080022# Test services are also required by some NS regression tests.
23# Include test services at first no matter whether secure tests are enabled.
Jianliang Shene92ad192022-05-11 13:59:10 +080024add_subdirectory(suites/core/service ${CMAKE_BINARY_DIR}/tf-m-tests/core_srv)
25add_subdirectory(suites/spm/ipc/service ${CMAKE_BINARY_DIR}/tf-m-tests/ipc_srv)
26add_subdirectory(suites/spm/sfn/service ${CMAKE_BINARY_DIR}/tf-m-tests/sfn_srv)
27add_subdirectory(suites/spm/irq/service ${CMAKE_BINARY_DIR}/tf-m-tests/irq_srv)
28add_subdirectory(suites/ps/service ${CMAKE_BINARY_DIR}/tf-m-tests/ps_srv)
29add_subdirectory(suites/fpu/service ${CMAKE_BINARY_DIR}/tf-m-tests/fpu_srv)
David Hucf299b12021-09-12 16:41:48 +080030
31if (NOT TEST_FRAMEWORK_S)
32 return()
33endif()
34
Jianliang Shenc168e762022-01-19 11:31:07 +080035# secure test services are required if any secure test is opened
Jianliang Shene92ad192022-05-11 13:59:10 +080036add_subdirectory(common_test_services/tfm_secure_client_service ${CMAKE_BINARY_DIR}/tf-m-tests/secure_client_srv)
37add_subdirectory(common_test_services/tfm_secure_client_2 ${CMAKE_BINARY_DIR}/tf-m-tests/secure_client_2_srv)
Jianliang Shenc168e762022-01-19 11:31:07 +080038
David Hucf299b12021-09-12 16:41:48 +080039add_library(tfm_test_framework_s INTERFACE)
40add_library(tfm_s_tests INTERFACE)
41
42target_link_libraries(tfm_test_framework_s
43 INTERFACE
44 psa_interface
45 tfm_test_framework_common
46 tfm_sp_log_raw
47)
48
Raef Coles4817eb82022-01-18 12:33:24 +000049target_compile_definitions(tfm_test_framework_s
50 INTERFACE
51 USE_SP_LOG
52)
53
David Hucf299b12021-09-12 16:41:48 +080054target_sources(tfm_s_tests
55 INTERFACE
Raef Colesc7d80682021-05-26 14:20:31 +010056 ${CMAKE_CURRENT_SOURCE_DIR}/secure_suites.c
David Hucf299b12021-09-12 16:41:48 +080057)
58
59target_link_libraries(tfm_s_tests
60 INTERFACE
61 tfm_test_framework_s
62 tfm_partition_defs
63 tfm_spm
64)
65
66target_compile_definitions(tfm_s_tests
67 INTERFACE
68 $<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS>
69)
70
71############################# Secure tests #####################################
72
73# Add secure test library targets here to inherit secure side configurations
74if (TEST_S_CRYPTO)
75 add_library(tfm_test_suite_crypto_s STATIC EXCLUDE_FROM_ALL)
76endif()
77if (TEST_S_ATTESTATION)
78 add_library(tfm_test_suite_attestation_s STATIC EXCLUDE_FROM_ALL)
79endif()
80if (TEST_S_ITS)
81 add_library(tfm_test_suite_its_s STATIC EXCLUDE_FROM_ALL)
82endif()
83if (TEST_S_PS)
84 add_library(tfm_test_suite_ps_s STATIC EXCLUDE_FROM_ALL)
85endif()
86if (TEST_S_AUDIT)
87 add_library(tfm_test_suite_audit_s STATIC EXCLUDE_FROM_ALL)
88endif()
89if (TEST_S_PLATFORM)
90 add_library(tfm_test_suite_platform_s STATIC EXCLUDE_FROM_ALL)
91endif()
92if (TEST_S_IPC)
93 add_library(tfm_test_suite_ipc_s STATIC EXCLUDE_FROM_ALL)
94endif()
95if (TEST_S_FWU)
96 add_library(tfm_test_suite_fwu_s STATIC EXCLUDE_FROM_ALL)
97endif()
Feder Liangdb53c6b2021-09-07 15:42:09 +080098if (TEST_S_FPU)
99 add_library(tfm_test_suite_fpu_s STATIC EXCLUDE_FROM_ALL)
100endif()
David Hucf299b12021-09-12 16:41:48 +0800101if (EXTRA_S_TEST_SUITES_PATHS)
102 add_library(tfm_test_suite_extra_s STATIC EXCLUDE_FROM_ALL)
103endif()