]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: skip qemublocktest if building without YAJL
authorDaniel P. Berrangé <berrange@redhat.com>
Tue, 4 Sep 2018 11:00:14 +0000 (12:00 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 4 Sep 2018 11:00:14 +0000 (12:00 +0100)
If no JSON parser is available qemublocktest fails, so skip its execution.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/qemublocktest.c

index 0c335abc5b6f9ff7d78467ba60cbbb712ea9b43d..8e8773e6a882c3a3da32e424044d7412fa1fcc2d 100644 (file)
 #include <stdlib.h>
 
 #include "testutils.h"
-#include "testutilsqemu.h"
-#include "testutilsqemuschema.h"
-#include "virstoragefile.h"
-#include "virstring.h"
-#include "virlog.h"
-#include "qemu/qemu_block.h"
-#include "qemu/qemu_qapi.h"
 
-#include "qemu/qemu_command.h"
+#if WITH_YAJL
+# include "testutilsqemu.h"
+# include "testutilsqemuschema.h"
+# include "virstoragefile.h"
+# include "virstring.h"
+# include "virlog.h"
+# include "qemu/qemu_block.h"
+# include "qemu/qemu_qapi.h"
 
-#define VIR_FROM_THIS VIR_FROM_NONE
+# include "qemu/qemu_command.h"
+
+# define VIR_FROM_THIS VIR_FROM_NONE
 
 VIR_LOG_INIT("tests.storagetest");
 
@@ -355,7 +357,7 @@ mymain(void)
 
     virTestCounterReset("qemu storage source xml->json->xml ");
 
-#define TEST_JSON_FORMAT(tpe, xmlstr) \
+# define TEST_JSON_FORMAT(tpe, xmlstr) \
     do { \
         xmljsonxmldata.type = tpe; \
         xmljsonxmldata.xml = xmlstr; \
@@ -364,7 +366,7 @@ mymain(void)
             ret = -1; \
     } while (0)
 
-#define TEST_JSON_FORMAT_NET(xmlstr)\
+# define TEST_JSON_FORMAT_NET(xmlstr) \
     TEST_JSON_FORMAT(VIR_STORAGE_TYPE_NETWORK, xmlstr)
 
     TEST_JSON_FORMAT(VIR_STORAGE_TYPE_FILE, "<source file='/path/to/file'/>\n");
@@ -417,7 +419,7 @@ mymain(void)
                          "  <host name='example.com' port='9999'/>\n"
                          "</source>\n");
 
-#define TEST_DISK_TO_JSON_FULL(nme, fl) \
+# define TEST_DISK_TO_JSON_FULL(nme, fl) \
     do { \
         diskxmljsondata.name = nme; \
         diskxmljsondata.props = NULL; \
@@ -435,7 +437,7 @@ mymain(void)
         testQemuDiskXMLToPropsClear(&diskxmljsondata); \
     } while (0)
 
-#define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)
+# define TEST_DISK_TO_JSON(nme) TEST_DISK_TO_JSON_FULL(nme, false)
 
     if (!(diskxmljsondata.schema = testQEMUSchemaLoad())) {
         ret = -1;
@@ -500,4 +502,12 @@ mymain(void)
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
+#else
+static int
+mymain(void)
+{
+    return EXIT_AM_SKIP;
+}
+#endif
+
 VIR_TEST_MAIN(mymain)