From nobody Sat Feb 7 10:44:33 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=reject dis=none) header.from=linux.ibm.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1712720197458621.2152586028518; Tue, 9 Apr 2024 20:36:37 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 30BA51A72; Tue, 9 Apr 2024 23:36:36 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id BD8A81884; Tue, 9 Apr 2024 23:35:48 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 7C9CA1884; Tue, 9 Apr 2024 23:35:46 -0400 (EDT) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id EC8D81895 for ; Tue, 9 Apr 2024 23:35:45 -0400 (EDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 43A31ijb010097 for ; Wed, 10 Apr 2024 03:14:41 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3xdg86g7eg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 10 Apr 2024 03:14:40 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 43A0xPTs029951 for ; Wed, 10 Apr 2024 03:14:40 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3xbj7ma5e1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 10 Apr 2024 03:14:40 +0000 Received: from smtpav03.dal12v.mail.ibm.com (smtpav03.dal12v.mail.ibm.com [10.241.53.102]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 43A3EbqX27722332 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 10 Apr 2024 03:14:39 GMT Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3EBA258056; Wed, 10 Apr 2024 03:14:37 +0000 (GMT) Received: from smtpav03.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4EA2858061; Wed, 10 Apr 2024 03:14:36 +0000 (GMT) Received: from libvirt-dev-u221.fyre.ibm.com (unknown [9.112.252.183]) by smtpav03.dal12v.mail.ibm.com (Postfix) with ESMTP; Wed, 10 Apr 2024 03:14:36 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Greylist: delayed 1283 seconds by postgrey-1.37 at lists.libvirt.org; Tue, 09 Apr 2024 23:35:45 EDT From: wucf@linux.ibm.com To: devel@lists.libvirt.org Cc: Chun Feng Wu Subject: [PATCH RFC 08/12] tests: Test qemuMonitorJSONGetThrottleGroup and qemuMonitorJSONUpdateThrottleGroup Date: Tue, 9 Apr 2024 20:13:16 -0700 Message-Id: <20240410031320.1288203-9-wucf@linux.ibm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240410031320.1288203-1-wucf@linux.ibm.com> References: <20240410031320.1288203-1-wucf@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: eph3wLE_NHf1CWyRLRfE6AN4fQWA51ix X-Proofpoint-ORIG-GUID: eph3wLE_NHf1CWyRLRfE6AN4fQWA51ix X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-09_12,2024-04-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 priorityscore=1501 impostorscore=0 mlxlogscore=909 spamscore=0 phishscore=0 clxscore=1015 lowpriorityscore=0 bulkscore=0 adultscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2404010000 definitions=main-2404100022 Message-ID-Hash: Z4ZJEIBFAT7XIOJ5XL5BZHVEYPBOBVLR X-Message-ID-Hash: Z4ZJEIBFAT7XIOJ5XL5BZHVEYPBOBVLR X-MailFrom: wucf@linux.ibm.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1712720199053100001 From: Chun Feng Wu Within "testQemuMonitorJSONqemuMonitorJSONUpdateThrottleGroup" * Test qemuMonitorJSONGetThrottleGroup * Test qemuMonitorJSONUpdateThrottleGroup, which updates limits through "qo= m-set" Signed-off-by: Chun Feng Wu --- tests/qemumonitorjsontest.c | 89 +++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 45cee23798..dec26d9e61 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -147,6 +147,32 @@ const char *queryBlockReply =3D " \"id\": \"libvirt-10\"" "}"; =20 +const char *qomGetReply =3D +"{" +" \"return\": {" +" \"bps-total\": 1," +" \"bps-read\": 2," +" \"bps-write\": 3," +" \"iops-total\": 4," +" \"iops-read\": 5," +" \"iops-write\": 6," +" \"bps-total-max\": 7," +" \"bps-read-max\": 8," +" \"bps-write-max\": 9," +" \"iops-total-max\": 10," +" \"iops-read-max\": 11," +" \"iops-write-max\": 12," +" \"iops-size\": 13," +" \"bps-total-max-length\": 15," +" \"bps-read-max-length\": 16," +" \"bps-write-max-length\": 17," +" \"iops-total-max-length\": 18," +" \"iops-read-max-length\": 19," +" \"iops-write-max-length\": 20" +" }," +" \"id\": \"libvirt-12\"" +"}"; + static int testQemuMonitorJSONGetStatus(const void *opaque) { @@ -1853,6 +1879,68 @@ testQemuMonitorJSONqemuMonitorJSONSetBlockIoThrottle= (const void *opaque) return ret; } =20 +static int +testQemuMonitorJSONqemuMonitorJSONUpdateThrottleGroup(const void *opaque) +{ + const testGenericData *data =3D opaque; + virDomainXMLOption *xmlopt =3D data->xmlopt; + int ret =3D -1; + virDomainBlockIoTuneInfo info, expectedInfo; + g_autoptr(qemuMonitorTest) test =3D NULL; + + if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) + return -1; + + expectedInfo =3D (virDomainBlockIoTuneInfo) {1, 2, 3, 4, 5, 6, 7, 8, 9= , 10, 11, 12, 13, NULL, 15, 16, 17, 18, 19, 20}; + expectedInfo.group_name =3D g_strdup("limit0"); + + if (qemuMonitorTestAddItem(test, "qom-get", qomGetReply) < 0) + return -1; + + if (qemuMonitorTestAddItemVerbatim(test, + "{\"execute\":\"qom-set\"," + " \"arguments\":{\"property\": \"li= mits\"," + " \"path\": \"limit1= \"," + " \"value\":{\"bps-t= otal\": 1," + " \"bps-r= ead\": 2," + " \"bps-w= rite\": 3," + " \"iops-= total\": 4," + " \"iops-= read\": 5," + " \"iops-= write\": 6," + " \"bps-t= otal-max\": 7," + " \"bps-r= ead-max\": 8," + " \"bps-w= rite-max\": 9," + " \"iops-= total-max\": 10," + " \"iops-= read-max\": 11," + " \"iops-= write-max\": 12," + " \"iops-= size\": 13," + " \"bps-t= otal-max-length\": 15," + " \"bps-r= ead-max-length\": 16," + " \"bps-w= rite-max-length\": 17," + " \"iops-= total-max-length\": 18," + " \"iops-= read-max-length\": 19," + " \"iops-= write-max-length\": 20}}," + " \"id\":\"libvirt-2\"}", + NULL, + "{ \"return\" : {}}") < 0) + return -1; + + if (qemuMonitorJSONGetThrottleGroup(qemuMonitorTestGetMonitor(test), + "limit0", &info) < 0) + goto cleanup; + + if (testValidateGetBlockIoThrottle(&info, &expectedInfo) < 0) + goto cleanup; + + if (qemuMonitorJSONUpdateThrottleGroup(qemuMonitorTestGetMonitor(test), + "limit1", &info) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + return ret; +} + static int testQemuMonitorJSONqemuMonitorJSONGetTargetArch(const void *opaque) { @@ -2899,6 +2987,7 @@ mymain(void) DO_TEST(qemuMonitorJSONGetMigrationStats); DO_TEST(qemuMonitorJSONGetChardevInfo); DO_TEST(qemuMonitorJSONSetBlockIoThrottle); + DO_TEST(qemuMonitorJSONUpdateThrottleGroup); DO_TEST(qemuMonitorJSONGetTargetArch); DO_TEST(qemuMonitorJSONGetMigrationCapabilities); DO_TEST(qemuMonitorJSONQueryCPUsFast); --=20 2.34.1 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org