test: move shared definitions to kdbus-util.h to use them in other tests
authorDjalal Harouni <tixxdz@opendz.org>
Mon, 18 Aug 2014 10:59:59 +0000 (11:59 +0100)
committerDaniel Mack <zonque@gmail.com>
Tue, 19 Aug 2014 07:16:48 +0000 (09:16 +0200)
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
test/kdbus-util.h
test/test-kdbus.c

index 765f6af683cea4d3e30ecdce3adb28472c3f56c9..342ea9bc1a5d0c8b49b402272de6ede04d461db6 100644 (file)
             (uint8_t *)(item) < (uint8_t *)(head) + (head)->size;      \
             item = KDBUS_ITEM_NEXT(item))
 
+enum {
+       CHECK_OK,
+       CHECK_SKIP,
+       CHECK_ERR,
+};
+
+#define ASSERT_RETURN(cond)            \
+       if (!(cond)) {                  \
+               fprintf(stderr, "Assertion '%s' failed in %s(), line %d\n", #cond, __func__, __LINE__); \
+               return CHECK_ERR;       \
+       }
+
 /* Dump as user of process, useful for user namespace testing */
 #define SUID_DUMP_USER 1
 
index 2db7eb81a4ffcba4a3b8ce258ae5e40978f79793..482dd5b82aa9cc86eaa88f758a5f212d2516eada 100644 (file)
 #include "kdbus-util.h"
 #include "kdbus-enum.h"
 
-enum {
-       CHECK_OK,
-       CHECK_SKIP,
-       CHECK_ERR,
-};
-
 enum {
        CHECK_CREATE_BUS        = 1 << 0,
        CHECK_CREATE_CONN       = 1 << 1,
@@ -61,12 +55,6 @@ struct kdbus_check {
                        KDBUS_ATTACH_SECLABEL   |       \
                        KDBUS_ATTACH_AUDIT
 
-#define ASSERT_RETURN(cond)            \
-       if (!(cond)) {                  \
-               fprintf(stderr, "Assertion '%s' failed in %s(), line %d\n", #cond, __func__, __LINE__); \
-               return CHECK_ERR;       \
-       }
-
 static struct kdbus_conn *make_conn(const char *buspath, uint64_t flags)
 {
        int ret;