blob: 93617120674bb670702a94476f0afb8ee841d1ca [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.
David Hucf299b12021-09-12 16:41:48 +08003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8# Since the main test directory is a NS dir, this subdir is specifically made a
9# secure directory as it build the secure side tests and services
10if (TFM_MULTI_CORE_TOPOLOGY)
11 include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload.cmake)
12 tfm_toolchain_reload_compiler()
13endif()
14
Jianliang Shenc168e762022-01-19 11:31:07 +080015# Install directory for non-secure interface API of test services
16# NS can pick up those interface files to build non-secure test cases
17set(TEST_SERVICE_SRC_INSTALL_DIR ${TFM_INSTALL_PATH}/interface/src/test_service)
18set(TEST_SERVICE_INC_INSTALL_DIR ${TFM_INSTALL_PATH}/interface/include/test_service)
19
David Hucf299b12021-09-12 16:41:48 +080020# Test services are also required by some NS regression tests.
21# Include test services at first no matter whether secure tests are enabled.
Jianliang Shene92ad192022-05-11 13:59:10 +080022add_subdirectory(suites/core/service ${CMAKE_BINARY_DIR}/tf-m-tests/core_srv)
23add_subdirectory(suites/spm/ipc/service ${CMAKE_BINARY_DIR}/tf-m-tests/ipc_srv)
24add_subdirectory(suites/spm/sfn/service ${CMAKE_BINARY_DIR}/tf-m-tests/sfn_srv)
25add_subdirectory(suites/spm/irq/service ${CMAKE_BINARY_DIR}/tf-m-tests/irq_srv)
26add_subdirectory(suites/ps/service ${CMAKE_BINARY_DIR}/tf-m-tests/ps_srv)
27add_subdirectory(suites/fpu/service ${CMAKE_BINARY_DIR}/tf-m-tests/fpu_srv)
David Hucf299b12021-09-12 16:41:48 +080028
29if (NOT TEST_FRAMEWORK_S)
30 return()
31endif()
32
Jianliang Shenc168e762022-01-19 11:31:07 +080033# secure test services are required if any secure test is opened
Jianliang Shene92ad192022-05-11 13:59:10 +080034add_subdirectory(common_test_services/tfm_secure_client_service ${CMAKE_BINARY_DIR}/tf-m-tests/secure_client_srv)
35add_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 +080036
David Hucf299b12021-09-12 16:41:48 +080037add_library(tfm_test_framework_s INTERFACE)
38add_library(tfm_s_tests INTERFACE)
39
40target_link_libraries(tfm_test_framework_s
41 INTERFACE
42 psa_interface
43 tfm_test_framework_common
44 tfm_sp_log_raw
45)
46
Raef Coles4817eb82022-01-18 12:33:24 +000047target_compile_definitions(tfm_test_framework_s
48 INTERFACE
49 USE_SP_LOG
50)
51
David Hucf299b12021-09-12 16:41:48 +080052target_sources(tfm_s_tests
53 INTERFACE
Raef Colesc7d80682021-05-26 14:20:31 +010054 ${CMAKE_CURRENT_SOURCE_DIR}/secure_suites.c
David Hucf299b12021-09-12 16:41:48 +080055)
56
57target_link_libraries(tfm_s_tests
58 INTERFACE
59 tfm_test_framework_s
60 tfm_partition_defs
61 tfm_spm
62)
63
64target_compile_definitions(tfm_s_tests
65 INTERFACE
66 $<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS>
67)
68
69############################# Secure tests #####################################
70
71# Add secure test library targets here to inherit secure side configurations
72if (TEST_S_CRYPTO)
73 add_library(tfm_test_suite_crypto_s STATIC EXCLUDE_FROM_ALL)
74endif()
75if (TEST_S_ATTESTATION)
76 add_library(tfm_test_suite_attestation_s STATIC EXCLUDE_FROM_ALL)
77endif()
78if (TEST_S_ITS)
79 add_library(tfm_test_suite_its_s STATIC EXCLUDE_FROM_ALL)
80endif()
81if (TEST_S_PS)
82 add_library(tfm_test_suite_ps_s STATIC EXCLUDE_FROM_ALL)
83endif()
84if (TEST_S_AUDIT)
85 add_library(tfm_test_suite_audit_s STATIC EXCLUDE_FROM_ALL)
86endif()
87if (TEST_S_PLATFORM)
88 add_library(tfm_test_suite_platform_s STATIC EXCLUDE_FROM_ALL)
89endif()
90if (TEST_S_IPC)
91 add_library(tfm_test_suite_ipc_s STATIC EXCLUDE_FROM_ALL)
92endif()
93if (TEST_S_FWU)
94 add_library(tfm_test_suite_fwu_s STATIC EXCLUDE_FROM_ALL)
95endif()
Feder Liangdb53c6b2021-09-07 15:42:09 +080096if (TEST_S_FPU)
97 add_library(tfm_test_suite_fpu_s STATIC EXCLUDE_FROM_ALL)
98endif()
David Hucf299b12021-09-12 16:41:48 +080099if (EXTRA_S_TEST_SUITES_PATHS)
100 add_library(tfm_test_suite_extra_s STATIC EXCLUDE_FROM_ALL)
101endif()