LIB: Update tests to use new logging API
Update secure runtime tests to use the new unprivileged logging API in
place of the SPM log API they were using previously.
Change-Id: I092e6ca54523cf5a7cefc866c07cbe60434f1b9d
Signed-off-by: Jackson Cooper-Driver <jackson.cooper-driver@arm.com>
diff --git a/docs/tfm_erpc_test_build_and_run.rst b/docs/tfm_erpc_test_build_and_run.rst
index 920e3f2..ddf539c 100644
--- a/docs/tfm_erpc_test_build_and_run.rst
+++ b/docs/tfm_erpc_test_build_and_run.rst
@@ -52,7 +52,7 @@
+-------------------------+-------------------------------------+
| TFM_SPM_LOG_LEVEL | ``TFM_SPM_LOG_LEVEL_SILENCE`` |
+-------------------------+-------------------------------------+
-| TFM_PARTITION_LOG_LEVEL | ``TFM_PARTITION_LOG_LEVEL_SILENCE`` |
+| TFM_PARTITION_LOG_LEVEL | ``LOG_LEVEL_NONE`` |
+-------------------------+-------------------------------------+
Execute tests on TC3 FVP with TCP Transport
diff --git a/erpc/host_example/README.rst b/erpc/host_example/README.rst
index 5c5f044..63aa633 100644
--- a/erpc/host_example/README.rst
+++ b/erpc/host_example/README.rst
@@ -16,7 +16,7 @@
cmake -G"Unix Makefiles" -S <path_to_tf-m> -B build_spe -DTFM_PLATFORM=musca_s1 \
-DTFM_PARTITION_CRYPTO=ON -DTFM_PARTITION_INTERNAL_TRUSTED_STORAGE=ON \
- -DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_SILENCE -DTFM_PARTITION_LOG_LEVEL=TFM_PARTITION_LOG_LEVEL_SILENCE \
+ -DTFM_SPM_LOG_LEVEL=TFM_SPM_LOG_LEVEL_SILENCE -DTFM_PARTITION_LOG_LEVEL=LOG_LEVEL_NONE \
-DMCUBOOT_LOG_LEVEL=OFF
cmake --build build_spe -- install -j
diff --git a/tests_reg/test/framework/test_log.h b/tests_reg/test/framework/test_log.h
index 995f726..4c14c60 100644
--- a/tests_reg/test/framework/test_log.h
+++ b/tests_reg/test/framework/test_log.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -9,7 +9,7 @@
#define __TEST_LOG_H__
#ifdef USE_SP_LOG
-#include "tfm_sp_log.h"
+#include "tfm_log_unpriv.h"
#elif defined USE_STDIO
#include <stdio.h>
#else
@@ -20,7 +20,9 @@
extern "C" {
#endif
-#if defined USE_SP_LOG || USE_STDIO
+#if defined USE_SP_LOG
+#define TEST_LOG(...) tfm_log_unpriv(LOG_MARKER_RAW __VA_ARGS__)
+#elif defined USE_STDIO
#define TEST_LOG(...) printf(__VA_ARGS__)
#else
#define TEST_LOG(...) tfm_log_printf(__VA_ARGS__)
diff --git a/tests_reg/test/secure_fw/suites/fpu/service/tfm_fpu_service_test.c b/tests_reg/test/secure_fw/suites/fpu/service/tfm_fpu_service_test.c
index 092f68a..0e02a52 100644
--- a/tests_reg/test/secure_fw/suites/fpu/service/tfm_fpu_service_test.c
+++ b/tests_reg/test/secure_fw/suites/fpu/service/tfm_fpu_service_test.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -11,7 +11,7 @@
#include "psa/client.h"
#include "psa/service.h"
#include "psa_manifest/tfm_fpu_service_test.h"
-#include "tfm_sp_log.h"
+#include "tfm_log_unpriv.h"
#include "tfm_peripherals_def.h"
/*
@@ -92,12 +92,12 @@
if (memcmp(fp_caller_buffer, expecting_caller_content,
FP_CALLER_BUF_SIZE)) {
- LOG_ERRFMT("FP caller registers are not correctly restored!");
+ ERROR_UNPRIV_RAW("FP caller registers are not correctly restored!");
status = PSA_ERROR_GENERIC_ERROR;
} else {
if (memcmp(fp_callee_buffer, expecting_callee_content,
FP_CALLEE_BUF_SIZE)) {
- LOG_ERRFMT("FP callee registers are not correctly restored!");
+ ERROR_UNPRIV_RAW("FP callee registers are not correctly restored!");
status = PSA_ERROR_GENERIC_ERROR;
}
}
diff --git a/tests_reg/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/tfm_ipc_service_test.c b/tests_reg/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/tfm_ipc_service_test.c
index 732f915..aaef76d 100644
--- a/tests_reg/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/tfm_ipc_service_test.c
+++ b/tests_reg/test/secure_fw/suites/spm/ipc/service/tfm_ipc_service/tfm_ipc_service_test.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2024, Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -12,7 +12,7 @@
#include "psa_manifest/tfm_ipc_service_test.h"
#include "spm_test_defs.h"
#include "tfm_hal_isolation.h"
-#include "tfm_sp_log.h"
+#include "tfm_log_unpriv.h"
#include "client_api_test_defs.h"
#include "client_api_test_service.h"
diff --git a/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_flih_test_service/tfm_flih_test_service.c b/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_flih_test_service/tfm_flih_test_service.c
index fdd43b6..bacb820 100644
--- a/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_flih_test_service/tfm_flih_test_service.c
+++ b/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_flih_test_service/tfm_flih_test_service.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -8,7 +8,7 @@
#include "cmsis_compiler.h"
#include "tfm_plat_test.h"
#include "spm_test_defs.h"
-#include "tfm_sp_log.h"
+#include "tfm_log_unpriv.h"
#include "psa/service.h"
#include "psa_manifest/tfm_flih_test_service.h"
@@ -106,7 +106,7 @@
status = PSA_SUCCESS;
break;
default:
- LOG_ERRFMT("FLIH test service: Invalid message type: 0x%x\r\n",
+ ERROR_UNPRIV_RAW("FLIH test service: Invalid message type: 0x%x\n",
msg->type);
status = PSA_ERROR_PROGRAMMER_ERROR;
break;
diff --git a/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_slih_test_service/tfm_slih_test_service.c b/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_slih_test_service/tfm_slih_test_service.c
index b970372..7c1734f 100644
--- a/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_slih_test_service/tfm_slih_test_service.c
+++ b/tests_reg/test/secure_fw/suites/spm/irq/service/tfm_slih_test_service/tfm_slih_test_service.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -7,7 +7,7 @@
#include "tfm_plat_test.h"
#include "spm_test_defs.h"
-#include "tfm_sp_log.h"
+#include "tfm_log_unpriv.h"
#include "psa/service.h"
#include "psa_manifest/tfm_slih_test_service.h"
@@ -40,7 +40,7 @@
status = PSA_SUCCESS;
break;
default:
- LOG_ERRFMT("SLIH test service: Invalid message type: 0x%x\r\n",
+ ERROR_UNPRIV_RAW("SLIH test service: Invalid message type: 0x%x\n",
msg->type);
status = PSA_ERROR_PROGRAMMER_ERROR;
break;
diff --git a/tests_reg/test/secure_fw/suites/spm/sfn/service/sfn_backend_test_partition/sfn_backend_test_partition.c b/tests_reg/test/secure_fw/suites/spm/sfn/service/sfn_backend_test_partition/sfn_backend_test_partition.c
index 3960108..8af959b 100644
--- a/tests_reg/test/secure_fw/suites/spm/sfn/service/sfn_backend_test_partition/sfn_backend_test_partition.c
+++ b/tests_reg/test/secure_fw/suites/spm/sfn/service/sfn_backend_test_partition/sfn_backend_test_partition.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors
*
* SPDX-License-Identifier: BSD-3-Clause
*
@@ -9,7 +9,7 @@
#include "psa/service.h"
#include "psa_manifest/sfn_backend_test_partition.h"
#include "spm_test_defs.h"
-#include "tfm_sp_log.h"
+#include "tfm_log_unpriv.h"
#include "client_api_test_defs.h"
#include "client_api_test_service.h"
#if PSA_FRAMEWORK_HAS_MM_IOVEC
@@ -85,6 +85,6 @@
psa_status_t sfn_test_partition_init(void)
{
- LOG_DBGFMT("[DBG][SFN Test] SFN Test Partition initialized\r\n");
+ VERBOSE_UNPRIV("[SFN Test] SFN Test Partition initialized\r\n");
return PSA_SUCCESS;
}