David Hu | 1a74bc5 | 2021-08-19 11:17:42 +0800 | [diff] [blame] | 1 | /* |
Jackson Cooper-Driver | e7c8f8e | 2025-03-04 10:28:59 +0000 | [diff] [blame] | 2 | * SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors |
David Hu | 1a74bc5 | 2021-08-19 11:17:42 +0800 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __TEST_LOG_H__ |
| 9 | #define __TEST_LOG_H__ |
| 10 | |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 11 | #ifdef USE_SP_LOG |
Jackson Cooper-Driver | e7c8f8e | 2025-03-04 10:28:59 +0000 | [diff] [blame] | 12 | #include "tfm_log_unpriv.h" |
Kevin Peng | 33f4f7d | 2023-11-15 17:35:48 +0800 | [diff] [blame] | 13 | #elif defined USE_STDIO |
| 14 | #include <stdio.h> |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 15 | #else |
Jackson Cooper-Driver | 9798351 | 2025-07-09 10:00:04 +0100 | [diff] [blame] | 16 | /* |
| 17 | * Depending on how the tests are compiled, they may |
| 18 | * pick up the LOG_LEVEL definition from other components. These other values |
| 19 | * will have no effect on logging in the tests as we always call the tfm_log |
| 20 | * function. In the case that we do not have a definition, just set |
| 21 | * it to VERBOSE |
| 22 | */ |
| 23 | #ifndef LOG_LEVEL |
| 24 | #define LOG_LEVEL LOG_LEVEL_VERBOSE |
| 25 | #endif |
| 26 | #include "tfm_log.h" |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 27 | #endif /* USE_SP_LOG */ |
David Hu | 1a74bc5 | 2021-08-19 11:17:42 +0800 | [diff] [blame] | 28 | |
| 29 | #ifdef __cplusplus |
| 30 | extern "C" { |
| 31 | #endif |
| 32 | |
Jackson Cooper-Driver | e7c8f8e | 2025-03-04 10:28:59 +0000 | [diff] [blame] | 33 | #if defined USE_SP_LOG |
| 34 | #define TEST_LOG(...) tfm_log_unpriv(LOG_MARKER_RAW __VA_ARGS__) |
| 35 | #elif defined USE_STDIO |
Ken Liu | a3d6be4 | 2022-09-29 11:12:20 +0800 | [diff] [blame] | 36 | #define TEST_LOG(...) printf(__VA_ARGS__) |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 37 | #else |
Jackson Cooper-Driver | 9798351 | 2025-07-09 10:00:04 +0100 | [diff] [blame] | 38 | #define TEST_LOG(...) tfm_log(LOG_MARKER_RAW __VA_ARGS__) |
Raef Coles | 4817eb8 | 2022-01-18 12:33:24 +0000 | [diff] [blame] | 39 | #endif /* USE_SP_LOG */ |
David Hu | 1a74bc5 | 2021-08-19 11:17:42 +0800 | [diff] [blame] | 40 | |
| 41 | #ifdef __cplusplus |
| 42 | } |
| 43 | #endif |
| 44 | |
| 45 | #endif /* __TEST_LOG_H__ */ |