dovecot-2.2: lib-test: Enable looped tests to abort early on fir...

dovecot at dovecot.org dovecot at dovecot.org
Fri Jun 27 13:22:41 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/e1686f44f2e7
changeset: 17525:e1686f44f2e7
user:      Phil Carmody <phil at dovecot.fi>
date:      Fri Jun 27 16:10:27 2014 +0300
description:
lib-test: Enable looped tests to abort early on first failure
Give them the ability to query the current failure state.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib-test/test-common.c |  5 +++++
 src/lib-test/test-common.h |  1 +
 2 files changed, 6 insertions(+), 0 deletions(-)

diffs (26 lines):

diff -r cfc2670398d7 -r e1686f44f2e7 src/lib-test/test-common.c
--- a/src/lib-test/test-common.c	Fri Jun 27 14:23:46 2014 +0300
+++ b/src/lib-test/test-common.c	Fri Jun 27 16:10:27 2014 +0300
@@ -147,6 +147,11 @@
 	test_success = TRUE;
 }
 
+bool test_has_failed(void)
+{
+	return !test_success;
+}
+
 void test_assert_failed(const char *code, const char *file, unsigned int line)
 {
 	printf("%s:%u: Assert failed: %s\n", file, line, code);
diff -r cfc2670398d7 -r e1686f44f2e7 src/lib-test/test-common.h
--- a/src/lib-test/test-common.h	Fri Jun 27 14:23:46 2014 +0300
+++ b/src/lib-test/test-common.h	Fri Jun 27 16:10:27 2014 +0300
@@ -19,6 +19,7 @@
 	} STMT_END
 void test_assert_failed(const char *code, const char *file, unsigned int line);
 void test_assert_failed_idx(const char *code, const char *file, unsigned int line, long long i);
+bool test_has_failed(void);
 void test_end(void);
 
 void test_out(const char *name, bool success);


More information about the dovecot-cvs mailing list