From 83c82e6cd676a646ea4b44fe5fea7023f15c9504 Mon Sep 17 00:00:00 2001 From: Tomasz Bursztyka Date: Thu, 23 Jun 2016 15:47:00 +0200 Subject: [PATCH] tests: Allow tc_util to use printf when requested printk() is too simplistic and does not handle byte precision on formats like %02x etc... printf does, so letting the possibility to use it when relevant. This might be useful when dumping out some network packets, byte by byte where a precision of 1 byte (thus 2 0's) is necessary. It's better to have this output: 41 d8 ... instead of: 00000041 000000d8 ... Change-Id: Idc15bbae67830f41388373e2ca1947bb274fb550 Signed-off-by: Tomasz Bursztyka --- tests/include/tc_util.h | 7 ++++++- tests/kernel/test_ipm/prj.conf | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/include/tc_util.h b/tests/include/tc_util.h index 4a3b0a6ec0f..8a1d8d39976 100644 --- a/tests/include/tc_util.h +++ b/tests/include/tc_util.h @@ -21,10 +21,15 @@ #include -#include #include +#if defined(CONFIG_STDOUT_CONSOLE) +#include +#define PRINT_DATA(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#include #define PRINT_DATA(fmt, ...) printk(fmt, ##__VA_ARGS__) +#endif /* CONFIG_STDOUT_CONSOLE */ /** * @def TC_PRINT_RUN_ID diff --git a/tests/kernel/test_ipm/prj.conf b/tests/kernel/test_ipm/prj.conf index 345104c36fb..f6421937577 100644 --- a/tests/kernel/test_ipm/prj.conf +++ b/tests/kernel/test_ipm/prj.conf @@ -1,5 +1,4 @@ CONFIG_CONSOLE=y -CONFIG_STDOUT_CONSOLE=y CONFIG_IPM_CONSOLE_RECEIVER=y CONFIG_IPM_CONSOLE_SENDER=y CONFIG_IRQ_OFFLOAD=y