From dfd282f6200efbcce4a4eedc3f0fba1e277c07be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 4 Sep 2018 12:00:14 +0100 Subject: [PATCH] tests: skip qemublocktest if building without YAJL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If no JSON parser is available qemublocktest fails, so skip its execution. Signed-off-by: Daniel P. Berrangé --- tests/qemublocktest.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c index 0c335abc5b..8e8773e6a8 100644 --- a/tests/qemublocktest.c +++ b/tests/qemublocktest.c @@ -19,17 +19,19 @@ #include #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, "\n"); @@ -417,7 +419,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; \ @@ -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)