From fae41aac080b198aa3843d1b9b511fb1a685bf47 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 8 Nov 2023 11:44:42 +1000 Subject: [PATCH] test: hack a peck_debug() function To make it easier to print something debuggy from a test. This is the MVP, it always requires an argument after the format string but it'll do for now. --- test/eierpecken.c | 9 +++++++++ test/eierpecken.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/test/eierpecken.c b/test/eierpecken.c index 439e9b1..7fe3d9d 100644 --- a/test/eierpecken.c +++ b/test/eierpecken.c @@ -1358,6 +1358,15 @@ _peck_mark(struct peck *peck, const char *func, int line) log_debug(peck, "mark %3d: line %d in %s()\n", mark++, line, func); } +void _peck_debug(struct peck *peck, const char *func, int line, const char *format, ...) +{ + va_list args; + + va_start(args, format); + log_msg_va(peck->logger, LOGGER_DEBUG, "unused", line, func, format, args); + va_end(args); +} + MUNIT_GLOBAL_SETUP(init_sigalarm) { int argc = setup->argc; diff --git a/test/eierpecken.h b/test/eierpecken.h index 88e0d14..a692757 100644 --- a/test/eierpecken.h +++ b/test/eierpecken.h @@ -152,6 +152,9 @@ void _peck_mark(struct peck *peck, const char *func, int line); /** Add debug marker to the log output */ #define peck_mark(peck_) _peck_mark(peck_, __func__, __LINE__) +void _peck_debug(struct peck *peck, const char *func, int line, const char *format, ...); +#define peck_debug(peck_, ...) _peck_debug(peck_, __func__, __LINE__, __VA_ARGS__) + void peck_enable_eis_behavior(struct peck *peck, enum peck_eis_behavior behavior);