]> xenbits.xensource.com Git - libvirt.git/commitdiff
tests: qemucapsprobemock: Fail if JSON reply from qemu can't be reformatted
authorPeter Krempa <pkrempa@redhat.com>
Fri, 4 May 2018 13:34:41 +0000 (15:34 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 12 Jun 2018 08:27:50 +0000 (10:27 +0200)
Rather than skipping output on failure fail loudly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
tests/qemucapsprobemock.c

index f26fa6b2850424b039dc6944b5fa64433aa42e0d..a0d2acb69a673dc1a1a63d376fac92b9412df9ae 100644 (file)
@@ -86,9 +86,12 @@ qemuMonitorJSONIOProcessLine(qemuMonitorPtr mon,
 
     ret = realQemuMonitorJSONIOProcessLine(mon, line, msg);
 
-    if (ret == 0 &&
-        (value = virJSONValueFromString(line)) &&
-        (json = virJSONValueToString(value, 1))) {
+    if (ret == 0) {
+        if (!(value = virJSONValueFromString(line)) ||
+            !(json = virJSONValueToString(value, true))) {
+            fprintf(stderr, "Failed to reformat reply string '%s'\n", line);
+            abort();
+        }
 
         if (first) {
             first = false;