Test: Add build config which support level 3 isolation
Before this change only the core test suit was executed with level 3
isolation. From now regression test cases which compliant with
TFM_LVL 3 isolation can be executed with this setting.
Change-Id: Iddc376384583590cef4e47209b779f55d73ff41b
Signed-off-by: Tamas Ban <tamas.ban@arm.com>
diff --git a/CommonConfig.cmake b/CommonConfig.cmake
index 4a198ef..78993f6 100755
--- a/CommonConfig.cmake
+++ b/CommonConfig.cmake
@@ -11,6 +11,8 @@
message(FATAL_ERROR "ERROR: Incomplete Configuration: CORE_TEST not defined, Include this file from a Config*.cmake")
elseif(NOT DEFINED BL2)
message(FATAL_ERROR "ERROR: Incomplete Configuration: BL2 not defined, Include this file from a Config*.cmake")
+elseif(NOT DEFINED TFM_LVL)
+ message(FATAL_ERROR "ERROR: Incomplete Configuration: TFM_LVL not defined, Include this file from a Config*.cmake")
endif()
if(NOT DEFINED COMPILER)
@@ -94,6 +96,7 @@
set (TEST_FRAMEWORK_S OFF)
set (REFERENCE_PLATFORM OFF)
set (TFM_PARTITION_TEST_SECURE_SERVICES OFF)
+set (SERVICES_TEST_ENABLED OFF)
if(${TARGET_PLATFORM} STREQUAL "AN521" OR ${TARGET_PLATFORM} STREQUAL "AN519")
set (REFERENCE_PLATFORM ON)
@@ -104,13 +107,8 @@
# Option to demonstrate usage of secure-only peripheral
set (SECURE_UART1 OFF)
-# TF-M isolation level: 1..3, default is 1
-set (TFM_LVL 1)
-
if (REGRESSION)
set(SERVICES_TEST_ENABLED ON)
-else()
- set(SERVICES_TEST_ENABLED OFF)
endif()
if (SERVICES_TEST_ENABLED)
@@ -124,7 +122,6 @@
if (CORE_TEST)
set(CORE_TEST_POSITIVE ON)
set(CORE_TEST_INTERACTIVE OFF)
- set(TFM_LVL 3)
endif()
if (CORE_TEST_INTERACTIVE)
@@ -144,12 +141,12 @@
add_definitions(-DTFM_PARTITION_TEST_SECURE_SERVICES)
set(TEST_FRAMEWORK_S ON)
set(TFM_PARTITION_TEST_SECURE_SERVICES ON)
+ set(TFM_PARTITION_TEST_SST ON)
endif()
if (SERVICE_TEST_NS)
add_definitions(-DSERVICES_TEST_NS)
set(TEST_FRAMEWORK_NS ON)
- set(TFM_PARTITION_TEST_SST ON)
endif()
if (TEST_FRAMEWORK_S)
diff --git a/ConfigCoreTest.cmake b/ConfigCoreTest.cmake
index 34c901a..7bdb4eb 100644
--- a/ConfigCoreTest.cmake
+++ b/ConfigCoreTest.cmake
@@ -25,6 +25,9 @@
set (REGRESSION False)
set (CORE_TEST True)
+# TF-M isolation level: 1..3
+set (TFM_LVL 3)
+
#BL2 bootloader(MCUBoot) related settings
if(NOT DEFINED BL2)
set(BL2 True)
diff --git a/ConfigDefault.cmake b/ConfigDefault.cmake
index 360e648..476d6a6 100755
--- a/ConfigDefault.cmake
+++ b/ConfigDefault.cmake
@@ -27,6 +27,9 @@
set (REGRESSION False)
set (CORE_TEST False)
+# TF-M isolation level: 1..3
+set (TFM_LVL 1)
+
#BL2 bootloader(MCUBoot) related settings
if(NOT DEFINED BL2)
set(BL2 True)
diff --git a/ConfigRegression.cmake b/ConfigRegression.cmake
index 306d850..f0c80da 100755
--- a/ConfigRegression.cmake
+++ b/ConfigRegression.cmake
@@ -27,6 +27,9 @@
set (REGRESSION True)
set (CORE_TEST False)
+# TF-M isolation level: 1..3
+set (TFM_LVL 1)
+
#BL2 bootloader(MCUBoot) related settings
if(NOT DEFINED BL2)
set(BL2 True)
diff --git a/ConfigRegressionTfmLevel3.cmake b/ConfigRegressionTfmLevel3.cmake
new file mode 100644
index 0000000..a12b32e
--- /dev/null
+++ b/ConfigRegressionTfmLevel3.cmake
@@ -0,0 +1,37 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017-2018, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file holds information of a specific build configuration of this project.
+
+#Include board specific config (CPU, etc...), select platform specific build
+#system settings file
+if(NOT DEFINED TARGET_PLATFORM)
+ message(FATAL_ERROR "ERROR: TARGET_PLATFORM is not set in command line")
+elseif(${TARGET_PLATFORM} STREQUAL "AN521")
+ set(PLATFORM_CMAKE_FILE "${CMAKE_CURRENT_LIST_DIR}/platform/ext/Mps2AN521.cmake")
+elseif(${TARGET_PLATFORM} STREQUAL "AN519")
+ set (PLATFORM_CMAKE_FILE "${CMAKE_CURRENT_LIST_DIR}/platform/ext/Mps2AN519.cmake")
+elseif(${TARGET_PLATFORM} STREQUAL "MUSCA_A")
+ set(PLATFORM_CMAKE_FILE "${CMAKE_CURRENT_LIST_DIR}/platform/ext/musca_a.cmake")
+else()
+ message(FATAL_ERROR "ERROR: Target \"${TARGET_PLATFORM}\" is not supported.")
+endif()
+
+##These variables select how the projects are built. Each project will set
+#various project specific settings (e.g. what files to build, macro
+#definitions) based on these.
+set (REGRESSION True)
+set (CORE_TEST False)
+
+# TF-M isolation level: 1..3
+set (TFM_LVL 3)
+
+#BL2 bootloader(MCUBoot) related settings
+set (BL2 True)
+set (MCUBOOT_NO_SWAP False)
+
+include ("${CMAKE_CURRENT_LIST_DIR}/CommonConfig.cmake")
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 27a50d8..1cf33e5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -69,7 +69,7 @@
config_setting_shared_compiler_flags(tfm_non_secure_tests)
config_setting_shared_linker_flags(tfm_non_secure_tests)
-embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 __DOMAIN_NS=1 APPEND)
+embedded_set_target_compile_defines(TARGET tfm_non_secure_tests LANGUAGE C DEFINES __thumb2__ __ARM_FEATURE_CMSE=3 __DOMAIN_NS=1 TFM_LVL=${TFM_LVL} APPEND)
#__DOMAIN_NS=1
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index 4b11386..ae87e94 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -16,7 +16,21 @@
#include "test/suites/core/non_secure/core_ns_tests.h"
static struct test_suite_t test_suites[] = {
+#if TFM_LVL == 3
#ifdef SERVICES_TEST_NS
+ /* List test cases which compliant with level 3 isolation */
+
+#ifdef TFM_PARTITION_TEST_CORE
+ /* Non-secure invert test cases */
+ /* Note: since this is sample code, only run if test services are enabled */
+ {®ister_testsuite_ns_invert_interface, 0, 0, 0},
+#endif
+#endif /* SERVICES_TEST_NS */
+
+#else /* TFM_LVL == 3 */
+
+#ifdef SERVICES_TEST_NS
+ /* List test cases which compliant with level 1 isolation */
/* Non-secure SST test cases */
{®ister_testsuite_ns_sst_interface, 0, 0, 0},
{®ister_testsuite_ns_sst_policy, 0, 0, 0},
@@ -34,7 +48,8 @@
/* Note: since this is sample code, only run if test services are enabled */
{®ister_testsuite_ns_invert_interface, 0, 0, 0},
#endif
-#endif
+#endif /* SERVICES_TEST_NS */
+#endif /* TFM_LVL == 3 */
#ifdef CORE_TEST_POSITIVE
/* Non-secure core test cases */
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
index 9205e99..3ed95dd 100644
--- a/test/framework/secure_suites.c
+++ b/test/framework/secure_suites.c
@@ -16,7 +16,15 @@
#include "secure_fw/services/secure_storage/sst_object_system.h"
static struct test_suite_t test_suites[] = {
+#if TFM_LVL == 3
#ifdef SERVICES_TEST_S
+ /* List test cases which compliant with level 3 isolation */
+#endif /* SERVICES_TEST_S */
+
+#else /* TFM_LVL == 3 */
+
+#ifdef SERVICES_TEST_S
+ /* List test cases which compliant with level 1 isolation */
/* Secure SST test cases */
{®ister_testsuite_s_sst_sec_interface, 0, 0, 0},
{®ister_testsuite_s_sst_reliability, 0, 0, 0},
@@ -30,6 +38,7 @@
{®ister_testsuite_s_invert_interface, 0, 0, 0},
#endif /* TFM_PARTITION_TEST_CORE*/
#endif /* SERVICES_TEST_S */
+#endif /* TFM_LVL == 3 */
};
static void setup_integ_test(void)
@@ -39,12 +48,14 @@
*/
}
+#if TFM_LVL == 1
static void tear_down_integ_test(void)
{
/* Leave the SST area clean after execute the tests */
sst_system_wipe_all();
sst_system_prepare();
}
+#endif /* TFM_LVL == 1 */
void start_integ_test(void)
{
@@ -52,5 +63,7 @@
integ_test("Secure",
test_suites,
sizeof(test_suites)/sizeof(test_suites[0]));
+#if TFM_LVL == 1
tear_down_integ_test();
+#endif /* TFM_LVL == 1 */
}
diff --git a/test/test_services/tfm_sst_test_service/sst_test_service.c b/test/test_services/tfm_sst_test_service/sst_test_service.c
index 8ca28b0..175366a 100644
--- a/test/test_services/tfm_sst_test_service/sst_test_service.c
+++ b/test/test_services/tfm_sst_test_service/sst_test_service.c
@@ -36,7 +36,7 @@
{
enum psa_sst_err_t err;
const uint32_t key_uuid = SST_ASSET_ID_AES_KEY_128;
- uint8_t key_data[SST_TEST_SERVICE_KEY_SIZE] = SST_TEST_SERVICE_KEY;
+ static uint8_t key_data[SST_TEST_SERVICE_KEY_SIZE] = SST_TEST_SERVICE_KEY;
/* Create the key asset using our secure app ID */