spdk_cunit: only evaluate assert condition once

Change-Id: I2e8591df23fcb686c3189b0f6215759d749b84bd
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-10-18 16:13:53 -07:00 committed by Jim Harris
parent c194ebd833
commit 3b951037a4

View File

@ -43,7 +43,14 @@
* static analyzers figure out that it really doesn't return.
* The abort() will never actually execute.
*/
#define SPDK_CU_ASSERT_FATAL(cond) do { CU_ASSERT_FATAL(cond); if (!(cond)) { abort(); } } while (0)
#define SPDK_CU_ASSERT_FATAL(cond) \
do { \
int result_ = !!(cond); \
CU_ASSERT_FATAL(result_); \
if (!result_) { \
abort(); \
} \
} while (0)
int spdk_cunit_print_results(const char *filename);