From 07c613b2e16375df1f8848cc683dc6d874de73d5 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 26 May 2019 13:31:55 -0400 Subject: [PATCH] Stripped the path from test log filenames. --- test/lib/testing.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/lib/testing.c b/test/lib/testing.c index 5d2437f4..d06aefd0 100644 --- a/test/lib/testing.c +++ b/test/lib/testing.c @@ -197,10 +197,22 @@ void testingprivTLogfFull(testingT *t, const char *file, long line, const char * va_end(ap); } +static const char *basename(const char *file) +{ + const char *p; + + for (;;) { + p = strpbrk(file, "/\\"); + if (p == NULL) + break; + file = p + 1; + } + return file; +} + void testingprivTLogvfFull(testingT *t, const char *file, long line, const char *format, va_list ap) { - // TODO extract filename from file - testingprivOutbufPrintf(t->outbuf, "%s:%ld: ", file, line); + testingprivOutbufPrintf(t->outbuf, "%s:%ld: ", basename(file), line); testingprivOutbufVprintf(t->outbuf, format, ap); testingprivOutbufPrintf(t->outbuf, "\n"); }