Mercurial > dovecot > core-2.2
changeset 9556:bf96497404f5 HEAD
unit testing: If a warning or error is logged during unit test, fail it.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 29 Jun 2009 21:56:00 -0400 |
parents | ff4e33e22764 |
children | e41c648a2f4c |
files | src/lib-test/test-common.c |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-test/test-common.c Mon Jun 29 21:55:38 2009 -0400 +++ b/src/lib-test/test-common.c Mon Jun 29 21:56:00 2009 -0400 @@ -168,6 +168,20 @@ 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 @@ total_count = 0; lib_init(); + i_set_error_handler(test_error_handler); } int test_deinit(void)