Add a second check for Jansson >= 2.8, which includes
fixes to preserve ordering of object keys.
Use this constant to guard tests that depend on stable ordering.
Signed-off-by: Ján Tomko <jtomko(a)redhat.com>
---
m4/virt-jansson.m4 | 3 +++
tests/qemublocktest.c | 5 +++++
tests/qemucapabilitiestest.c | 5 +++++
tests/qemucommandutiltest.c | 5 +++++
tests/qemuhotplugtest.c | 5 +++++
tests/qemumigparamstest.c | 5 +++++
tests/qemumonitorjsontest.c | 5 +++++
tests/virjsontest.c | 5 +++++
tests/virmacmaptest.c | 5 +++++
tests/virnetdaemontest.c | 5 +++++
10 files changed, 48 insertions(+)
diff --git a/m4/virt-jansson.m4 b/m4/virt-jansson.m4
index 206d6a5ced..ab4c020f62 100644
--- a/m4/virt-jansson.m4
+++ b/m4/virt-jansson.m4
@@ -22,6 +22,9 @@ AC_DEFUN([LIBVIRT_ARG_JANSSON],[
AC_DEFUN([LIBVIRT_CHECK_JANSSON],[
dnl Jansson
http://www.digip.org/jansson/
LIBVIRT_CHECK_PKG([JANSSON], [jansson], [2.5])
+ dnl Older versions of Jansson did not preserve the order of object keys
+ dnl use this check to guard the tests that are sensitive to this
+ LIBVIRT_CHECK_PKG([STABLE_ORDERING_JANSSON], [jansson], [2.8], [true])
])
AC_DEFUN([LIBVIRT_RESULT_JANSSON],[
diff --git a/tests/qemublocktest.c b/tests/qemublocktest.c
index 9a387cf063..d22b4b754e 100644
--- a/tests/qemublocktest.c
+++ b/tests/qemublocktest.c
@@ -337,6 +337,11 @@ mymain(void)
char *capslatest_x86_64 = NULL;
virQEMUCapsPtr caps_x86_64 = NULL;
+#if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
if (qemuTestDriverInit(&driver) < 0)
return EXIT_FAILURE;
diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
index 641ec4f597..28f903a88c 100644
--- a/tests/qemucapabilitiestest.c
+++ b/tests/qemucapabilitiestest.c
@@ -141,6 +141,11 @@ mymain(void)
int ret = 0;
testQemuData data;
+#if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
#if !WITH_JANSSON
fputs("libvirt not compiled with JSON support, skipping this test\n",
stderr);
return EXIT_AM_SKIP;
diff --git a/tests/qemucommandutiltest.c b/tests/qemucommandutiltest.c
index 8e57a1b79d..9b13dde63f 100644
--- a/tests/qemucommandutiltest.c
+++ b/tests/qemucommandutiltest.c
@@ -76,6 +76,11 @@ mymain(void)
int ret = 0;
testQemuCommandBuildObjectFromJSONData data1;
+#if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
#if !WITH_JANSSON
fputs("libvirt not compiled with JSON support, skipping this test\n",
stderr);
return EXIT_AM_SKIP;
diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c
index c7bc69ab32..674ba92b27 100644
--- a/tests/qemuhotplugtest.c
+++ b/tests/qemuhotplugtest.c
@@ -589,6 +589,11 @@ mymain(void)
struct qemuHotplugTestData data = {0};
struct testQemuHotplugCpuParams cpudata;
+#if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
#if !WITH_JANSSON
fputs("libvirt not compiled with JSON support, skipping this test\n",
stderr);
return EXIT_AM_SKIP;
diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c
index b8af68211b..5e12430991 100644
--- a/tests/qemumigparamstest.c
+++ b/tests/qemumigparamstest.c
@@ -203,6 +203,11 @@ mymain(void)
virQEMUDriver driver;
int ret = 0;
+#if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
#if !WITH_JANSSON
fputs("libvirt not compiled with JSON support, skipping this test\n",
stderr);
return EXIT_AM_SKIP;
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index c11615f7ac..1826c4f297 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -2863,6 +2863,11 @@ mymain(void)
virJSONValuePtr metaschema = NULL;
char *metaschemastr = NULL;
+#if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
#if !WITH_JANSSON
fputs("libvirt not compiled with JSON support, skipping this test\n",
stderr);
return EXIT_AM_SKIP;
diff --git a/tests/virjsontest.c b/tests/virjsontest.c
index d42413d11d..d352d370fd 100644
--- a/tests/virjsontest.c
+++ b/tests/virjsontest.c
@@ -479,6 +479,11 @@ mymain(void)
{
int ret = 0;
+#if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
#define DO_TEST_FULL(name, cmd, doc, expect, pass) \
do { \
struct testInfo info = { doc, expect, pass }; \
diff --git a/tests/virmacmaptest.c b/tests/virmacmaptest.c
index 6e3e9984d1..420531dcdb 100644
--- a/tests/virmacmaptest.c
+++ b/tests/virmacmaptest.c
@@ -157,6 +157,11 @@ mymain(void)
int ret = 0;
virMacMapPtr mgr = NULL;
+#if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+#endif
+
#define DO_TEST_BASIC(f, d, ...) \
do { \
const char * const m[] = {__VA_ARGS__, NULL }; \
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index cbc961dbaf..277fb06385 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -375,6 +375,11 @@ mymain(void)
int ret = 0;
const char *server_names[] = { "testServer0", "testServer1" };
+# if !WITH_STABLE_ORDERING_JANSSON
+ fputs("libvirt not compiled with recent enough Jansson, skipping this
test\n", stderr);
+ return EXIT_AM_SKIP;
+# endif
+
if (virInitialize() < 0 ||
virEventRegisterDefaultImpl() < 0) {
virDispatchError(NULL);
--
2.16.1