From 504cd30efb2de16d49c1d79008c9659bc0df5013 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 29 Jun 2009 21:56:00 -0400 Subject: [PATCH] unit testing: If a warning or error is logged during unit test, fail it. --HG-- branch : HEAD --- src/lib-test/test-common.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib-test/test-common.c b/src/lib-test/test-common.c index 69e6da23e7..5d6ecf25c0 100644 --- a/src/lib-test/test-common.c +++ b/src/lib-test/test-common.c @@ -168,6 +168,20 @@ void test_out_reason(const char *name, bool success, const char *reason) total_count++; } +static void +test_error_handler(enum log_type type, const char *format, va_list args) +{ + default_error_handler(type, format, args); +#ifdef DEBUG + if (type == LOG_TYPE_WARNING && strstr(format, "Growing") != NULL) { + /* ignore "Growing memory pool" and "Growing data stack" + warnings */ + return; + } +#endif + test_success = FALSE; +} + void test_init(void) { test_prefix = NULL; @@ -175,6 +189,7 @@ void test_init(void) total_count = 0; lib_init(); + i_set_error_handler(test_error_handler); } int test_deinit(void) -- 2.47.3