From: Jason Ish Date: Mon, 5 Sep 2016 14:15:26 +0000 (-0600) Subject: unittest: FAIL macro to unconditionally fail a test X-Git-Tag: suricata-3.1.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a42e8be0362d5aaab8f42e382ef678a54e74a33;p=thirdparty%2Fsuricata.git unittest: FAIL macro to unconditionally fail a test --- diff --git a/src/util-unittest.h b/src/util-unittest.h index cca59b869b..7a0e110be9 100644 --- a/src/util-unittest.h +++ b/src/util-unittest.h @@ -54,6 +54,17 @@ void UtRunModeRegister(void); extern int unittests_fatal; +/** + * \breif Fail a test. + */ +#define FAIL do { \ + if (unittests_fatal) { \ + BUG_ON(1); \ + } else { \ + return 0; \ + } \ + } while (0) + /** * \brief Fail a test if expression evaluates to false. */