]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unittest: FAIL macro to unconditionally fail a test
authorJason Ish <ish@unx.ca>
Mon, 5 Sep 2016 14:15:26 +0000 (08:15 -0600)
committerVictor Julien <victor@inliniac.net>
Mon, 5 Sep 2016 15:13:20 +0000 (17:13 +0200)
src/util-unittest.h

index cca59b869b56d8c9a721bca6a12ed89f10b92cb1..7a0e110be9cb9c2202318bad1664e2236e6e18d4 100644 (file)
@@ -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.
  */