]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-test: Enable looped tests to abort early on first failure
authorPhil Carmody <phil@dovecot.fi>
Fri, 27 Jun 2014 13:10:27 +0000 (16:10 +0300)
committerPhil Carmody <phil@dovecot.fi>
Fri, 27 Jun 2014 13:10:27 +0000 (16:10 +0300)
Give them the ability to query the current failure state.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
src/lib-test/test-common.c
src/lib-test/test-common.h

index cac5869eefae95602af37f6eb5dc14df6f51e537..40614931a7418d2f5fa4adfddc26e1986d4ed832 100644 (file)
@@ -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);
index 193ee31370e3fa35d83f875cbb3d61829cfe8469..e7912be53e789941eb47031294648dc4f92676e4 100644 (file)
@@ -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);