David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
Raef Coles | c7d8068 | 2021-05-26 14:20:31 +0100 | [diff] [blame] | 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. |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 5 | # |
| 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 Brand | 592c98e | 2022-05-20 14:46:54 -0700 | [diff] [blame] | 12 | if (EXISTS ${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake) |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 13 | include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload.cmake) |
| 14 | tfm_toolchain_reload_compiler() |
| 15 | endif() |
| 16 | |
Jianliang Shen | c168e76 | 2022-01-19 11:31:07 +0800 | [diff] [blame] | 17 | # Install directory for non-secure interface API of test services |
| 18 | # NS can pick up those interface files to build non-secure test cases |
| 19 | set(TEST_SERVICE_SRC_INSTALL_DIR ${TFM_INSTALL_PATH}/interface/src/test_service) |
| 20 | set(TEST_SERVICE_INC_INSTALL_DIR ${TFM_INSTALL_PATH}/interface/include/test_service) |
| 21 | |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 22 | # Test services are also required by some NS regression tests. |
| 23 | # Include test services at first no matter whether secure tests are enabled. |
Jianliang Shen | e92ad19 | 2022-05-11 13:59:10 +0800 | [diff] [blame] | 24 | add_subdirectory(suites/spm/ipc/service ${CMAKE_BINARY_DIR}/tf-m-tests/ipc_srv) |
| 25 | add_subdirectory(suites/spm/sfn/service ${CMAKE_BINARY_DIR}/tf-m-tests/sfn_srv) |
| 26 | add_subdirectory(suites/spm/irq/service ${CMAKE_BINARY_DIR}/tf-m-tests/irq_srv) |
| 27 | add_subdirectory(suites/ps/service ${CMAKE_BINARY_DIR}/tf-m-tests/ps_srv) |
| 28 | add_subdirectory(suites/fpu/service ${CMAKE_BINARY_DIR}/tf-m-tests/fpu_srv) |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 29 | |
| 30 | if (NOT TEST_FRAMEWORK_S) |
| 31 | return() |
| 32 | endif() |
| 33 | |
Jianliang Shen | c168e76 | 2022-01-19 11:31:07 +0800 | [diff] [blame] | 34 | # secure test services are required if any secure test is opened |
Jianliang Shen | e92ad19 | 2022-05-11 13:59:10 +0800 | [diff] [blame] | 35 | add_subdirectory(common_test_services/tfm_secure_client_service ${CMAKE_BINARY_DIR}/tf-m-tests/secure_client_srv) |
| 36 | add_subdirectory(common_test_services/tfm_secure_client_2 ${CMAKE_BINARY_DIR}/tf-m-tests/secure_client_2_srv) |
Jianliang Shen | c168e76 | 2022-01-19 11:31:07 +0800 | [diff] [blame] | 37 | |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 38 | add_library(tfm_test_framework_s INTERFACE) |
| 39 | add_library(tfm_s_tests INTERFACE) |
| 40 | |
| 41 | target_link_libraries(tfm_test_framework_s |
| 42 | INTERFACE |
| 43 | psa_interface |
| 44 | tfm_test_framework_common |
Kevin Peng | f0634da | 2022-08-08 11:26:04 +0800 | [diff] [blame] | 45 | tfm_sprt |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 46 | ) |
| 47 | |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 48 | target_compile_definitions(tfm_test_framework_s |
| 49 | INTERFACE |
| 50 | USE_SP_LOG |
| 51 | ) |
| 52 | |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 53 | target_sources(tfm_s_tests |
| 54 | INTERFACE |
Raef Coles | c7d8068 | 2021-05-26 14:20:31 +0100 | [diff] [blame] | 55 | ${CMAKE_CURRENT_SOURCE_DIR}/secure_suites.c |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 56 | ) |
| 57 | |
| 58 | target_link_libraries(tfm_s_tests |
| 59 | INTERFACE |
| 60 | tfm_test_framework_s |
| 61 | tfm_partition_defs |
| 62 | tfm_spm |
| 63 | ) |
| 64 | |
| 65 | target_compile_definitions(tfm_s_tests |
| 66 | INTERFACE |
| 67 | $<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS> |
| 68 | ) |
| 69 | |
| 70 | ############################# Secure tests ##################################### |
| 71 | |
| 72 | # Add secure test library targets here to inherit secure side configurations |
| 73 | if (TEST_S_CRYPTO) |
| 74 | add_library(tfm_test_suite_crypto_s STATIC EXCLUDE_FROM_ALL) |
| 75 | endif() |
| 76 | if (TEST_S_ATTESTATION) |
| 77 | add_library(tfm_test_suite_attestation_s STATIC EXCLUDE_FROM_ALL) |
| 78 | endif() |
| 79 | if (TEST_S_ITS) |
| 80 | add_library(tfm_test_suite_its_s STATIC EXCLUDE_FROM_ALL) |
| 81 | endif() |
| 82 | if (TEST_S_PS) |
| 83 | add_library(tfm_test_suite_ps_s STATIC EXCLUDE_FROM_ALL) |
| 84 | endif() |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 85 | if (TEST_S_PLATFORM) |
| 86 | add_library(tfm_test_suite_platform_s STATIC EXCLUDE_FROM_ALL) |
| 87 | endif() |
| 88 | if (TEST_S_IPC) |
| 89 | add_library(tfm_test_suite_ipc_s STATIC EXCLUDE_FROM_ALL) |
| 90 | endif() |
| 91 | if (TEST_S_FWU) |
| 92 | add_library(tfm_test_suite_fwu_s STATIC EXCLUDE_FROM_ALL) |
| 93 | endif() |
Feder Liang | db53c6b | 2021-09-07 15:42:09 +0800 | [diff] [blame] | 94 | if (TEST_S_FPU) |
| 95 | add_library(tfm_test_suite_fpu_s STATIC EXCLUDE_FROM_ALL) |
| 96 | endif() |
Jianliang Shen | b5fd67b | 2022-11-14 14:15:59 +0800 | [diff] [blame^] | 97 | if (EXTRA_S_TEST_SUITE_PATH) |
David Hu | cf299b1 | 2021-09-12 16:41:48 +0800 | [diff] [blame] | 98 | add_library(tfm_test_suite_extra_s STATIC EXCLUDE_FROM_ALL) |
| 99 | endif() |