From 81d6fb335d8031d679bd2d167dafe024a50db80e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 3 Mar 2022 13:46:18 +1000 Subject: [PATCH] test: add a helper function to mark test progress Makes debugging easier: just insert a few peck_mark() calls and see them correctly mixed into the output. --- test/eierpecken.c | 7 +++++++ test/eierpecken.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/test/eierpecken.c b/test/eierpecken.c index a674bfe..f89926e 100644 --- a/test/eierpecken.c +++ b/test/eierpecken.c @@ -1056,3 +1056,10 @@ peck_eis_event_type_name(enum eis_event_type type) #undef CASE_STRING assert(!"Unhandled EIS event type"); } + +void +_peck_mark(struct peck *peck, const char *func, int line) +{ + static uint32_t mark = 0; + log_debug(peck, "mark %3d: line %d in %s()\n", mark++, line, func); +} diff --git a/test/eierpecken.h b/test/eierpecken.h index 9a4e439..949939f 100644 --- a/test/eierpecken.h +++ b/test/eierpecken.h @@ -134,6 +134,10 @@ struct peck; struct peck * peck_new(void); +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_enable_eis_behavior(struct peck *peck, enum peck_eis_behavior behavior);