Build: Add option to enable or disable Audit Log
Adds a build option that makes it possible to enable or disable the
TF-M Audit Log partition. The option TFM_PARTITION_AUDIT_LOG can be
provided in the CMake configure command, and is enabled by default if
not supplied.
Change-Id: Ib60f22aeb62652e34a1ac43a61154288e6d989b3
Signed-off-by: Jamie Fox <jamie.fox@arm.com>
diff --git a/test/CMakeLists.inc b/test/CMakeLists.inc
index ffc662c..0afe041 100644
--- a/test/CMakeLists.inc
+++ b/test/CMakeLists.inc
@@ -23,16 +23,27 @@
message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
endif()
+if (NOT DEFINED ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
+ message(FATAL_ERROR "Incomplete build configuration: ENABLE_AUDIT_LOGGING_SERVICE_TESTS is undefined.")
+endif()
+
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/spm ABSOLUTE)
embedded_include_directories(PATH ${TFM_ROOT_DIR}/secure_fw/core ABSOLUTE)
-# add the framework
+
+# Include the test framework
include(${CMAKE_CURRENT_LIST_DIR}/framework/CMakeLists.inc)
+
+# Include the test suites
include(${CMAKE_CURRENT_LIST_DIR}/suites/core/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/suites/invert/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/suites/sst/CMakeLists.inc)
-include(${CMAKE_CURRENT_LIST_DIR}/suites/audit/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/suites/crypto/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/suites/attestation/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/suites/qcbor/CMakeLists.inc)
-include(${CMAKE_CURRENT_LIST_DIR}/test_services/CMakeLists.inc)
include(${CMAKE_CURRENT_LIST_DIR}/suites/ipc/CMakeLists.inc)
+if (ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
+ include(${CMAKE_CURRENT_LIST_DIR}/suites/audit/CMakeLists.inc)
+endif()
+
+# Include the test partitions
+include(${CMAKE_CURRENT_LIST_DIR}/test_services/CMakeLists.inc)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 8f3fdf5..75ccb07 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -37,6 +37,10 @@
message(FATAL_ERROR "Incomplete build configuration: TFM_LVL is undefined. ")
endif()
+if (NOT DEFINED TFM_PARTITION_AUDIT_LOG)
+ message(FATAL_ERROR "Incomplete build configuration: TFM_PARTITION_AUDIT_LOG is undefined.")
+endif()
+
#Configure our options as needed.
if (CORE_TEST_INTERACTIVE OR CORE_TEST_POSITIVE)
set(ENABLE_CORE_TESTS True)
@@ -52,6 +56,15 @@
set(ENABLE_INVERT_SERVICE_TESTS TRUE)
set(ENABLE_ATTESTATION_SERVICE_TESTS TRUE)
set(ENABLE_QCBOR_TESTS TRUE)
+
+if (NOT TFM_PARTITION_AUDIT_LOG)
+ set(ENABLE_AUDIT_LOGGING_SERVICE_TESTS FALSE)
+endif()
+
+if (ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
+ set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
+endif()
+
include(${CMAKE_CURRENT_LIST_DIR}/CMakeLists.inc)
if (NOT TARGET tfm_t_cose_verify)
diff --git a/test/framework/non_secure_suites.c b/test/framework/non_secure_suites.c
index ba37848..e0f9d13 100644
--- a/test/framework/non_secure_suites.c
+++ b/test/framework/non_secure_suites.c
@@ -55,8 +55,10 @@
* FixMe: skip below test cases temporary since target service is not
* IPC compatible yet.
*/
+#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS
/* Non-secure Audit Logging test cases */
{®ister_testsuite_ns_audit_interface, 0, 0, 0},
+#endif
#endif
diff --git a/test/framework/secure_suites.c b/test/framework/secure_suites.c
index 3c86fa2..8eda21f 100644
--- a/test/framework/secure_suites.c
+++ b/test/framework/secure_suites.c
@@ -46,8 +46,10 @@
* FixMe: since the following partitions haven't implement the IPC model,
* they will block the process. Skip them in IPC model.
*/
+#ifdef ENABLE_AUDIT_LOGGING_SERVICE_TESTS
/* Secure Audit Logging test cases */
{®ister_testsuite_s_audit_interface, 0, 0, 0},
+#endif
#endif
diff --git a/test/suites/audit/CMakeLists.inc b/test/suites/audit/CMakeLists.inc
index 5231381..b1a8f46 100644
--- a/test/suites/audit/CMakeLists.inc
+++ b/test/suites/audit/CMakeLists.inc
@@ -1,5 +1,5 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2018, Arm Limited. All rights reserved.
+# Copyright (c) 2018-2019, Arm Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
@@ -24,13 +24,9 @@
message(FATAL_ERROR "Please set TFM_ROOT_DIR before including this file.")
endif()
-if (NOT DEFINED ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
- message(FATAL_ERROR "Incomplete build configuration: ENABLE_AUDIT_LOGGING_SERVICE_TESTS is undefined. ")
-elseif(ENABLE_AUDIT_LOGGING_SERVICE_TESTS)
- list(APPEND ALL_SRC_C_S "${AUDIT_LOGGING_TEST_DIR}/secure/audit_s_interface_testsuite.c")
- list(APPEND ALL_SRC_C_NS "${AUDIT_LOGGING_TEST_DIR}/non_secure/audit_ns_interface_testsuite.c")
+list(APPEND ALL_SRC_C_S "${AUDIT_LOGGING_TEST_DIR}/secure/audit_s_interface_testsuite.c")
+list(APPEND ALL_SRC_C_NS "${AUDIT_LOGGING_TEST_DIR}/non_secure/audit_ns_interface_testsuite.c")
- #Setting include directories
- embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
- embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)
-endif()
+#Setting include directories
+embedded_include_directories(PATH ${TFM_ROOT_DIR} ABSOLUTE)
+embedded_include_directories(PATH ${TFM_ROOT_DIR}/interface/include ABSOLUTE)