dovecot-2.0: unit testing: If a warning or error is logged durin...

dovecot at dovecot.org dovecot at dovecot.org
Tue Jun 30 05:04:31 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/bf96497404f5
changeset: 9556:bf96497404f5
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 29 21:56:00 2009 -0400
description:
unit testing: If a warning or error is logged during unit test, fail it.

diffstat:

1 file changed, 15 insertions(+)
src/lib-test/test-common.c |   15 +++++++++++++++

diffs (32 lines):

diff -r ff4e33e22764 -r bf96497404f5 src/lib-test/test-common.c
--- 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 @@ void test_out_reason(const char *name, b
 	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)


More information about the dovecot-cvs mailing list