From 20071c9f99e94e45e12431da8d20e07250aeb21e Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Thu, 12 Dec 2019 18:17:08 +0100 Subject: [PATCH] Remove redundant usage of WITH_YAJL MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Michal Privoznik --- src/qemu/qemu_driver.c | 5 ---- tests/cputest.c | 16 ++++++------ tests/qemuagenttest.c | 5 ---- tests/qemublocktest.c | 50 +++++++++++++++--------------------- tests/qemucapabilitiestest.c | 5 ---- tests/qemucaps2xmltest.c | 5 ---- tests/qemucommandutiltest.c | 5 ---- tests/qemuhotplugtest.c | 5 ---- tests/qemumigparamstest.c | 5 ---- tests/qemumonitorjsontest.c | 5 ---- 10 files changed, 28 insertions(+), 78 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index accffef168..7a7f388767 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 b44b18404f..279f788162 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) { \ @@ -1271,7 +1271,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 078067d1a5..3e9edb85f0 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -18,24 +18,22 @@ #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_monitor_json.h" +#include "qemu/qemu_backup.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_monitor_json.h" -# include "qemu/qemu_backup.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"); @@ -733,7 +731,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; \ @@ -742,7 +740,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, "\n"); @@ -798,7 +796,7 @@ mymain(void) " \n" "\n"); -# define TEST_DISK_TO_JSON_FULL(nme, fl) \ +#define TEST_DISK_TO_JSON_FULL(nme, fl) \ do { \ diskxmljsondata.name = nme; \ diskxmljsondata.props = NULL; \ @@ -821,7 +819,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; @@ -877,7 +875,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; \ @@ -912,7 +910,7 @@ mymain(void) TEST_IMAGE_CREATE("network-ssh-qcow2", NULL); TEST_IMAGE_CREATE("network-sheepdog-qcow2", NULL); -# define TEST_BITMAP_DETECT(testname) \ +#define TEST_BITMAP_DETECT(testname) \ do { \ if (virTestRun("bitmap detect " testname, \ testQemuDetectBitmaps, testname) < 0) \ @@ -923,7 +921,7 @@ mymain(void) TEST_BITMAP_DETECT("synthetic"); TEST_BITMAP_DETECT("snapshots"); -# define TEST_BACKUP_BITMAP_CALCULATE(testname, source, incrbackup, named) \ +#define TEST_BACKUP_BITMAP_CALCULATE(testname, source, incrbackup, named) \ do { \ backupbitmapcalcdata.name = testname; \ backupbitmapcalcdata.chain = source; \ @@ -952,12 +950,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/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index b38c0f6f65..ad1a1f30ee 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -212,11 +212,6 @@ mymain(void) { testQemuData data; -#if !WITH_YAJL - fputs("libvirt not compiled with JSON support, skipping this test\n", stderr); - return EXIT_AM_SKIP; -#endif - virEventRegisterDefaultImpl(); if (testQemuDataInit(&data) < 0) diff --git a/tests/qemucaps2xmltest.c b/tests/qemucaps2xmltest.c index 87ea46ccdb..7a5125fea6 100644 --- a/tests/qemucaps2xmltest.c +++ b/tests/qemucaps2xmltest.c @@ -201,11 +201,6 @@ mymain(void) { testQemuData data; -#if !WITH_YAJL - fputs("libvirt not compiled with JSON support, skipping this test\n", stderr); - return EXIT_AM_SKIP; -#endif - virEventRegisterDefaultImpl(); if (testQemuDataInit(&data) < 0) diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c index f0921e3b93..c5b3e7b735 100644 --- a/tests/qemucommandutiltest.c +++ b/tests/qemucommandutiltest.c @@ -76,11 +76,6 @@ mymain(void) int ret = 0; testQemuCommandBuildObjectFromJSONData data1; -#if !WITH_YAJL - fputs("libvirt not compiled with JSON support, skipping this test\n", stderr); - return EXIT_AM_SKIP; -#endif - virTestCounterReset("testQemuCommandBuildFromJSON"); #define DO_TEST_COMMAND_FROM_JSON(PROPS, ARRAYFUNC, EXPECT) \ diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 8e7273b673..fc2239b28b 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -599,11 +599,6 @@ mymain(void) setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); -#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/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 3b0f85e7c9..0334f83628 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.47.2