From: Peter Krempa Date: Fri, 4 May 2018 13:34:41 +0000 (+0200) Subject: tests: qemucapsprobemock: Fail if JSON reply from qemu can't be reformatted X-Git-Tag: v4.5.0-rc1~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9369348eb8084548d0b8e9ddb586260d23fddff4;p=thirdparty%2Flibvirt.git tests: qemucapsprobemock: Fail if JSON reply from qemu can't be reformatted Rather than skipping output on failure fail loudly. Signed-off-by: Peter Krempa Reviewed-by: John Ferlan --- diff --git a/tests/qemucapsprobemock.c b/tests/qemucapsprobemock.c index f26fa6b285..a0d2acb69a 100644 --- a/tests/qemucapsprobemock.c +++ b/tests/qemucapsprobemock.c @@ -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;