From: Alain Spineux Date: Wed, 26 Feb 2020 17:53:47 +0000 (+0100) Subject: unittest: new rok() is ok or display the label and "return 1;" X-Git-Tag: Release-11.3.2~985 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f218a016c70dfca1cfcad55cd9104914006630b9;p=thirdparty%2Fbacula.git unittest: new rok() is ok or display the label and "return 1;" avoid the display of the OK message when it succeed rok() is useful to skip tests that follow and depend of the success of the test I like to use it for test that should never fail --- diff --git a/bacula/src/lib/unittests.h b/bacula/src/lib/unittests.h index 7c1ff4797..d29c4d177 100644 --- a/bacula/src/lib/unittests.h +++ b/bacula/src/lib/unittests.h @@ -31,6 +31,8 @@ #define is(x, y, label) _is(__FILE__, __LINE__, #x, (x), (y), label) #define isnt(x, y, label) _isnt(__FILE__, __LINE__, #x, (x), (y), label) +#define rok(x, label) { bool v=(x); if (!v) { _ok(__FILE__, __LINE__, #x, v, label); return 1; } } + /* TODO: log() ported from BEE it should be updated. */ #ifdef RTEST_LOG_THREADID #define log(format, ...) do { \