Skip to content

Commit 9f32f4e

Browse files
committed
trusted-firmware-m: tf-m-tests: bump to upstream TF-Mv1.2-RC2
Synchronize the tf-m-test directory with the corresponding upstream repository up to commit ccda809801e529250b47c9ac470cf94daef1bb1b (TF-Mv1.2-RC2) Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent 862316c commit 9f32f4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+392
-658
lines changed

tf-m-tests/app/CMakeLists.txt

Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,41 +14,57 @@ project(tfm_ns LANGUAGES ASM C)
1414
# anything loaded from or declared in this dir.
1515
if (TFM_MULTI_CORE_TOPOLOGY)
1616
include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
17+
tfm_toolchain_reload_compiler()
1718
endif()
1819

1920
############################# PSA test integration #############################
2021

21-
if(TEST_PSA_API)
22-
set(SUITE ${TEST_PSA_API})
22+
if(TEST_PSA_API AND NOT PSA_ARCH_TESTS_BINARY_PATH)
23+
if(NOT SUITE)
24+
set(SUITE ${TEST_PSA_API})
25+
endif()
2326

2427
string(REGEX REPLACE ".*/" "" PSA_API_TEST_TARGET ${TFM_PLATFORM})
2528

26-
if (NOT "${TEST_PSA_API}" STREQUAL "IPC")
27-
set(TARGET tgt_dev_apis_tfm_${PSA_API_TEST_TARGET})
28-
else()
29-
set(TARGET tgt_ff_tfm_${PSA_API_TEST_TARGET})
29+
if(NOT TARGET)
30+
if (NOT "${TEST_PSA_API}" STREQUAL "IPC")
31+
set(TARGET tgt_dev_apis_tfm_${PSA_API_TEST_TARGET})
32+
else()
33+
set(TARGET tgt_ff_tfm_${PSA_API_TEST_TARGET})
34+
endif()
3035
endif()
3136

32-
set(PSA_INCLUDE_PATHS ${CMAKE_SOURCE_DIR}/interface/include/
33-
${PSA_ARCH_TESTS_PATH}/api-tests/platform/manifests/
34-
${CMAKE_BINARY_DIR}/generated/interface/include
35-
)
3637

37-
set(SP_HEAP_MEM_SUPP=0)
38-
set(PLATFORM_PSA_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL})
38+
if(NOT PSA_INCLUDE_PATHS)
39+
set(PSA_INCLUDE_PATHS ${CMAKE_SOURCE_DIR}/interface/include/
40+
${CMAKE_BINARY_DIR}/generated/api-tests/platform/manifests/
41+
${CMAKE_BINARY_DIR}/generated/interface/include
42+
)
43+
endif()
44+
45+
if(NOT SP_HEAP_MEM_SUPP)
46+
set(SP_HEAP_MEM_SUPP 0)
47+
endif()
48+
if(NOT PLATFORM_PSA_ISOLATION_LEVEL)
49+
set(PLATFORM_PSA_ISOLATION_LEVEL ${TFM_ISOLATION_LEVEL})
50+
endif()
3951

40-
if (${CMAKE_C_COMPILER_ID} STREQUAL GNU)
41-
set(TOOLCHAIN GNUARM)
42-
elseif (${CMAKE_C_COMPILER_ID} STREQUAL ARMClang)
43-
set(TOOLCHAIN ARMCLANG)
52+
if (NOT TOOLCHAIN)
53+
if (${CMAKE_C_COMPILER_ID} STREQUAL GNU)
54+
set(TOOLCHAIN GNUARM)
55+
elseif (${CMAKE_C_COMPILER_ID} STREQUAL ARMClang)
56+
set(TOOLCHAIN ARMCLANG)
57+
endif()
4458
endif()
4559

46-
if (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.main)
47-
set(CPU_ARCH armv8m_ml)
48-
elseif (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.base)
49-
set(CPU_ARCH armv8m_bl)
50-
elseif (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv7-m)
51-
set(CPU_ARCH armv7m)
60+
if (NOT CPU_ARCH)
61+
if (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.main)
62+
set(CPU_ARCH armv8m_ml)
63+
elseif (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv8-m.base)
64+
set(CPU_ARCH armv8m_bl)
65+
elseif (${CMAKE_SYSTEM_ARCHITECTURE} STREQUAL armv7-m)
66+
set(CPU_ARCH armv7m)
67+
endif()
5268
endif()
5369

5470
add_subdirectory(${PSA_ARCH_TESTS_PATH}/api-tests ${CMAKE_CURRENT_BINARY_DIR}/psa_api_tests)
@@ -74,7 +90,6 @@ target_link_libraries(tfm_ns_integration_test
7490
tfm_test_framework
7591
PRIVATE
7692
psa_interface
77-
$<TARGET_PROPERTY:platform_ns,PLATFORM_RTX_LIB_PATH>
7893
psa_api_ns
7994
CMSIS_5_tfm_ns
8095
)
@@ -105,6 +120,7 @@ target_link_libraries(tfm_ns
105120
$<$<BOOL:${TEST_PSA_API}>:test_combine>
106121
$<$<NOT:$<BOOL:${TFM_MULTI_CORE_TOPOLOGY}>>:tfm_s_veneers>
107122
psa_api_ns
123+
tfm_ns_log
108124
)
109125

110126
target_compile_definitions(tfm_ns
@@ -121,6 +137,7 @@ target_link_options(tfm_ns
121137
PRIVATE
122138
$<$<C_COMPILER_ID:GNU>:-Wl,-Map=${CMAKE_BINARY_DIR}/bin/tfm_ns.map>
123139
$<$<C_COMPILER_ID:ARMClang>:--map>
140+
$<$<C_COMPILER_ID:IAR>:--map\;${CMAKE_BINARY_DIR}/bin/tfm_ns.map>
124141
)
125142

126143
add_convert_to_bin_target(tfm_ns)

tf-m-tests/app/main_ns.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "tfm_multi_core_api.h"
2525
#include "tfm_ns_mailbox.h"
2626
#endif
27-
#include "log/tfm_assert.h"
2827
#include "tfm_log.h"
2928
#include "uart_stdout.h"
3029
#include "region.h"

tf-m-tests/app/tfm_log.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef __TFM_LOG_H__
99
#define __TFM_LOG_H__
1010

11-
#include "log/tfm_log_raw.h"
11+
#include "tfm_log_raw.h"
1212

1313
/* Functions and macros in this file is for 'thread mode' usage. */
1414

tf-m-tests/log/CMakeLists.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#-------------------------------------------------------------------------------
2+
# Copyright (c) 2020, Arm Limited. All rights reserved.
3+
#
4+
# SPDX-License-Identifier: BSD-3-Clause
5+
#
6+
#-------------------------------------------------------------------------------
7+
8+
cmake_minimum_required(VERSION 3.13)
9+
10+
# For multi-core projects, the NS app can be run on a different CPU to the
11+
# Secure code. To facilitate this, we once again reload the compiler to load the
12+
# setting for the NS CPU. Cmake settings are directory scoped so this affects
13+
# anything loaded from or declared in this dir.
14+
if (TFM_MULTI_CORE_TOPOLOGY)
15+
include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
16+
endif()
17+
18+
############################# Ns Log ###########################################
19+
add_library(tfm_ns_log STATIC EXCLUDE_FROM_ALL)
20+
21+
target_sources(tfm_ns_log
22+
PRIVATE
23+
tfm_log_raw.c
24+
)
25+
26+
target_include_directories(tfm_ns_log
27+
PUBLIC
28+
.
29+
)
30+
31+
target_link_libraries(tfm_ns_log
32+
PRIVATE
33+
platform_ns
34+
)

tf-m-tests/test/CMakeLists.txt

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ add_library(tfm_test_framework INTERFACE)
1616
# anything loaded from or declared in this dir.
1717
if (TFM_MULTI_CORE_TOPOLOGY)
1818
include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
19+
tfm_toolchain_reload_compiler()
1920
endif()
2021

2122
add_subdirectory(test_services)
@@ -51,6 +52,7 @@ target_include_directories(tfm_test_framework
5152
target_link_libraries(tfm_test_framework
5253
INTERFACE
5354
psa_interface
55+
tfm_ns_log
5456
)
5557

5658
target_sources(tfm_ns_tests
@@ -67,18 +69,27 @@ target_link_libraries(tfm_ns_tests
6769
target_compile_definitions(tfm_ns_tests
6870
INTERFACE
6971
$<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
72+
$<$<BOOL:${TFM_INTERACTIVE_TEST}>:CORE_TEST_INTERACTIVE>
73+
$<$<BOOL:${TFM_MULTI_CORE_MULTI_CLIENT_CALL}>:TFM_MULTI_CORE_MULTI_CLIENT_CALL>
7074
)
7175

7276
####################### Secure #################################################
7377

74-
target_sources(tfm_s_tests
75-
INTERFACE
76-
${CMAKE_CURRENT_SOURCE_DIR}/framework/secure_suites.c
77-
)
78+
if (TEST_S)
79+
target_sources(tfm_s_tests
80+
INTERFACE
81+
${CMAKE_CURRENT_SOURCE_DIR}/framework/secure_suites.c
82+
)
7883

79-
target_link_libraries(tfm_s_tests
80-
INTERFACE
81-
tfm_test_framework
82-
tfm_partition_defs
83-
tfm_spm
84-
)
84+
target_link_libraries(tfm_s_tests
85+
INTERFACE
86+
tfm_test_framework
87+
tfm_partition_defs
88+
tfm_spm
89+
)
90+
91+
target_compile_definitions(tfm_s_tests
92+
INTERFACE
93+
$<$<BOOL:${PS_TEST_NV_COUNTERS}>:PS_TEST_NV_COUNTERS>
94+
)
95+
endif()

tf-m-tests/test/TestConfig.cmake

Lines changed: 0 additions & 48 deletions
This file was deleted.

tf-m-tests/test/framework/non_secure_suites.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,8 @@ static struct test_suite_t test_suites[] = {
8181
{&register_testsuite_ns_audit_interface, 0, 0, 0},
8282
#endif
8383

84-
#ifdef CORE_TEST_POSITIVE
85-
/* Non-secure core test cases */
86-
{&register_testsuite_ns_core_positive, 0, 0, 0},
87-
#endif
84+
/* Non-secure core test cases */
85+
{&register_testsuite_ns_core_positive, 0, 0, 0},
8886

8987
#ifdef CORE_TEST_INTERACTIVE
9088
/* Non-secure interactive test cases */

tf-m-tests/test/framework/secure_suites.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ static struct test_suite_t test_suites[] = {
7070
{&register_testsuite_s_audit_interface, 0, 0, 0},
7171
#endif
7272

73-
#ifdef ENABLE_IPC_TEST
73+
#ifdef TFM_PSA_API
7474
/* Secure IPC test cases */
7575
{&register_testsuite_s_ipc_interface, 0, 0, 0},
7676
#endif

tf-m-tests/test/framework/test_framework.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <stdint.h>
1313
#include <stdio.h>
1414

15-
#include "log/tfm_log_raw.h"
15+
#include "tfm_log_raw.h"
1616
#include "test_framework_helpers.h"
1717

1818
#ifdef __cplusplus

tf-m-tests/test/suites/attestation/CMakeLists.txt

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -58,42 +58,44 @@ target_link_libraries(tfm_ns_tests
5858

5959
####################### Secure #################################################
6060

61-
target_sources(tfm_test_suite_attestation_s
62-
PRIVATE
63-
${CMAKE_CURRENT_SOURCE_DIR}/attest_public_key.c
64-
${CMAKE_CURRENT_SOURCE_DIR}/attest_token_test.c
65-
${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_common.c
66-
$<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_symmetric.c>
67-
$<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:${CMAKE_CURRENT_SOURCE_DIR}/secure/attest_symmetric_s_interface_testsuite.c>
68-
$<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_asymmetric.c>
69-
$<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/secure/attest_asymmetric_s_interface_testsuite.c>
70-
)
61+
if (TEST_S)
62+
target_sources(tfm_test_suite_attestation_s
63+
PRIVATE
64+
${CMAKE_CURRENT_SOURCE_DIR}/attest_public_key.c
65+
${CMAKE_CURRENT_SOURCE_DIR}/attest_token_test.c
66+
${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_common.c
67+
$<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_symmetric.c>
68+
$<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:${CMAKE_CURRENT_SOURCE_DIR}/secure/attest_symmetric_s_interface_testsuite.c>
69+
$<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/attest_token_decode_asymmetric.c>
70+
$<$<NOT:$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>>:${CMAKE_CURRENT_SOURCE_DIR}/secure/attest_asymmetric_s_interface_testsuite.c>
71+
)
7172

72-
target_include_directories(tfm_test_suite_attestation_s
73-
PUBLIC
74-
${CMAKE_CURRENT_SOURCE_DIR}/secure
75-
PRIVATE
76-
${CMAKE_CURRENT_SOURCE_DIR}
77-
)
73+
target_include_directories(tfm_test_suite_attestation_s
74+
PUBLIC
75+
${CMAKE_CURRENT_SOURCE_DIR}/secure
76+
PRIVATE
77+
${CMAKE_CURRENT_SOURCE_DIR}
78+
)
7879

79-
target_compile_definitions(tfm_test_suite_attestation_s
80-
PRIVATE
81-
$<$<CONFIG:Debug>:INCLUDE_TEST_CODE>
82-
$<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
83-
)
80+
target_compile_definitions(tfm_test_suite_attestation_s
81+
PRIVATE
82+
$<$<CONFIG:Debug>:INCLUDE_TEST_CODE>
83+
$<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
84+
)
8485

85-
target_link_libraries(tfm_test_suite_attestation_s
86-
PRIVATE
87-
tfm_qcbor
88-
tfm_t_cose
89-
tfm_test_framework
90-
tfm_partition_attestation
91-
tfm_boot_status
92-
tfm_partition_crypto
93-
platform_s
94-
)
86+
target_link_libraries(tfm_test_suite_attestation_s
87+
PRIVATE
88+
tfm_qcbor
89+
tfm_t_cose
90+
tfm_test_framework
91+
tfm_partition_attestation
92+
tfm_boot_status
93+
tfm_partition_crypto
94+
platform_s
95+
)
9596

96-
target_link_libraries(tfm_s_tests
97-
INTERFACE
98-
tfm_test_suite_attestation_s
99-
)
97+
target_link_libraries(tfm_s_tests
98+
INTERFACE
99+
tfm_test_suite_attestation_s
100+
)
101+
endif()

0 commit comments

Comments
 (0)