Test: Build TF-M SPE alone with NS test flags selected
Some usage scenarios, such as multi-core platforms, require to build
non-secure side and secure side separately. TF-M currently supports to
build TF-M secure side with secure tests only.
However, some non-secure tests also require secure test services.
Therefore, NS test flags shall be selected even during TF-M secure build
alone.
But if NS tests flags are selected while building TF-M secure side only,
the TF-M build with current tf-m-tests will fail since the tf-m-tests is
not decoupled well.
This commit supports to build TF-M secure side only with NS test flags
selected, to include secure test services to support NS tests.
If NS is not selected, skip NS test framework and test suites build by
temporarily unsetting corresponding flags.
Signed-off-by: David Hu <david.hu@arm.com>
Change-Id: I2ae1caab9d5b63f43bb17453a3392cb22963f85d
diff --git a/test/config/set_config.cmake b/test/config/set_config.cmake
index 452af12..e059aab 100644
--- a/test/config/set_config.cmake
+++ b/test/config/set_config.cmake
@@ -70,14 +70,17 @@
########################## Test framework sync #################################
get_cmake_property(CACHE_VARS CACHE_VARIABLES)
-# Force TEST_FRAMEWORK_NS ON if single NS test ON
-foreach(CACHE_VAR ${CACHE_VARS})
- string(REGEX MATCH "^TEST_NS_.*" _NS_TEST_FOUND "${CACHE_VAR}")
- if (_NS_TEST_FOUND AND "${${CACHE_VAR}}")
- set(TEST_FRAMEWORK_NS ON CACHE BOOL "Whether to build NS regression tests framework")
- break()
- endif()
-endforeach()
+
+if (NS)
+ # Force TEST_FRAMEWORK_NS ON if single NS test ON
+ foreach(CACHE_VAR ${CACHE_VARS})
+ string(REGEX MATCH "^TEST_NS_.*" _NS_TEST_FOUND "${CACHE_VAR}")
+ if (_NS_TEST_FOUND AND "${${CACHE_VAR}}")
+ set(TEST_FRAMEWORK_NS ON CACHE BOOL "Whether to build NS regression tests framework")
+ break()
+ endif()
+ endforeach()
+endif()
# Force TEST_FRAMEWORK_S ON if single S test ON
foreach(CACHE_VAR ${CACHE_VARS})
@@ -110,6 +113,13 @@
include(${TFM_TEST_PATH}/config/default_s_test_config.cmake)
endif()
if (TEST_NS)
+ if (NOT NS)
+ # In this case, TEST_NS is used to configure corresponding test secure
+ # services during SPE build alone.
+ # Disable TEST_FRAMEWORK_NS if NS is OFF as NS test framework shall
+ # run inside NS environment
+ set(TEST_FRAMEWORK_NS OFF CACHE BOOL "Whether to build NS regression tests framework")
+ endif()
include(${TFM_TEST_PATH}/config/default_ns_test_config.cmake)
endif()