Hotfix: Fix tests build issues
- Remove unused test/suites folder
- Re-enable TF-M to build secure tests alone by including raw log
library in NS tests and BL2 tests.
- Add TEST_BL2 flag to select raw log in BL2 tests instead of using
DOMAIN_NS=1. Setting DOMAIN_NS=1 in BL2 build is confusing.
- Remove root CMakeLists.txt as NS app, raw log and tests builds are
split again.
Signed-off-by: David Hu <david.hu@arm.com>
Change-Id: I01e2e80d63bfebb54d056c3e03a346b466a5e025
diff --git a/CMakeLists.txt b/CMakeLists.txt
deleted file mode 100644
index ecfd432..0000000
--- a/CMakeLists.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-add_subdirectory(log)
-
-if(NS)
- add_subdirectory(app)
-endif()
-
-add_subdirectory(test)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index e498c75..8709d92 100755
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -21,11 +21,6 @@
framework
)
-target_link_libraries(tfm_test_framework_common
- INTERFACE
- tfm_log_interface
-)
-
if(TEST_FRAMEWORK_S OR TEST_FRAMEWORK_NS)
add_subdirectory(secure_fw)
endif()
diff --git a/test/bl2/mcuboot/CMakeLists.txt b/test/bl2/mcuboot/CMakeLists.txt
index 89df0f5..3ba5b85 100644
--- a/test/bl2/mcuboot/CMakeLists.txt
+++ b/test/bl2/mcuboot/CMakeLists.txt
@@ -22,6 +22,7 @@
target_link_libraries(mcuboot_tests
PUBLIC
tfm_test_framework_common
+ tfm_log
PRIVATE
platform_bl2
mcuboot_test_suite_integration
@@ -29,5 +30,5 @@
target_compile_definitions(mcuboot_tests
PUBLIC
- DOMAIN_NS=1
+ TEST_BL2
)
diff --git a/test/bl2/mcuboot/suites/integration/CMakeLists.txt b/test/bl2/mcuboot/suites/integration/CMakeLists.txt
index df4aaa1..d62b752 100644
--- a/test/bl2/mcuboot/suites/integration/CMakeLists.txt
+++ b/test/bl2/mcuboot/suites/integration/CMakeLists.txt
@@ -30,5 +30,5 @@
target_compile_definitions(mcuboot_test_suite_integration
PUBLIC
- DOMAIN_NS=1
+ TEST_BL2
)
diff --git a/test/framework/test_log.h b/test/framework/test_log.h
index 149afe2..801d538 100644
--- a/test/framework/test_log.h
+++ b/test/framework/test_log.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Arm Limited. All rights reserved.
+ * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#ifndef __TEST_LOG_H__
#define __TEST_LOG_H__
-#if DOMAIN_NS == 1
+#if (DOMAIN_NS == 1) || defined(TEST_BL2)
#include "tfm_log_raw.h"
#else
#include "tfm_sp_log.h"
@@ -18,7 +18,7 @@
extern "C" {
#endif
-#if DOMAIN_NS == 1
+#if (DOMAIN_NS == 1) || defined(TEST_BL2)
#define TEST_LOG(...) tfm_log_printf(__VA_ARGS__)
#else
#define TEST_LOG(...) tfm_sp_log_printf(__VA_ARGS__)
diff --git a/test/suites/CMakeLists.txt b/test/suites/CMakeLists.txt
deleted file mode 100644
index 525b5b6..0000000
--- a/test/suites/CMakeLists.txt
+++ /dev/null
@@ -1,97 +0,0 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2021-2022, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-cmake_minimum_required(VERSION 3.13)
-
-if (NOT TEST_FRAMEWORK_NS AND NOT TEST_FRAMEWORK_S)
- return()
-endif()
-
-# For multi-core projects, the NS app can be run on a different CPU to the
-# Secure code. To facilitate this, we once again reload the compiler to load the
-# setting for the NS CPU. Cmake settings are directory scoped so this affects
-# anything loaded from or declared in this dir.
-if (TFM_MULTI_CORE_TOPOLOGY)
- include(${CMAKE_SOURCE_DIR}/platform/ext/target/${TFM_PLATFORM}/preload_ns.cmake)
- tfm_toolchain_reload_compiler()
-endif()
-
-if (TEST_FRAMEWORK_NS)
- add_library(tfm_ns_tests INTERFACE)
- add_library(tfm_test_framework_ns INTERFACE)
-
- target_compile_definitions(tfm_test_framework_ns
- INTERFACE
- DOMAIN_NS=1
- )
-
- target_link_libraries(tfm_test_framework_ns
- INTERFACE
- tfm_test_framework_common
- tfm_api_ns
- tfm_ns_interface
- tfm_log
- )
-
- target_sources(tfm_ns_tests
- INTERFACE
- ${TFM_TEST_PATH}/framework/non_secure_suites.c
- )
-
- target_link_libraries(tfm_ns_tests
- INTERFACE
- tfm_test_framework_ns
- tfm_partition_defs
- )
-
- target_compile_definitions(tfm_ns_tests
- INTERFACE
- $<$<BOOL:${SYMMETRIC_INITIAL_ATTESTATION}>:SYMMETRIC_INITIAL_ATTESTATION>
- $<$<BOOL:${TFM_FUZZER_TOOL_TESTS}>:TFM_FUZZER_TOOL_TESTS>
- )
-else()
- # Skip building NS regresstion test suites if TEST_FRAMEWORK_NS is OFF.
- # NS test flags are kept to select corresponding test services. They are
- # unset here to skip building NS regression test suites.
- get_cmake_property(CACHE_VARS CACHE_VARIABLES)
-
- foreach(CACHE_VAR ${CACHE_VARS})
- string(REGEX MATCH "^TEST_NS_.*" _NS_TEST_FOUND "${CACHE_VAR}")
- if (_NS_TEST_FOUND AND "${${CACHE_VAR}}")
- unset(${CACHE_VAR} CACHE)
- endif()
- endforeach()
-endif()
-
-# Add test suites.
-# Secure test suite library targets shall already be added in secure_tests.cmake
-add_subdirectory(attestation)
-add_subdirectory(audit)
-add_subdirectory(core)
-add_subdirectory(crypto)
-add_subdirectory(extra)
-add_subdirectory(its)
-add_subdirectory(qcbor)
-add_subdirectory(ps)
-add_subdirectory(t_cose)
-add_subdirectory(platform)
-add_subdirectory(fwu)
-add_subdirectory(irq)
-add_subdirectory(multi_core/non_secure)
-add_subdirectory(nsid)
-add_subdirectory(fpu)
-add_subdirectory(spm)
-
-if (TFM_FUZZER_TOOL_TESTS AND TEST_FRAMEWORK_NS)
- if (NOT DEFINED TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH)
- # The location of the file needs to be defined either from command line
- # or from config cmake file.
- message(FATAL_ERROR "Incomplete build configuration: TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH is undefined.")
- else()
- add_subdirectory(${TFM_FUZZER_TOOL_TESTS_CMAKE_INC_PATH} ${CMAKE_BINARY_DIR}/suites/tfm_fuzz)
- endif()
-endif()