Преглед изворни кода

libdpkg: Add new test_bail() macro

Guillem Jover пре 12 година
родитељ
комит
c0ee47fb75
1 измењених фајлова са 7 додато и 0 уклоњено
  1. 7 0
      lib/dpkg/test.h

+ 7 - 0
lib/dpkg/test.h

@@ -23,6 +23,7 @@
 
 #include <assert.h>
 #include <string.h>
+#include <stdio.h>
 
 #ifndef TEST_MAIN_PROVIDED
 #include <dpkg/ehandle.h>
@@ -37,6 +38,12 @@
  * @{
  */
 
+#define test_bail(reason) \
+	do { \
+		printf("Bail out! %s\n", (reason)); \
+		exit(99); \
+	} while (0)
+
 #define test_pass(a)			assert((a))
 #define test_fail(a)			assert(!(a))
 #define test_str(a, op, b)		assert(strcmp((a), (b)) op 0)