Test: fix secure test client partition
This change is necessary to execute test cases in the secure
test client partition in case of TFM_LVL==3:
- rename files in test/framework folder, prefix was added
- add missing files to test client partition in linker scripts
- add execution region for secure test client partition in
Musca A1 linker config file
- update affected files due to renaming
Change-Id: If9605ad65daf4341d3e520ae69ba4d9d7f31415c
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
diff --git a/app/main_ns.c b/app/main_ns.c
index e506867..f1ffc19 100644
--- a/app/main_ns.c
+++ b/app/main_ns.c
@@ -15,7 +15,7 @@
#include "tfm_integ_test.h"
#include "tfm_ns_lock.h"
#ifdef TEST_FRAMEWORK_NS
-#include "test/framework/integ_test.h"
+#include "test/framework/test_framework_integ_test.h"
#endif
#include "target_cfg.h"
diff --git a/app/tfm_integ_test.c b/app/tfm_integ_test.c
index a72d0c4..e7b518a 100644
--- a/app/tfm_integ_test.c
+++ b/app/tfm_integ_test.c
@@ -15,7 +15,7 @@
#include "cmsis_os2.h"
#include "tfm_integ_test.h"
-#include "test/framework/integ_test.h"
+#include "test/framework/test_framework_integ_test.h"
#ifdef TEST_FRAMEWORK_S
#include \
diff --git a/docs/user_guides/tfm_integration_guide.md b/docs/user_guides/tfm_integration_guide.md
index 3505dde..93182eb 100755
--- a/docs/user_guides/tfm_integration_guide.md
+++ b/docs/user_guides/tfm_integration_guide.md
@@ -80,8 +80,8 @@
#### interface with non-secure world regression tests
A non-secure application that wants to run the non-secure regression tests
needs to call the `tfm_non_secure_client_run_tests()`. This function is
-exported into the header file `integ_test.h` inside the `<build_dir>/install`
-folder structure in the test specific files, i.e.
+exported into the header file `test_framework_integ_test.h` inside the
+`<build_dir>/install` folder structure in the test specific files, i.e.
`<build_dir>/install/export/tfm/test/inc`. The non-secure regression tests are
precompiled and delivered as a static library which is available in
`<build_dir>/install/export/tfm/test/lib`, so that the non-secure application
diff --git a/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct b/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
index 1648598..40ce046 100644
--- a/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
+++ b/platform/ext/target/mps2/an519/armclang/mps2_an519_s.sct
@@ -77,6 +77,8 @@
#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
TFM_SP_SECURE_TEST_PARTITION +0 ALIGN 32 {
*tfm_secure_client_service.* (+RO)
+ *test_framework* (+RO)
+ *secure_suites.* (+RO)
}
#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
@@ -135,7 +137,9 @@
#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
TFM_SP_SECURE_TEST_PARTITION_DATA +0 ALIGN 32 {
- tfm_secure_client_service.o (+RW +ZI)
+ *tfm_secure_client_service.* (+RW +ZI)
+ *test_framework* (+RW +ZI)
+ *secure_suites.* (+RW +ZI)
}
TFM_SP_SECURE_TEST_PARTITION_STACK +0 ALIGN 128 EMPTY 0x2000 {
diff --git a/platform/ext/target/mps2/an519/gcc/mps2_an519_s.ld b/platform/ext/target/mps2/an519/gcc/mps2_an519_s.ld
index 4a005b7..fff3219 100644
--- a/platform/ext/target/mps2/an519/gcc/mps2_an519_s.ld
+++ b/platform/ext/target/mps2/an519/gcc/mps2_an519_s.ld
@@ -247,7 +247,11 @@
.TFM_SP_SECURE_TEST_PARTITION : ALIGN(32)
{
*tfm_secure_client_service.*(.text*)
+ *test_framework*(.text*)
+ *secure_suites.*(.text*)
*tfm_secure_client_service.*(.rodata*)
+ *test_framework*(.rodata*)
+ *secure_suites.*(.rodata*)
. = ALIGN(32);
} > FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION$$RO$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION);
@@ -478,6 +482,8 @@
.TFM_SP_SECURE_TEST_PARTITION_DATA : ALIGN(32)
{
*tfm_secure_client_service.*(.data*)
+ *test_framework*(.data*)
+ *secure_suites.*(.data*)
. = ALIGN(32);
} > RAM AT> FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION_DATA$$RW$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION_DATA);
@@ -486,7 +492,11 @@
.TFM_SP_SECURE_TEST_PARTITION_BSS : ALIGN(32)
{
*tfm_secure_client_service.*(.bss*)
+ *test_framework*(.bss*)
+ *secure_suites.*(.bss*)
*tfm_secure_client_service.*(COMMON)
+ *test_framework*(COMMON)
+ *secure_suites.*(COMMON)
. = ALIGN(32);
} > RAM AT> FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION_DATA$$ZI$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION_BSS);
diff --git a/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct b/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
index 73d4109..bc7a3b5 100644
--- a/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
+++ b/platform/ext/target/mps2/an521/armclang/mps2_an521_s.sct
@@ -77,6 +77,8 @@
#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
TFM_SP_SECURE_TEST_PARTITION +0 ALIGN 32 {
*tfm_secure_client_service.* (+RO)
+ *test_framework* (+RO)
+ *secure_suites.* (+RO)
}
#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
@@ -135,7 +137,9 @@
#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
TFM_SP_SECURE_TEST_PARTITION_DATA +0 ALIGN 32 {
- tfm_secure_client_service.o (+RW +ZI)
+ *tfm_secure_client_service.* (+RW +ZI)
+ *test_framework* (+RW +ZI)
+ *secure_suites.* (+RW +ZI)
}
TFM_SP_SECURE_TEST_PARTITION_STACK +0 ALIGN 128 EMPTY 0x2000 {
diff --git a/platform/ext/target/mps2/an521/gcc/mps2_an521_s.ld b/platform/ext/target/mps2/an521/gcc/mps2_an521_s.ld
index 1ba884d..503dfee 100644
--- a/platform/ext/target/mps2/an521/gcc/mps2_an521_s.ld
+++ b/platform/ext/target/mps2/an521/gcc/mps2_an521_s.ld
@@ -247,7 +247,11 @@
.TFM_SP_SECURE_TEST_PARTITION : ALIGN(32)
{
*tfm_secure_client_service.*(.text*)
+ *test_framework*(.text*)
+ *secure_suites.*(.text*)
*tfm_secure_client_service.*(.rodata*)
+ *test_framework*(.rodata*)
+ *secure_suites.*(.rodata*)
. = ALIGN(32);
} > FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION$$RO$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION);
@@ -478,6 +482,8 @@
.TFM_SP_SECURE_TEST_PARTITION_DATA : ALIGN(32)
{
*tfm_secure_client_service.*(.data*)
+ *test_framework*(.data*)
+ *secure_suites.*(.data*)
. = ALIGN(32);
} > RAM AT> FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION_DATA$$RW$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION_DATA);
@@ -486,7 +492,11 @@
.TFM_SP_SECURE_TEST_PARTITION_BSS : ALIGN(32)
{
*tfm_secure_client_service.*(.bss*)
+ *test_framework*(.bss*)
+ *secure_suites.*(.bss*)
*tfm_secure_client_service.*(COMMON)
+ *test_framework*(COMMON)
+ *secure_suites.*(COMMON)
. = ALIGN(32);
} > RAM AT> FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION_DATA$$ZI$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION_BSS);
diff --git a/platform/ext/target/musca_a/Device/Source/armclang/musca_s.sct b/platform/ext/target/musca_a/Device/Source/armclang/musca_s.sct
index 46fff6d..f81cace 100755
--- a/platform/ext/target/musca_a/Device/Source/armclang/musca_s.sct
+++ b/platform/ext/target/musca_a/Device/Source/armclang/musca_s.sct
@@ -74,6 +74,15 @@
}
#endif /* TFM_PARTITION_TEST_SST */
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+ TFM_SP_SECURE_TEST_PARTITION +0 ALIGN 32 {
+ *tfm_secure_client_service.* (+RO)
+ *test_framework* (+RO)
+ *secure_suites.* (+RO)
+
+ }
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
ER_TFM_DATA S_DATA_START S_DATA_SIZE {
.ANY (+RW +ZI)
}
@@ -127,6 +136,17 @@
}
#endif /* TFM_PARTITION_TEST_SST */
+#ifdef TFM_PARTITION_TEST_SECURE_SERVICES
+ TFM_SP_SECURE_TEST_PARTITION_DATA +0 ALIGN 32 {
+ *tfm_secure_client_service.* (+RW +ZI)
+ *test_framework* (+RW +ZI)
+ *secure_suites.* (+RW +ZI)
+ }
+
+ TFM_SP_SECURE_TEST_PARTITION_STACK +0 ALIGN 128 EMPTY 0x2000 {
+ }
+#endif /* TFM_PARTITION_TEST_SECURE_SERVICES */
+
#endif /* TFM_LVL == 1 */
}
diff --git a/platform/ext/target/musca_a/Device/Source/gcc/musca_s.ld b/platform/ext/target/musca_a/Device/Source/gcc/musca_s.ld
index 4a005b7..fff3219 100644
--- a/platform/ext/target/musca_a/Device/Source/gcc/musca_s.ld
+++ b/platform/ext/target/musca_a/Device/Source/gcc/musca_s.ld
@@ -247,7 +247,11 @@
.TFM_SP_SECURE_TEST_PARTITION : ALIGN(32)
{
*tfm_secure_client_service.*(.text*)
+ *test_framework*(.text*)
+ *secure_suites.*(.text*)
*tfm_secure_client_service.*(.rodata*)
+ *test_framework*(.rodata*)
+ *secure_suites.*(.rodata*)
. = ALIGN(32);
} > FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION$$RO$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION);
@@ -478,6 +482,8 @@
.TFM_SP_SECURE_TEST_PARTITION_DATA : ALIGN(32)
{
*tfm_secure_client_service.*(.data*)
+ *test_framework*(.data*)
+ *secure_suites.*(.data*)
. = ALIGN(32);
} > RAM AT> FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION_DATA$$RW$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION_DATA);
@@ -486,7 +492,11 @@
.TFM_SP_SECURE_TEST_PARTITION_BSS : ALIGN(32)
{
*tfm_secure_client_service.*(.bss*)
+ *test_framework*(.bss*)
+ *secure_suites.*(.bss*)
*tfm_secure_client_service.*(COMMON)
+ *test_framework*(COMMON)
+ *secure_suites.*(COMMON)
. = ALIGN(32);
} > RAM AT> FLASH
Image$$TFM_SP_SECURE_TEST_PARTITION_DATA$$ZI$$Base = ADDR(.TFM_SP_SECURE_TEST_PARTITION_BSS);
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ec21476..5202ef8 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -74,7 +74,7 @@
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Default install location for tfm_storage." FORCE)
endif()
-install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/framework/integ_test.h
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/framework/test_framework_integ_test.h
${CMAKE_CURRENT_SOURCE_DIR}/suites/sst/non_secure/os_wrapper.h
${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_sst_test_service/sst_test_service.h
${CMAKE_CURRENT_SOURCE_DIR}/test_services/tfm_secure_client_service/tfm_secure_client_service.h
diff --git a/test/framework/CMakeLists.inc b/test/framework/CMakeLists.inc
index 0f22dbc..d8abf61 100644
--- a/test/framework/CMakeLists.inc
+++ b/test/framework/CMakeLists.inc
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2017, Arm Limited. All rights reserved.
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -24,8 +24,8 @@
message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
endif()
-set (TEST_FRAMEWORK_C_SRC "${TEST_FRAMEWORK_DIR}/helpers.c"
- "${TEST_FRAMEWORK_DIR}/integ_test_helper.c"
+set (TEST_FRAMEWORK_C_SRC "${TEST_FRAMEWORK_DIR}/test_framework_helpers.c"
+ "${TEST_FRAMEWORK_DIR}/test_framework_integ_test_helper.c"
"${TEST_FRAMEWORK_DIR}/test_framework.c"
)
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index 51ed186..4b11386 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -5,8 +5,8 @@
*
*/
-#include "integ_test.h"
-#include "integ_test_helper.h"
+#include "test_framework_integ_test.h"
+#include "test_framework_integ_test_helper.h"
#include "test_framework.h"
/* Service specific includes */
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
index 63f0e96..9205e99 100644
--- a/test/framework/secure_suites.c
+++ b/test/framework/secure_suites.c
@@ -5,8 +5,8 @@
*
*/
-#include "integ_test.h"
-#include "integ_test_helper.h"
+#include "test_framework_integ_test.h"
+#include "test_framework_integ_test_helper.h"
#include "test_framework.h"
/* Service specific includes */
@@ -28,7 +28,7 @@
/* Secure invert test cases */
/* Note: since this is sample code, only run if test services are enabled */
{®ister_testsuite_s_invert_interface, 0, 0, 0},
-#endif
+#endif /* TFM_PARTITION_TEST_CORE*/
#endif /* SERVICES_TEST_S */
};
diff --git a/test/framework/test_framework.c b/test/framework/test_framework.c
index fcb7451..e991dd4 100644
--- a/test/framework/test_framework.c
+++ b/test/framework/test_framework.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,8 +12,6 @@
#include <stdlib.h>
#include <string.h>
-#include "helpers.h"
-
static void test_failed(const struct test_result_t *ret)
{
printf_set_color(RED);
diff --git a/test/framework/test_framework.h b/test/framework/test_framework.h
index 4716d43..a2b64c4 100644
--- a/test/framework/test_framework.h
+++ b/test/framework/test_framework.h
@@ -11,7 +11,7 @@
#include <stdarg.h>
#include <stdint.h>
-#include "helpers.h"
+#include "test_framework_helpers.h"
#ifdef __cplusplus
extern "C" {
diff --git a/test/framework/helpers.c b/test/framework/test_framework_helpers.c
similarity index 97%
rename from test/framework/helpers.c
rename to test/framework/test_framework_helpers.c
index be2d188..d9870f4 100755
--- a/test/framework/helpers.c
+++ b/test/framework/test_framework_helpers.c
@@ -5,7 +5,7 @@
*
*/
-#include "helpers.h"
+#include "test_framework_helpers.h"
#include <stdio.h>
diff --git a/test/framework/helpers.h b/test/framework/test_framework_helpers.h
similarity index 100%
rename from test/framework/helpers.h
rename to test/framework/test_framework_helpers.h
diff --git a/test/framework/integ_test.h b/test/framework/test_framework_integ_test.h
similarity index 100%
rename from test/framework/integ_test.h
rename to test/framework/test_framework_integ_test.h
diff --git a/test/framework/integ_test_helper.c b/test/framework/test_framework_integ_test_helper.c
similarity index 91%
rename from test/framework/integ_test_helper.c
rename to test/framework/test_framework_integ_test_helper.c
index 264b197..ac7021e 100644
--- a/test/framework/integ_test_helper.c
+++ b/test/framework/test_framework_integ_test_helper.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, Arm Limited. All rights reserved.
+ * Copyright (c) 2017-2018, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#include <stdio.h>
#include "test_framework.h"
-#include "integ_test_helper.h"
+#include "test_framework_integ_test_helper.h"
void integ_test(const char *suite_type,
struct test_suite_t test_suites[],
diff --git a/test/framework/integ_test_helper.h b/test/framework/test_framework_integ_test_helper.h
similarity index 100%
rename from test/framework/integ_test_helper.h
rename to test/framework/test_framework_integ_test_helper.h
diff --git a/test/suites/audit/non_secure/audit_ns_interface_testsuite.c b/test/suites/audit/non_secure/audit_ns_interface_testsuite.c
index 2391f18..ee8a187 100644
--- a/test/suites/audit/non_secure/audit_ns_interface_testsuite.c
+++ b/test/suites/audit/non_secure/audit_ns_interface_testsuite.c
@@ -5,7 +5,7 @@
*
*/
-#include "test/framework/helpers.h"
+#include "test/framework/test_framework_helpers.h"
#include "psa_audit_api.h"
#include "audit_ns_tests.h"
#include "tfm_api.h"
diff --git a/test/suites/audit/secure/audit_s_interface_testsuite.c b/test/suites/audit/secure/audit_s_interface_testsuite.c
index 847ab9b..74777e3 100644
--- a/test/suites/audit/secure/audit_s_interface_testsuite.c
+++ b/test/suites/audit/secure/audit_s_interface_testsuite.c
@@ -5,7 +5,7 @@
*
*/
-#include "test/framework/helpers.h"
+#include "test/framework/test_framework_helpers.h"
#include "psa_audit_api.h"
#include "audit_s_tests.h"
#include "tfm_api.h"
diff --git a/test/suites/sst/non_secure/sst_ns_interface_testsuite.c b/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
index 1200652..0c817ec 100644
--- a/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
+++ b/test/suites/sst/non_secure/sst_ns_interface_testsuite.c
@@ -12,7 +12,7 @@
#include "ns_test_helpers.h"
#include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
-#include "test/framework/helpers.h"
+#include "test/framework/test_framework_helpers.h"
#include "psa_sst_api.h"
/* Test suite defines */
diff --git a/test/suites/sst/non_secure/sst_ns_ref_access_testsuite.c b/test/suites/sst/non_secure/sst_ns_ref_access_testsuite.c
index 02f5c22..9def7a4 100644
--- a/test/suites/sst/non_secure/sst_ns_ref_access_testsuite.c
+++ b/test/suites/sst/non_secure/sst_ns_ref_access_testsuite.c
@@ -11,7 +11,7 @@
#include "ns_test_helpers.h"
#include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
-#include "test/framework/helpers.h"
+#include "test/framework/test_framework_helpers.h"
#include "test/test_services/tfm_sst_test_service/sst_test_service_api.h"
#define DATA "TEST_DATA_ONE_TWO_THREE_FOUR_FIVE"
diff --git a/test/suites/sst/non_secure/sst_policy_testsuite.c b/test/suites/sst/non_secure/sst_policy_testsuite.c
index 3684773..01ac1d6 100644
--- a/test/suites/sst/non_secure/sst_policy_testsuite.c
+++ b/test/suites/sst/non_secure/sst_policy_testsuite.c
@@ -11,7 +11,7 @@
#include "ns_test_helpers.h"
#include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
-#include "test/framework/helpers.h"
+#include "test/framework/test_framework_helpers.h"
#include "psa_sst_api.h"
/* Define default asset's token */
diff --git a/test/suites/sst/secure/sst_reliability_testsuite.c b/test/suites/sst/secure/sst_reliability_testsuite.c
index 5d1861b..6155e87 100644
--- a/test/suites/sst/secure/sst_reliability_testsuite.c
+++ b/test/suites/sst/secure/sst_reliability_testsuite.c
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <string.h>
-#include "test/framework/helpers.h"
+#include "test/framework/test_framework_helpers.h"
#include "tfm_sst_defs.h"
#include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
#include "psa_sst_api.h"
diff --git a/test/suites/sst/secure/sst_sec_interface_testsuite.c b/test/suites/sst/secure/sst_sec_interface_testsuite.c
index 090a509..ba206a4 100644
--- a/test/suites/sst/secure/sst_sec_interface_testsuite.c
+++ b/test/suites/sst/secure/sst_sec_interface_testsuite.c
@@ -10,7 +10,7 @@
#include <stdio.h>
#include <string.h>
-#include "test/framework/helpers.h"
+#include "test/framework/test_framework_helpers.h"
#include "secure_fw/services/secure_storage/assets/sst_asset_defs.h"
#include "secure_fw/services/secure_storage/sst_object_system.h"
#include "psa_sst_api.h"
diff --git a/test/test_services/tfm_secure_client_service/manifest.yaml b/test/test_services/tfm_secure_client_service/manifest.yaml
index 5ac8119..af9b143 100644
--- a/test/test_services/tfm_secure_client_service/manifest.yaml
+++ b/test/test_services/tfm_secure_client_service/manifest.yaml
@@ -31,7 +31,9 @@
],
"tfm_linker_pattern": {
"object_list": [
- "*tfm_secure_client_service.*"
+ "*tfm_secure_client_service.*",
+ "*test_framework*",
+ "*secure_suites.*",
]
}
}
diff --git a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
index 2ad3044..b17f6f3 100644
--- a/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
+++ b/test/test_services/tfm_secure_client_service/tfm_secure_client_service.c
@@ -6,7 +6,7 @@
*/
#include "tfm_secure_client_service.h"
-#include "test/framework/integ_test.h"
+#include "test/framework/test_framework_integ_test.h"
/**
* \brief Service initialisation function. No special initialisation is