]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
unit testing: If a warning or error is logged during unit test, fail it.
authorTimo Sirainen <tss@iki.fi>
Tue, 30 Jun 2009 01:56:00 +0000 (21:56 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 30 Jun 2009 01:56:00 +0000 (21:56 -0400)
--HG--
branch : HEAD

src/lib-test/test-common.c

index 69e6da23e752000c42b8599abd1d48f8bc42c7e2..5d6ecf25c0870be172228e1e05962da76d4fd100 100644 (file)
@@ -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)