From 2a42e8be0362d5aaab8f42e382ef678a54e74a33 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Mon, 5 Sep 2016 08:15:26 -0600 Subject: [PATCH] unittest: FAIL macro to unconditionally fail a test --- src/util-unittest.h | 11 +++++++++++ 1 file changed, 11 insertions(+) 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. */