From: Timo Sirainen Date: Tue, 30 Jun 2009 01:56:00 +0000 (-0400) Subject: unit testing: If a warning or error is logged during unit test, fail it. X-Git-Tag: 2.0.alpha1~496 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=504cd30efb2de16d49c1d79008c9659bc0df5013;p=thirdparty%2Fdovecot%2Fcore.git unit testing: If a warning or error is logged during unit test, fail it. --HG-- branch : HEAD --- 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)