|
|
fbe740 |
From 881e24d9b7545122a4b74f4545135bffe98fab4c Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <881e24d9b7545122a4b74f4545135bffe98fab4c@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Sun, 26 Apr 2020 13:04:04 -0400
|
|
|
fbe740 |
Subject: [PATCH] qemuMonitorTestProcessCommandDefaultValidate: Output
|
|
|
fbe740 |
validator output to stderr
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Trying to squeeze the validator output into the monitor reply message
|
|
|
fbe740 |
doesn't make sense and doesn't work well as it's not well formed JSON:
|
|
|
fbe740 |
|
|
|
fbe740 |
54) qemuMonitorJSONAddNetdev ... libvirt: error : internal error: cannot parse json { "error": { "desc": "failed to validate arguments of 'netdev_add' against QAPI schema: {
|
|
|
fbe740 |
ERROR: variant 'test' for discriminator 'type' not found
|
|
|
fbe740 |
", "class": "UnexpectedCommand" } }: lexical error: invalid character inside string.
|
|
|
fbe740 |
ev_add' against QAPI schema: { ERROR: variant 'test' for
|
|
|
fbe740 |
(right here) ------^
|
|
|
fbe740 |
FAILED
|
|
|
fbe740 |
|
|
|
fbe740 |
Output it to stderr if requested and just note that schema validation
|
|
|
fbe740 |
failed in the error message:
|
|
|
fbe740 |
|
|
|
fbe740 |
54) qemuMonitorJSONAddNetdev ...
|
|
|
fbe740 |
failed to validate arguments of 'netdev_add' against QAPI schema
|
|
|
fbe740 |
args:
|
|
|
fbe740 |
{
|
|
|
fbe740 |
"id": "net0",
|
|
|
fbe740 |
"type": "test"
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
validator output:
|
|
|
fbe740 |
{
|
|
|
fbe740 |
ERROR: variant 'test' for discriminator 'type' not found
|
|
|
fbe740 |
|
|
|
fbe740 |
libvirt: QEMU Driver error : internal error: unable to execute QEMU command 'netdev_add': failed to validate arguments of 'netdev_add' against QAPI schema (to see debug output use VIR_TEST_DEBUG=2)
|
|
|
fbe740 |
FAILED
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 5a13eb165559039bda2c1e0e4149dba0e0af820e)
|
|
|
fbe740 |
|
|
|
fbe740 |
Required on 8.2.1 branch due to adding caps_5.0.0.x86_64.replies
|
|
|
fbe740 |
Prerequisite for https://bugzilla.redhat.com/1802592
|
|
|
fbe740 |
Signed-off-by: Laine Stump <laine@redhat.com>
|
|
|
fbe740 |
Message-Id: <20200426170415.18328-2-laine@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
tests/qemumonitortestutils.c | 13 +++++++++++--
|
|
|
fbe740 |
1 file changed, 11 insertions(+), 2 deletions(-)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
|
|
|
fbe740 |
index b29e5d8cd2..b72f186374 100644
|
|
|
fbe740 |
--- a/tests/qemumonitortestutils.c
|
|
|
fbe740 |
+++ b/tests/qemumonitortestutils.c
|
|
|
fbe740 |
@@ -537,10 +537,19 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMonitorTestPtr test,
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
if (testQEMUSchemaValidate(args, schemaroot, test->qapischema, &debug) < 0) {
|
|
|
fbe740 |
+ if (virTestGetDebug() == 2) {
|
|
|
fbe740 |
+ g_autofree char *argstr = virJSONValueToString(args, true);
|
|
|
fbe740 |
+ fprintf(stderr,
|
|
|
fbe740 |
+ "\nfailed to validate arguments of '%s' against QAPI schema\n"
|
|
|
fbe740 |
+ "args:\n%s\nvalidator output:\n %s\n",
|
|
|
fbe740 |
+ cmdname, NULLSTR(argstr), virBufferCurrentContent(&debug));
|
|
|
fbe740 |
+ }
|
|
|
fbe740 |
+
|
|
|
fbe740 |
if (qemuMonitorReportError(test,
|
|
|
fbe740 |
"failed to validate arguments of '%s' "
|
|
|
fbe740 |
- "against QAPI schema: %s",
|
|
|
fbe740 |
- cmdname, virBufferCurrentContent(&debug)) == 0)
|
|
|
fbe740 |
+ "against QAPI schema "
|
|
|
fbe740 |
+ "(to see debug output use VIR_TEST_DEBUG=2)",
|
|
|
fbe740 |
+ cmdname) == 0)
|
|
|
fbe740 |
return 1;
|
|
|
fbe740 |
return -1;
|
|
|
fbe740 |
}
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.26.2
|
|
|
fbe740 |
|