From: Phil Carmody Date: Fri, 27 Jun 2014 13:10:27 +0000 (+0300) Subject: lib-test: Enable looped tests to abort early on first failure X-Git-Tag: 2.2.14.rc1~345 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dad57bb15da9dc03c40b0a4ddf72749704ea4e1b;p=thirdparty%2Fdovecot%2Fcore.git 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 --- diff --git a/src/lib-test/test-common.c b/src/lib-test/test-common.c index cac5869eef..40614931a7 100644 --- a/src/lib-test/test-common.c +++ b/src/lib-test/test-common.c @@ -147,6 +147,11 @@ void test_begin(const char *name) 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 --git a/src/lib-test/test-common.h b/src/lib-test/test-common.h index 193ee31370..e7912be53e 100644 --- a/src/lib-test/test-common.h +++ b/src/lib-test/test-common.h @@ -19,6 +19,7 @@ void test_begin(const char *name); } 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);