From nobody Wed Apr 24 19:58:53 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1559909063; cv=none; d=zoho.com; s=zohoarc; b=jv4T7ByqTqkMy3zAqy39N0P5x0t54AxoOtOzT4tVQ4i4f9bB+zngjsalBlEcXC8eZzU1Okp9OMBiVkuyr5tjfthvR26ZNZqiGeWXiXHnIDbVP+GtPxCifKIqtzNOQnjYaXWOooPbDQ8rMisV4Wpq0VpgjcPEqpULaEifLhbpehA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559909063; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=gFQ8AjynozuCL6gWa80ngqLujVzdRXwTRYlyjQFSLHs=; b=CcfrmLO2gbI5jfgaBirS2He5jtDqziJLM2MHB8xd98HOC3sp5fGn5BGL9FusvGXqHLJThRSJaHSq6TPWJznPdgQr2AEgJWmQtloTOU01lu0b7P59NqjH+Iq+PfSKNfwbFVLWMGRumAaqj1mUbxAZ4JMlybBynllHT0U6d7Kh/FY= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559909063872241.77123621254634; Fri, 7 Jun 2019 05:04:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 775BEC058CBD; Fri, 7 Jun 2019 12:04:12 +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 1C2E17D506; Fri, 7 Jun 2019 12:04: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 497F024AFA; Fri, 7 Jun 2019 12:03:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x57C1LGd014762 for ; Fri, 7 Jun 2019 08:01:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id E86D77DFD2; Fri, 7 Jun 2019 12:01:21 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 739C418394 for ; Fri, 7 Jun 2019 12:01:21 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 7 Jun 2019 14:01:16 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] tests: Refactor cleanup in qemuMonitorTestProcessCommandVerbatim 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: , 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 07 Jun 2019 12:04:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Use VIR_AUTOFREE and get rid of the cleanup section. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemumonitortestutils.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 4a108c382d..1cd35830af 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -688,8 +688,8 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPt= r test, const char *cmdstr) { struct qemuMonitorTestHandlerData *data =3D item->opaque; - char *reformatted =3D NULL; - char *errmsg =3D NULL; + VIR_AUTOFREE(char *) reformatted =3D NULL; + VIR_AUTOFREE(char *) errmsg =3D NULL; int ret =3D -1; /* JSON strings will be reformatted to simplify checking */ @@ -705,7 +705,7 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPt= r test, } else { if (data->cmderr) { if (virAsprintf(&errmsg, "%s: %s", data->cmderr, cmdstr) < 0) - goto cleanup; + return -1; ret =3D qemuMonitorTestAddErrorResponse(test, errmsg); } else { @@ -715,9 +715,6 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPt= r test, } } - cleanup: - VIR_FREE(errmsg); - VIR_FREE(reformatted); return ret; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 19:58:53 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1559909202; cv=none; d=zoho.com; s=zohoarc; b=lYepdip0DRMT/KhK6w9LDWyHcfxtCpmZQe9ttwaro3Iu1RCVZZJryZ2zyHFfoOi37Q7Kie91v/yGdXz9Pt18vantc1hUtPPDCcPZGCIntjFS4xBi6H4TCKLx+Ye8UMkMv6m3RBbnW4OLwYTG2sQ7Q0BEU0BV9hfR5UX+tW+4qaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559909202; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=9WshHMF6uzqqrvS5bzZJFeEwLrVvOwjY3YgVTQ9KKoU=; b=Dq8cmlGekYOPiZtH+fMtV4LJ0AB4UfNjWv7qi1/XExytvxCk6zOeu5ePF8Tx7JvOCslsvIuf6vQJqt3rXsOl7tYHk/oKrryyCtuvkrPYnLk9UjotcYqYUsaP6x+bva2GJqufe5q+8DXQ2M95HYbbk7pxGMTR+f1upUmrfNNNuQk= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559909202736304.14007041384025; Fri, 7 Jun 2019 05:06:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 71B3C2EED05; Fri, 7 Jun 2019 12:06:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1E50110AFF1C; Fri, 7 Jun 2019 12:06:30 +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 D29291833013; Fri, 7 Jun 2019 12:06:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x57C1M9f014780 for ; Fri, 7 Jun 2019 08:01:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id BE7A87DFD2; Fri, 7 Jun 2019 12:01:22 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47E3818394 for ; Fri, 7 Jun 2019 12:01:22 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 7 Jun 2019 14:01:17 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] tests: qemu: Add QMP schema checking in qemuMonitorTestProcessCommandVerbatim 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 07 Jun 2019 12:06:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In case when we are testing a QMP command we can try to schema check it so that we catch inconsistencies. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemumonitortestutils.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 1cd35830af..0de9048243 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -690,14 +690,30 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTest= Ptr test, struct qemuMonitorTestHandlerData *data =3D item->opaque; VIR_AUTOFREE(char *) reformatted =3D NULL; VIR_AUTOFREE(char *) errmsg =3D NULL; + VIR_AUTOPTR(virJSONValue) json =3D NULL; + virJSONValuePtr cmdargs; + const char *cmdname; int ret =3D -1; + int rc; /* JSON strings will be reformatted to simplify checking */ if (test->json || test->agent) { - if (!(reformatted =3D virJSONStringReformat(cmdstr, false))) + if (!(json =3D virJSONValueFromString(cmdstr)) || + !(reformatted =3D virJSONValueToString(json, false))) return -1; cmdstr =3D reformatted; + + /* in this case we do a best-effort schema check if we can find th= e command */ + if ((cmdname =3D virJSONValueObjectGetString(json, "execute"))) { + cmdargs =3D virJSONValueObjectGet(json, "arguments"); + + if ((rc =3D qemuMonitorTestProcessCommandDefaultValidate(test,= cmdname, cmdargs)) < 0) + return -1; + + if (rc =3D=3D 1) + return 0; + } } if (STREQ(data->command_name, cmdstr)) { --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 19:58:53 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1559909080; cv=none; d=zoho.com; s=zohoarc; b=eBDfbWaF6IZk8m2nLVGPUXBsozPdMLpiIDPY6Up+5Y91HByYyTQdoi6WqL3ypIVxcOdjbNOkZuzU7v0QzxC1XE0VFACLxjENgRbc2LSamHygRVUzhyMuZrU+J7z/v1c0SLpqjaz6Ub7Fq2kmBfbdYZ9fS4Najq/yrfOvcxS4+HI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559909080; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=VjaWFab3WR7/9HfXrcyy7OLgaeC4ZhDWtgWPOkERxy4=; b=gGxCdE7J/QmxDyYFXbIi+nHDGuwUxc9owEc2UqTXdDBNQmyxLMS5TokHDubFmnpkD5sxA5/aXlyGUrLFvj3pgUv/fIC/CI27CP5zdrbDaEAYmvTvvLjR8rp7UmVdrnoPSGn4zFKrwF3diMtXTZKKWAVMrZKImnf9v4X0R2lEi4Q= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559909080699106.40253694752948; Fri, 7 Jun 2019 05:04:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B7EF0307D95F; Fri, 7 Jun 2019 12:04:30 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FD8F82EF4; Fri, 7 Jun 2019 12:04:28 +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 0C3CB1806B15; Fri, 7 Jun 2019 12:04:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x57C1NBj014790 for ; Fri, 7 Jun 2019 08:01:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8FC187FA32; Fri, 7 Jun 2019 12:01:23 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 178B118394 for ; Fri, 7 Jun 2019 12:01:22 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 7 Jun 2019 14:01:18 +0200 Message-Id: <7019919eee075ce13f726c459bc815ee9041ae5c.1559908820.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] tests: Allow QMP schema testing in qemuMonitorTestNewFromFileFull 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: , 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Fri, 07 Jun 2019 12:04:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Pass in the schema data from the caller if QMP schema testing is desired. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemucapabilitiestest.c | 3 ++- tests/qemuhotplugtest.c | 2 +- tests/qemumonitortestutils.c | 7 +++++-- tests/qemumonitortestutils.h | 3 ++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c index ac9ab6bfce..67f57a4fdc 100644 --- a/tests/qemucapabilitiestest.c +++ b/tests/qemucapabilitiestest.c @@ -82,7 +82,8 @@ testQemuCaps(const void *opaque) data->dataDir, data->base, data->archName) < 0) goto cleanup; - if (!(mon =3D qemuMonitorTestNewFromFileFull(repliesFile, &data->drive= r, NULL))) + if (!(mon =3D qemuMonitorTestNewFromFileFull(repliesFile, &data->drive= r, NULL, + NULL))) goto cleanup; if (qemuProcessQMPInitMonitor(qemuMonitorTestGetMonitor(mon)) < 0) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index fbf488c54c..08f00b9c72 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -435,7 +435,7 @@ testQemuHotplugCpuPrepare(const char *test, virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); if (!(data->mon =3D qemuMonitorTestNewFromFileFull(data->file_json_mon= itor, - &driver, data->vm))) + &driver, data->vm, NU= LL))) goto error; priv->mon =3D qemuMonitorTestGetMonitor(data->mon); diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 0de9048243..8d7c503c6e 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1396,6 +1396,7 @@ qemuMonitorTestFullAddItem(qemuMonitorTestPtr test, * @fileName: File name to load monitor replies from * @driver: qemu driver object * @vm: domain object (may be null if it's not needed by the test) + * @qmpschema: QMP schema data hash table if QMP checking is required * * Create a JSON test monitor simulator object and fill it with expected c= ommand * sequence and replies specified in @fileName. @@ -1409,7 +1410,8 @@ qemuMonitorTestFullAddItem(qemuMonitorTestPtr test, qemuMonitorTestPtr qemuMonitorTestNewFromFileFull(const char *fileName, virQEMUDriverPtr driver, - virDomainObjPtr vm) + virDomainObjPtr vm, + virHashTablePtr qmpschema) { qemuMonitorTestPtr ret =3D NULL; char *jsonstr =3D NULL; @@ -1423,7 +1425,8 @@ qemuMonitorTestNewFromFileFull(const char *fileName, if (virTestLoadFile(fileName, &jsonstr) < 0) return NULL; - if (!(ret =3D qemuMonitorTestNew(true, driver->xmlopt, vm, driver, NUL= L, NULL))) + if (!(ret =3D qemuMonitorTestNew(true, driver->xmlopt, vm, driver, NUL= L, + qmpschema))) goto cleanup; tmp =3D jsonstr; diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index d2520e08a4..8461c80caa 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -90,7 +90,8 @@ qemuMonitorTestPtr qemuMonitorTestNewFromFile(const char = *fileName, bool simple); qemuMonitorTestPtr qemuMonitorTestNewFromFileFull(const char *fileName, virQEMUDriverPtr driver, - virDomainObjPtr vm); + virDomainObjPtr vm, + virHashTablePtr qmpschem= a); qemuMonitorTestPtr qemuMonitorTestNewAgent(virDomainXMLOptionPtr xmlopt); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed Apr 24 19:58:53 2024 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 ARC-Seal: i=1; a=rsa-sha256; t=1559909090; cv=none; d=zoho.com; s=zohoarc; b=TTZHR2HrJkECYQbiDB8VWJIPhIdowJDOUQJMDMfRxz4KX537IF/Jo/C8FMXAUe3yAv/bhOLjHYPns/pVoKuDmWbWV2iZ8zAwKDmGbQKnOkuOuWVHoG14bjODYWoe2PSPiS2+wRt8FUXYKEI4XklonRwxwKWczs0qUnsQtSVbUNI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1559909090; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4CI5Uyy3/JD/k5B4EWVVXcaZjDAFhR5vSueZUUw8LIg=; b=izrPJOi0EQ/hZgsjJefwhztvnD2e+9ox9C57TWmzrcnL/L4JxlBASnEdk9W4JxBwF48sbjzB/X5xhqnlXVK9ScmLP02urfQaVZ8pmGp+7cIRfozCfm0U0cucn6Qh5azSWSey8D7EoEwxM/XyvkaV8xwNrNpAlXse4d6Gr2Ma5kU= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1559909090169311.2189511829779; Fri, 7 Jun 2019 05:04:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D356D3079B86; Fri, 7 Jun 2019 12:04:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A5BA882A16; Fri, 7 Jun 2019 12:04:36 +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 676991806B1D; Fri, 7 Jun 2019 12:04:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x57C1O6N014795 for ; Fri, 7 Jun 2019 08:01:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5F04E7DFD2; Fri, 7 Jun 2019 12:01:24 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC84218394 for ; Fri, 7 Jun 2019 12:01:23 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 7 Jun 2019 14:01:19 +0200 Message-Id: <04296ddbe4c79f3c21eaddf1695ab4598bc33ebd.1559908820.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] tests: qemuhotplug: Use schema testing with qemuMonitorTestNewFromFileFull 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: , 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 07 Jun 2019 12:04:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Pass in the schema since it works with the 'file' test now. Signed-off-by: Peter Krempa Reviewed-by: Eric Blake --- tests/qemuhotplugtest.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 08f00b9c72..bfbf32baa4 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -27,6 +27,7 @@ #include "qemumonitortestutils.h" #include "testutils.h" #include "testutilsqemu.h" +#include "testutilsqemuschema.h" #include "virerror.h" #include "virstring.h" #include "virthread.h" @@ -394,7 +395,8 @@ testQemuHotplugCpuDataFree(struct testQemuHotplugCpuDat= a *data) static struct testQemuHotplugCpuData * testQemuHotplugCpuPrepare(const char *test, - bool modern) + bool modern, + virHashTablePtr qmpschema) { qemuDomainObjPrivatePtr priv =3D NULL; virCapsPtr caps =3D NULL; @@ -435,7 +437,7 @@ testQemuHotplugCpuPrepare(const char *test, virQEMUCapsSet(priv->qemuCaps, QEMU_CAPS_QUERY_HOTPLUGGABLE_CPUS); if (!(data->mon =3D qemuMonitorTestNewFromFileFull(data->file_json_mon= itor, - &driver, data->vm, NU= LL))) + &driver, data->vm, qm= pschema))) goto error; priv->mon =3D qemuMonitorTestGetMonitor(data->mon); @@ -499,6 +501,7 @@ struct testQemuHotplugCpuParams { bool state; bool modern; bool fail; + virHashTablePtr schema; }; @@ -510,7 +513,8 @@ testQemuHotplugCpuGroup(const void *opaque) int ret =3D -1; int rc; - if (!(data =3D testQemuHotplugCpuPrepare(params->test, params->modern)= )) + if (!(data =3D testQemuHotplugCpuPrepare(params->test, params->modern, + params->schema))) return -1; rc =3D qemuDomainSetVcpusInternal(&driver, data->vm, data->vm->def, @@ -546,7 +550,8 @@ testQemuHotplugCpuIndividual(const void *opaque) int ret =3D -1; int rc; - if (!(data =3D testQemuHotplugCpuPrepare(params->test, params->modern)= )) + if (!(data =3D testQemuHotplugCpuPrepare(params->test, params->modern, + params->schema))) return -1; if (virBitmapParse(params->cpumap, &map, 128) < 0) @@ -580,6 +585,7 @@ testQemuHotplugCpuIndividual(const void *opaque) static int mymain(void) { + VIR_AUTOPTR(virHashTable) qmpschema =3D NULL; int ret =3D 0; struct qemuHotplugTestData data =3D {0}; struct testQemuHotplugCpuParams cpudata; @@ -604,6 +610,13 @@ mymain(void) if (!(driver.domainEventState =3D virObjectEventStateNew())) return EXIT_FAILURE; + if (!(qmpschema =3D testQEMUSchemaLoad())) { + VIR_TEST_VERBOSE("failed to load qapi schema\n"); + return EXIT_FAILURE; + } + + cpudata.schema =3D qmpschema; + driver.lockManager =3D virLockManagerPluginNew("nop", "qemu", driver.config->configBase= Dir, 0); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list