From nobody Wed May 14 17:27:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1521744218813306.315619159211; Thu, 22 Mar 2018 11:43:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5365A612A5; Thu, 22 Mar 2018 18:43:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6369B8306E; Thu, 22 Mar 2018 18:34:09 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 18D974CAA6; Thu, 22 Mar 2018 18:34:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w2MIW15I015713 for ; Thu, 22 Mar 2018 14:32:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D73484433; Thu, 22 Mar 2018 18:32:01 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16DA16F9E2; Thu, 22 Mar 2018 18:32:00 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 22 Mar 2018 19:31:48 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 11/11] tests: qemumonitorjson: Do some useful testing in the 'simple' tests X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 22 Mar 2018 18:43:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The 'simple' monitor tests were quite useless, since the code did not even check whether the correct command was called. This patch uses the QAPI schema validator to validate that the arguments are in format according to the schema. Signed-off-by: Peter Krempa --- tests/qemumonitorjsontest.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index a7fc814d4a..97c4fb0a02 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -42,6 +42,7 @@ struct _testQemuMonitorJSONSimpleFuncData { int (* func) (qemuMonitorPtr mon); virDomainXMLOptionPtr xmlopt; const char *reply; + virHashTablePtr schema; }; const char *queryBlockReply =3D @@ -1266,7 +1267,7 @@ testQemuMonitorJSONSimpleFunc(const void *opaque) testQemuMonitorJSONSimpleFuncDataPtr data =3D (testQemuMonitorJSONSimpleFuncDataPtr) opaque; virDomainXMLOptionPtr xmlopt =3D data->xmlopt; - qemuMonitorTestPtr test =3D qemuMonitorTestNewSimple(true, xmlopt); + qemuMonitorTestPtr test =3D qemuMonitorTestNewSchema(xmlopt, data->sch= ema); const char *reply =3D data->reply; int ret =3D -1; @@ -2896,6 +2897,13 @@ mymain(void) virEventRegisterDefaultImpl(); + if (!(qapiData.schema =3D testQEMUSchemaLoad())) { + VIR_TEST_VERBOSE("failed to load qapi schema\n"); + ret =3D -1; + goto cleanup; + } + simpleFunc.schema =3D qapiData.schema; + #define DO_TEST(name) \ if (virTestRun(# name, testQemuMonitorJSON ## name, driver.xmlopt) < 0= ) \ ret =3D -1 @@ -3042,11 +3050,6 @@ mymain(void) ret =3D -1; \ } while (0) - if (!(qapiData.schema =3D testQEMUSchemaLoad())) { - VIR_TEST_VERBOSE("failed to load qapi schema\n"); - ret =3D -1; - goto cleanup; - } DO_TEST_QAPI_SCHEMA("string", "trace-event-get-state/arg-type", true, "{\"name\":\"test\"}"); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list