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.
This commit is contained in:
Peter Hutterer 2023-11-08 11:44:42 +10:00
parent 34c83370be
commit fae41aac08
2 changed files with 12 additions and 0 deletions

View file

@ -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;

View file

@ -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);