[libvirt] [PATCH] Remove redundant usage of WITH_YAJL

Ján Tomko jtomko at redhat.com
Thu Dec 12 17:22:48 UTC 2019


As of commit 2a00ef6e71f30241f9ca6288da984d75f3cef957 which
was released in v5.2.0, we require YAJL to build the QEMU driver.

Remove the checks from code that requires the QEMU driver
or checks that also check for WITH_QEMU.

Signed-off-by: Ján Tomko <jtomko at redhat.com>
---
 src/qemu/qemu_driver.c      |  5 -----
 tests/cputest.c             | 16 +++++++-------
 tests/qemuagenttest.c       |  5 -----
 tests/qemublocktest.c       | 42 ++++++++++++++-----------------------
 tests/qemumigparamstest.c   |  5 -----
 tests/qemumonitorjsontest.c |  5 -----
 6 files changed, 24 insertions(+), 54 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e65150f42b..66c58d190f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2104,11 +2104,6 @@ qemuDomainRebootMonitor(virQEMUDriverPtr driver,
     if (virDomainObjCheckActive(vm) < 0)
         goto endjob;
 
-#if !WITH_YAJL
-    virReportError(VIR_ERR_OPERATION_INVALID, "%s",
-                   _("ACPI reboot is not supported without the JSON monitor"));
-    goto endjob;
-#endif
     qemuDomainSetFakeReboot(driver, vm, isReboot);
     qemuDomainObjEnterMonitor(driver, vm);
     ret = qemuMonitorSystemPowerdown(priv->mon);
diff --git a/tests/cputest.c b/tests/cputest.c
index fd86344ea4..f57516838b 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -36,7 +36,7 @@
 #include "cpu/cpu_map.h"
 #include "virstring.h"
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU
 # include "testutilsqemu.h"
 # include "qemumonitortestutils.h"
 # define LIBVIRT_QEMU_CAPSPRIV_H_ALLOW
@@ -62,7 +62,7 @@ struct data {
     int result;
 };
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU
 static virQEMUDriver driver;
 #endif
 
@@ -465,7 +465,7 @@ typedef enum {
     JSON_MODELS_REQUIRED,
 } cpuTestCPUIDJson;
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU
 static virQEMUCapsPtr
 cpuTestMakeQEMUCaps(const struct data *data)
 {
@@ -547,7 +547,7 @@ cpuTestGetCPUModels(const struct data *data,
     return 0;
 }
 
-#else /* if WITH_QEMU && WITH_YAJL */
+#else /* if WITH_QEMU */
 
 static int
 cpuTestGetCPUModels(const struct data *data,
@@ -871,7 +871,7 @@ cpuTestUpdateLive(const void *arg)
 }
 
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU
 static int
 cpuTestJSONCPUID(const void *arg)
 {
@@ -970,7 +970,7 @@ mymain(void)
     virDomainCapsCPUModelsPtr ppc_models = NULL;
     int ret = 0;
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU
     if (qemuTestDriverInit(&driver) < 0)
         return EXIT_FAILURE;
 
@@ -1057,7 +1057,7 @@ mymain(void)
             host "/" cpu " (" #models ")", \
             host, cpu, models, 0, result)
 
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU
 # define DO_TEST_JSON(arch, host, json) \
     do { \
         if (json == JSON_MODELS) { \
@@ -1270,7 +1270,7 @@ mymain(void)
     DO_TEST_CPUID(VIR_ARCH_X86_64, "Ice-Lake-Server", JSON_MODELS);
 
  cleanup:
-#if WITH_QEMU && WITH_YAJL
+#if WITH_QEMU
     qemuTestDriverFree(&driver);
 #endif
 
diff --git a/tests/qemuagenttest.c b/tests/qemuagenttest.c
index d8824b8f09..644dc9d08b 100644
--- a/tests/qemuagenttest.c
+++ b/tests/qemuagenttest.c
@@ -1426,11 +1426,6 @@ mymain(void)
 {
     int ret = 0;
 
-#if !WITH_YAJL
-    fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
-    return EXIT_AM_SKIP;
-#endif
-
     if (qemuTestDriverInit(&driver) < 0)
         return EXIT_FAILURE;
 
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 2c170548ec..c9335774b9 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -18,22 +18,20 @@
 
 
 #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"
 
-#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"
+#include "qemu/qemu_command.h"
 
-# include "qemu/qemu_command.h"
+#define LIBVIRT_SNAPSHOT_CONF_PRIV_H_ALLOW
+#include "conf/snapshot_conf_priv.h"
 
-# define LIBVIRT_SNAPSHOT_CONF_PRIV_H_ALLOW
-# include "conf/snapshot_conf_priv.h"
-
-# define VIR_FROM_THIS VIR_FROM_NONE
+#define VIR_FROM_THIS VIR_FROM_NONE
 
 VIR_LOG_INIT("tests.storagetest");
 
@@ -523,7 +521,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; \
@@ -532,7 +530,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");
@@ -588,7 +586,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; \
@@ -611,7 +609,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;
@@ -667,7 +665,7 @@ mymain(void)
     TEST_DISK_TO_JSON("block-raw-noopts");
     TEST_DISK_TO_JSON("block-raw-reservations");
 
-# define TEST_IMAGE_CREATE(testname, testbacking) \
+#define TEST_IMAGE_CREATE(testname, testbacking) \
     do { \
         imagecreatedata.name = testname; \
         imagecreatedata.backingname = testbacking; \
@@ -711,12 +709,4 @@ mymain(void)
     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
-#else
-static int
-mymain(void)
-{
-    return EXIT_AM_SKIP;
-}
-#endif
-
 VIR_TEST_MAIN(mymain)
diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c
index b36aa60302..954cd1c578 100644
--- a/tests/qemumigparamstest.c
+++ b/tests/qemumigparamstest.c
@@ -201,11 +201,6 @@ mymain(void)
     virQEMUDriver driver;
     int ret = 0;
 
-#if !WITH_YAJL
-    fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
-    return EXIT_AM_SKIP;
-#endif
-
     if (qemuTestDriverInit(&driver) < 0)
         return EXIT_FAILURE;
 
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 4f3bfad1d7..21b029390c 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2991,11 +2991,6 @@ mymain(void)
     virJSONValuePtr metaschema = NULL;
     char *metaschemastr = NULL;
 
-#if !WITH_YAJL
-    fputs("libvirt not compiled with JSON support, skipping this test\n", stderr);
-    return EXIT_AM_SKIP;
-#endif
-
     if (qemuTestDriverInit(&driver) < 0)
         return EXIT_FAILURE;
 
-- 
2.19.2




More information about the libvir-list mailing list