From: Aki Tuomi Date: Thu, 9 Aug 2018 09:38:43 +0000 (+0300) Subject: lib-test: Warn if test_run or test_run_named result is not used X-Git-Tag: 2.3.9~1566 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=596468d3b929bb6d3324aa591873bab7bbb09e08;p=thirdparty%2Fdovecot%2Fcore.git lib-test: Warn if test_run or test_run_named result is not used Ensures hopefully that unit tests do not succeed when they fail due to wrong exit code. --- diff --git a/src/lib-test/test-common.h b/src/lib-test/test-common.h index cba5a79865..0c84fab40d 100644 --- a/src/lib-test/test-common.h +++ b/src/lib-test/test-common.h @@ -52,12 +52,12 @@ void test_out_quiet(const char *name, bool success); /* only prints failures */ void test_out_reason(const char *name, bool success, const char *reason) ATTR_NULL(3); -int test_run(void (*const test_functions[])(void)); +int test_run(void (*const test_functions[])(void)) ATTR_WARN_UNUSED_RESULT; struct named_test { const char *name; void (*func)(void); }; -int test_run_named(const struct named_test tests[], const char *match); +int test_run_named(const struct named_test tests[], const char *match) ATTR_WARN_UNUSED_RESULT; #define TEST_DECL(x) void x(void); #define TEST_NAMELESS(x) x, /* Were you to want to use the X trick but not name the tests */