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 <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Peter Krempa 2018-05-04 15:34:41 +02:00
parent 0ed2716531
commit 9369348eb8

View 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;