From nobody Sun May 5 08:41:56 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=1560599665; cv=none; d=zoho.com; s=zohoarc; b=HHH/e2HrO8g5K6gHmsn9YoY8QfLRrI+21/cujuv5mCVvTm3yeIbFSGbf1Sn+MwXu3J328tdA5gKLSlai35TVEvhk/ZefacId2lg5Efan/0VnNaV/zXClHn5izkLZGpH0WCHUNyXR/jUezRnXrzrwKwMQdrambcxJIucdFDbbcI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599665; 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=VwSNsSX3ohZYcgh80MtZmhaiX3tqskkSEbvChzbyHdE=; b=ilTEDKR/bdER/oNTXF6gqrGhuhT+04XQveiiGopYLl9iUdZUcQnvL2ervzHwTrW5VqGa5jJfXgDzW7AbSBf1EBcL1HaRxWByHugrXkDGBnY+ljMOonBLa9PApT8sQ7uN65FPNfddnzU+42nqfDe5W5Fi1cDABLbK7EOL0ROtBJQ= 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 1560599665386901.1886367084288; Sat, 15 Jun 2019 04:54:25 -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 7FB5FC18B2CB; Sat, 15 Jun 2019 11:54:23 +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 545AD1001B14; Sat, 15 Jun 2019 11:54:23 +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 14D591806B1B; Sat, 15 Jun 2019 11:54:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBrebl003285 for ; Sat, 15 Jun 2019 07:53:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2785F1975F; Sat, 15 Jun 2019 11:53:40 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id F107819700 for ; Sat, 15 Jun 2019 11:53:38 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:53:59 +0200 Message-Id: <3675079b42ce8608fe74a7a4d43bc8d14968dc79.1560599610.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/12] tests: assume JSON monitor in qemuMonitorTestNewSimple 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-Type: text/plain; charset="utf-8" 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.31]); Sat, 15 Jun 2019 11:54:24 +0000 (UTC) The only user of the qemuMonitorTestNewSimple macro is using JSON. Always pass 'true' to qemuMonitorTestNew and remove the 'json' argument. Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 2 +- tests/qemumonitortestutils.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 8d7c503c6e..03261d649e 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1318,7 +1318,7 @@ qemuMonitorTestNewFromFile(const char *fileName, if (virTestLoadFile(fileName, &json) < 0) goto cleanup; =20 - if (simple && !(test =3D qemuMonitorTestNewSimple(true, xmlopt))) + if (simple && !(test =3D qemuMonitorTestNewSimple(xmlopt))) goto cleanup; =20 /* Our JSON parser expects replies to be separated by a newline charac= ter. diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index a2d2d30820..23192c1223 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -74,8 +74,8 @@ int qemuMonitorTestAddItemExpect(qemuMonitorTestPtr test, bool apostrophe, const char *response); =20 -# define qemuMonitorTestNewSimple(json, xmlopt) \ - qemuMonitorTestNew(json, xmlopt, NULL, NULL, NULL, NULL) +# define qemuMonitorTestNewSimple(xmlopt) \ + qemuMonitorTestNew(true, xmlopt, NULL, NULL, NULL, NULL) # define qemuMonitorTestNewSchema(xmlopt, schema) \ qemuMonitorTestNew(true, xmlopt, NULL, NULL, NULL, schema) =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599630; cv=none; d=zoho.com; s=zohoarc; b=XYTb7MVb8i6DaUgCDpk1vlSAUv7W1BlJ2aGyzjMXvNI7drotsy5iFSWPNU0aWOaTtGXVP2nW+f28QHC793moM/OMmzjmmFkY0yxIqyDmt6h6imU7glkal/+jVDhh6tAbj+O6vJI9dkEeO7cN2+Xb9KosyWVUfJw0oLLxTvcSCxw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599630; 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=x5iDPpge5xmuoZTLQv4zuX4lb15oDyrS0W6AOQHVR58=; b=N+wfWAO6RBZIP4oVDJ1QnXC98OpLt05x8cES8LdppVYq3MWV/vxCno3WerutHM3rmu7I7sT5X+5GfKUmQrdctz0l4SKgzp751Xsb+xfFzpNI/Grdbst90qQU0juHO2mLGq3MJXMiqOAOp/veOCgIUUH4rB8P6dPcJWDARdVtaf4= 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 1560599630100636.4948213423506; Sat, 15 Jun 2019 04:53:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA8493082AC3; Sat, 15 Jun 2019 11:53:47 +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 4A5A75D982; Sat, 15 Jun 2019 11:53:47 +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 B3921C599; Sat, 15 Jun 2019 11:53:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBrgNI003348 for ; Sat, 15 Jun 2019 07:53:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4B8681975F; Sat, 15 Jun 2019 11:53:42 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 463F9196A7 for ; Sat, 15 Jun 2019 11:53:40 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:00 +0200 Message-Id: <9489afc089bfeebfb63509297b0ac165b9d5f738.1560599610.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] tests: always assume JSON in qemuMonitorTestNew 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-Type: text/plain; charset="utf-8" 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Sat, 15 Jun 2019 11:53:48 +0000 (UTC) Now that all the callers call qemuMonitorTestNew with json=3Dtrue, remove the argument and always assume JSON. Signed-off-by: J=C3=A1n Tomko --- tests/qemuhotplugtest.c | 2 +- tests/qemumonitortestutils.c | 15 ++++++--------- tests/qemumonitortestutils.h | 7 +++---- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index bfbf32baa4..b659565a48 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -280,7 +280,7 @@ testQemuHotplug(const void *data) =20 /* Now is the best time to feed the spoofed monitor with predefined * replies. */ - if (!(test_mon =3D qemuMonitorTestNew(true, driver.xmlopt, vm, &driver, + if (!(test_mon =3D qemuMonitorTestNew(driver.xmlopt, vm, &driver, NULL, NULL))) goto cleanup; =20 diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 03261d649e..86883e682b 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1241,11 +1241,8 @@ qemuMonitorCommonTestInit(qemuMonitorTestPtr test) "}" /* We skip the normal handshake reply of "{\"execute\":\"qmp_capabilities\= "}" */ =20 -#define QEMU_TEXT_GREETING "QEMU 1.0,1 monitor - type 'help' for more info= rmation" - qemuMonitorTestPtr -qemuMonitorTestNew(bool json, - virDomainXMLOptionPtr xmlopt, +qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt, virDomainObjPtr vm, virQEMUDriverPtr driver, const char *greeting, @@ -1259,11 +1256,11 @@ qemuMonitorTestNew(bool json, if (!(test =3D qemuMonitorCommonTestNew(xmlopt, vm, &src))) goto error; =20 - test->json =3D json; + test->json =3D true; test->qapischema =3D schema; if (!(test->mon =3D qemuMonitorOpen(test->vm, &src, - json, + true, true, 0, &qemuMonitorTestCallbacks, @@ -1273,7 +1270,7 @@ qemuMonitorTestNew(bool json, virObjectLock(test->mon); =20 if (!greeting) - greeting =3D json ? QEMU_JSON_GREETING : QEMU_TEXT_GREETING; + greeting =3D QEMU_JSON_GREETING; =20 if (qemuMonitorTestAddResponse(test, greeting) < 0) goto error; @@ -1340,7 +1337,7 @@ qemuMonitorTestNewFromFile(const char *fileName, goto error; } else { /* Create new mocked monitor with our greeting */ - if (!(test =3D qemuMonitorTestNew(true, xmlopt, NULL, NULL, + if (!(test =3D qemuMonitorTestNew(xmlopt, NULL, NULL, singleReply, NULL))) goto error; } @@ -1425,7 +1422,7 @@ qemuMonitorTestNewFromFileFull(const char *fileName, if (virTestLoadFile(fileName, &jsonstr) < 0) return NULL; =20 - if (!(ret =3D qemuMonitorTestNew(true, driver->xmlopt, vm, driver, NUL= L, + if (!(ret =3D qemuMonitorTestNew(driver->xmlopt, vm, driver, NULL, qmpschema))) goto cleanup; =20 diff --git a/tests/qemumonitortestutils.h b/tests/qemumonitortestutils.h index 23192c1223..3e93f9551a 100644 --- a/tests/qemumonitortestutils.h +++ b/tests/qemumonitortestutils.h @@ -75,12 +75,11 @@ int qemuMonitorTestAddItemExpect(qemuMonitorTestPtr tes= t, const char *response); =20 # define qemuMonitorTestNewSimple(xmlopt) \ - qemuMonitorTestNew(true, xmlopt, NULL, NULL, NULL, NULL) + qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, NULL) # define qemuMonitorTestNewSchema(xmlopt, schema) \ - qemuMonitorTestNew(true, xmlopt, NULL, NULL, NULL, schema) + qemuMonitorTestNew(xmlopt, NULL, NULL, NULL, schema) =20 -qemuMonitorTestPtr qemuMonitorTestNew(bool json, - virDomainXMLOptionPtr xmlopt, +qemuMonitorTestPtr qemuMonitorTestNew(virDomainXMLOptionPtr xmlopt, virDomainObjPtr vm, virQEMUDriverPtr driver, const char *greeting, --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599633; cv=none; d=zoho.com; s=zohoarc; b=I/d9v+hTC/t77pJH0KGFLLhIN2Y0CZoslgJldgAwN1JnPo8ztSn52n0AVs4pntdjGy+2+PI1+7Li+VQJBp8LPkVGwR8QSVSbR5yiUnTvCUqrgBy23cG38B3BGU44VUHI5/+7KakGMOwJcGOCcm1Ci7DkHa+AFylIj+b2MF9+w/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599633; 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=G49KzV5oxwUYRUd+yvjY/w+qRgNWRV+su0KX1Gk15JA=; b=Npl9rXSV1Kf3o9DhxHWlHKLrtrUVBKXQdhFp7LtY9BG8hLvMWNCmvGmxADgwId/kKZH1oZJZXPS5fDLwQPdOey//gpCBkMoQ59iGUvhM6QowKWe0yHLx1Y/Y0tc7DbvQhKMXMAy6ur9MiE9VXpJ4q0G3yCuW+iC+LuFbaZujOKA= 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 1560599633646355.5258372991141; Sat, 15 Jun 2019 04:53:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8BAD7368E3; Sat, 15 Jun 2019 11:53:51 +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 687C15D982; Sat, 15 Jun 2019 11:53:51 +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 2583D24AFA; Sat, 15 Jun 2019 11:53:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBriGQ003394 for ; Sat, 15 Jun 2019 07:53:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0CFB019700; Sat, 15 Jun 2019 11:53:44 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D704D1975F for ; Sat, 15 Jun 2019 11:53:42 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:01 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/12] tests: qemuMonitorTestAddErrorResponse: use VIR_AUTOFREE 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-Type: text/plain; charset="utf-8" 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Sat, 15 Jun 2019 11:53:52 +0000 (UTC) Use VIR_AUTOFREE. Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 86883e682b..bb30bed51e 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -124,11 +124,10 @@ qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr te= st, const char *usermsg) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; - char *escapemsg =3D NULL; - char *jsonmsg =3D NULL; + VIR_AUTOFREE(char *) escapemsg =3D NULL; + VIR_AUTOFREE(char *) jsonmsg =3D NULL; const char *monmsg =3D NULL; char *tmp; - int ret =3D -1; =20 if (!usermsg) usermsg =3D "unexpected command"; @@ -136,7 +135,7 @@ qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr test, if (test->json || test->agent) { virBufferEscape(&buf, '\\', "\"", "%s", usermsg); if (virBufferCheckError(&buf) < 0) - goto error; + return -1; escapemsg =3D virBufferContentAndReset(&buf); =20 /* replace newline/carriage return with space */ @@ -153,19 +152,14 @@ qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr te= st, " { \"desc\": \"%s\", " " \"class\": \"UnexpectedCommand\" } }= ", escapemsg) < 0) - goto error; + return -1; =20 monmsg =3D jsonmsg; } else { monmsg =3D usermsg; } =20 - ret =3D qemuMonitorTestAddResponse(test, monmsg); - - error: - VIR_FREE(escapemsg); - VIR_FREE(jsonmsg); - return ret; + return qemuMonitorTestAddResponse(test, monmsg); } =20 =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599672; cv=none; d=zoho.com; s=zohoarc; b=bWdJXwTa0WXZjXa9x79s1eqJAH/KB7Ltn8bdv5l3eNrm3vXzMeuLVVLVj/JDG7yGqBm3gKxac2xs9WLOADn/BBZJg3/7i7TnsXCE23y+UV1Q0HIz4V/GdmML+5yfSbWVk9PwugN0nb5647OgsCaENxARV30GCS6fvrbBS6mFNHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599672; 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=y3g0K0Clfc/hsIgILH5mkpwdSqb8wlj3HDNnn/TN3vM=; b=hvEgnSfyMFfGEMM3PXGuxYBZ4m507hZVEV/DmGHWDlF+sa/6Tr8IaNRktQN/JEUAT2IcuFxly9dHYmdZ18IOm8U4VlnEa5qxSbMies8pbgdhDxinH+qznC8VizkHhJXgr/LUhRoUhgo3ijvgp/YSX0aCg0HFcObD5t9KrXYq020= 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 156059967270196.09650523909033; Sat, 15 Jun 2019 04:54:32 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC1DE30832CC; Sat, 15 Jun 2019 11:54: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 B6DD618228; Sat, 15 Jun 2019 11:54: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 792A71806B1D; Sat, 15 Jun 2019 11:54:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBrjWa003433 for ; Sat, 15 Jun 2019 07:53:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id A8B221975F; Sat, 15 Jun 2019 11:53:45 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7806719700 for ; Sat, 15 Jun 2019 11:53:44 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:02 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/12] tests: qemuMonitorTestProcessCommandDefaultValidate: simplify condition 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-Type: text/plain; charset="utf-8" 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Sat, 15 Jun 2019 11:54:31 +0000 (UTC) This function is skipped for non-JSON monitor (which never happens now) and for agent connections (which we currently do not test). Only check for qapischema to simplify the condition. Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index bb30bed51e..cf4fec8873 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -546,7 +546,7 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMonito= rTestPtr test, char *schemapath =3D NULL; int ret =3D -1; =20 - if (!test->qapischema || !test->json || test->agent) + if (!test->qapischema) return 0; =20 /* 'device_add' needs to be skipped as it does not have fully defined = schema */ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599680; cv=none; d=zoho.com; s=zohoarc; b=ORnEay4z9hD38zVXim4YiTf7g6YZcSFt5tmDpFRVkSIS8yL5I2bJKw2SiVs4kxn79b0+34JoJnyDKbayETtlYA+9V0y67ns9+RErpS9hM8jZUZEujAjPivQc5Bl38n6gLImhCrr+1FZvMHaZ7MslK1gGgYBeNZ4XJd+GBneV+KE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599680; 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=jahv7XgXWOz5sOHr1DC4BaXObxM5CNJCDdZZqQ88o8k=; b=U5viSd754A1OMH6nzAy/AOczVz3Qrj2Qc8M2mHGqBJQnS7hglFI83B+4d8nY1udR6xi/zLvt3XHwfsBVBk72Y6dW3jq/YpvcDGDlL8tP2c2JzDzi9IApEjqN7SaKkiryN1VcD49bBKrIXQrLor5DtEjenlujaUL8WqeflY+WBN0= 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 1560599680193950.752935437745; Sat, 15 Jun 2019 04:54:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 916EB81129; Sat, 15 Jun 2019 11:54:38 +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 135A719700; Sat, 15 Jun 2019 11:54:38 +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 CB1AE206D2; Sat, 15 Jun 2019 11:54:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBrlxp003481 for ; Sat, 15 Jun 2019 07:53:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 68DEE19700; Sat, 15 Jun 2019 11:53:47 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EAE11975F for ; Sat, 15 Jun 2019 11:53:45 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:03 +0200 Message-Id: <922c6e008b9f146543f8b1e5f8afb033df58ace9.1560599610.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/12] tests: assume JSON in qemuMonitorTestIO 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-Type: text/plain; charset="utf-8" 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Sat, 15 Jun 2019 11:54:39 +0000 (UTC) Only strip the carriage return for agent monitor, now that we no longer support text monitor. Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index cf4fec8873..e2144923f0 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -320,7 +320,7 @@ qemuMonitorTestIO(virNetSocketPtr sock, */ t1 =3D test->incoming; while ((t2 =3D strstr(t1, "\n")) || - (!test->json && (t2 =3D strstr(t1, "\r")))) { + (test->agent && (t2 =3D strstr(t1, "\r")))) { *t2 =3D '\0'; =20 if (qemuMonitorTestProcessCommand(test, t1) < 0) { --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599667; cv=none; d=zoho.com; s=zohoarc; b=k8onIlAKbJ3XXJkI8CiUVxN3ahrJ0Vd16vE3lWPlvf6i79QM+G1i7bCu0A8KMBckQgtjbPdtitxc4BQ93GEqcK5ZLHxWprs1/QDwLRLKOikQJ7VsCQMxgkj2DU/w/bv9nrm4v15bd72FTWu8GgWiU+iMIeAcIbDXeWgOrjqieF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599667; 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=a+FVlUVLl7XM+DXp1dv1qs+aU9kONLYwLslzke0RRJc=; b=c7au1SpYDZanGMc76o/OR8lg7tGNcbPRIEjVcWBd+YiWdEeeVx8OixoJYR68hcswDtu3mwciGsu+XJCn/OanAAkE2uHgrxstn/eW0ovps8Fu3wRAfLkgpLHdfLsSeZMvIeVXIuySY3KjA+72nGWOtbnAUy5JgurK4mtv6WCIMF8= 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 1560599667633296.03661052019095; Sat, 15 Jun 2019 04:54:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 054EC3092645; Sat, 15 Jun 2019 11:54:26 +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 D53A518228; Sat, 15 Jun 2019 11:54:25 +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 9DAE1206D5; Sat, 15 Jun 2019 11:54:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBrn1d003535 for ; Sat, 15 Jun 2019 07:53:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7599D1975F; Sat, 15 Jun 2019 11:53:49 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 74C3F196A7 for ; Sat, 15 Jun 2019 11:53:47 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:04 +0200 Message-Id: <67a7e1a8f3515d732dc40cf0f05ce5ba32ce4afe.1560599610.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/12] tests: qemuMonitorReportError: use tmp variable properly 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-Type: text/plain; charset="utf-8" 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Sat, 15 Jun 2019 11:54:26 +0000 (UTC) There is no obvious benefit in putting the escaped message back into msg while tmp holds the original message. Remove the assignment and use 'tmp' directly'. Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index e2144923f0..a4fe397be6 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -213,16 +213,14 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const= char *errmsg, ...) goto cleanup; =20 if (test->agent || test->json) { - char *tmp =3D msg; - msg =3D qemuMonitorEscapeArg(tmp); - VIR_FREE(tmp); - if (!msg) + VIR_AUTOFREE(char *) tmp =3D NULL; + if (!(tmp =3D qemuMonitorEscapeArg(msg))) goto cleanup; =20 if (virAsprintf(&jsonmsg, "{ \"error\": " " { \"desc\": \"%s\", " " \"class\": \"UnexpectedCommand\" } }= ", - msg) < 0) + tmp) < 0) goto cleanup; } else { if (virAsprintf(&jsonmsg, "error: '%s'", msg) < 0) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599685; cv=none; d=zoho.com; s=zohoarc; b=YMrO6uUgj1Vn8C93+NbkKfxwfGmukZjNZN9R0SjtTuBk3f7fOUF53VmZzbgfKCT8DkldxRtx/ERinvfoIdJppm6G38e4a8l46T5mfUr01ZnZC55KdNeXF/brvOGxGaUU7Jo9Ui8x5pbfckHWIe5jyG/YJEqVeYHBYO3qdhDohLU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599685; 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=HxMxnDI2O6B3LFHucsEMZ+KRj08vZi03WTPlXLr7Xko=; b=L5CYSE7m+dUnljHHcj9G+67RxXrmT3NvQu5cbLK8SdHXKOs2lOPD8OmjJByiT8pQDL5jnKBjUv7BBKxjjYk611BjxDXrMbX0Rjssi9bBBo3DmigKf4nHA8UIHRSTIbVsJLmW3zDOyM4mm/RmQacUQOpaLnrj9E2KE9wfpWUf1yY= 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 1560599685370299.81910160354005; Sat, 15 Jun 2019 04:54:45 -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 A4032307D868; Sat, 15 Jun 2019 11:54:43 +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 75F41648CD; Sat, 15 Jun 2019 11:54:43 +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 3BC8B1806B1E; Sat, 15 Jun 2019 11:54:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBrrP3003626 for ; Sat, 15 Jun 2019 07:53:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3F3031975F; Sat, 15 Jun 2019 11:53:53 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58F1819700 for ; Sat, 15 Jun 2019 11:53:49 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:05 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/12] tests: remove text monitor testing infrastructure 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-Type: text/plain; charset="utf-8" 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]); Sat, 15 Jun 2019 11:54:44 +0000 (UTC) We removed testing for text monitor some time ago, remove the remains from the test infrastructure. Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 125 ++++++++++++----------------------- 1 file changed, 44 insertions(+), 81 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index a4fe397be6..f1104e0ff9 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -126,40 +126,33 @@ qemuMonitorTestAddErrorResponse(qemuMonitorTestPtr te= st, virBuffer buf =3D VIR_BUFFER_INITIALIZER; VIR_AUTOFREE(char *) escapemsg =3D NULL; VIR_AUTOFREE(char *) jsonmsg =3D NULL; - const char *monmsg =3D NULL; char *tmp; =20 if (!usermsg) usermsg =3D "unexpected command"; =20 - if (test->json || test->agent) { - virBufferEscape(&buf, '\\', "\"", "%s", usermsg); - if (virBufferCheckError(&buf) < 0) - return -1; - escapemsg =3D virBufferContentAndReset(&buf); - - /* replace newline/carriage return with space */ - tmp =3D escapemsg; - while (*tmp) { - if (*tmp =3D=3D '\r' || *tmp =3D=3D '\n') - *tmp =3D ' '; - - tmp++; - } + virBufferEscape(&buf, '\\', "\"", "%s", usermsg); + if (virBufferCheckError(&buf) < 0) + return -1; + escapemsg =3D virBufferContentAndReset(&buf); =20 - /* format the JSON error message */ - if (virAsprintf(&jsonmsg, "{ \"error\": " - " { \"desc\": \"%s\", " - " \"class\": \"UnexpectedCommand\" } }= ", - escapemsg) < 0) - return -1; + /* replace newline/carriage return with space */ + tmp =3D escapemsg; + while (*tmp) { + if (*tmp =3D=3D '\r' || *tmp =3D=3D '\n') + *tmp =3D ' '; =20 - monmsg =3D jsonmsg; - } else { - monmsg =3D usermsg; + tmp++; } =20 - return qemuMonitorTestAddResponse(test, monmsg); + /* format the JSON error message */ + if (virAsprintf(&jsonmsg, "{ \"error\": " + " { \"desc\": \"%s\", " + " \"class\": \"UnexpectedCommand\" } }", + escapemsg) < 0) + return -1; + + return qemuMonitorTestAddResponse(test, jsonmsg); } =20 =20 @@ -203,6 +196,7 @@ int ATTRIBUTE_FMT_PRINTF(2, 3) qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg, ...) { va_list msgargs; + VIR_AUTOFREE(char *) tmp =3D NULL; char *msg =3D NULL; char *jsonmsg =3D NULL; int ret =3D -1; @@ -212,20 +206,14 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const= char *errmsg, ...) if (virVasprintf(&msg, errmsg, msgargs) < 0) goto cleanup; =20 - if (test->agent || test->json) { - VIR_AUTOFREE(char *) tmp =3D NULL; - if (!(tmp =3D qemuMonitorEscapeArg(msg))) - goto cleanup; + if (!(tmp =3D qemuMonitorEscapeArg(msg))) + goto cleanup; =20 - if (virAsprintf(&jsonmsg, "{ \"error\": " - " { \"desc\": \"%s\", " - " \"class\": \"UnexpectedCommand\" } }= ", - tmp) < 0) - goto cleanup; - } else { - if (virAsprintf(&jsonmsg, "error: '%s'", msg) < 0) - goto cleanup; - } + if (virAsprintf(&jsonmsg, "{ \"error\": " + " { \"desc\": \"%s\", " + " \"class\": \"UnexpectedCommand\" } }", + tmp) < 0) + goto cleanup; =20 ret =3D qemuMonitorTestAddResponse(test, jsonmsg); =20 @@ -600,37 +588,19 @@ qemuMonitorTestProcessCommandDefault(qemuMonitorTestP= tr test, struct qemuMonitorTestHandlerData *data =3D item->opaque; virJSONValuePtr val =3D NULL; virJSONValuePtr cmdargs =3D NULL; - char *cmdcopy =3D NULL; const char *cmdname; - char *tmp; int ret =3D -1; int rc; =20 - if (test->agent || test->json) { - if (!(val =3D virJSONValueFromString(cmdstr))) - return -1; - - if (!(cmdname =3D virJSONValueObjectGetString(val, "execute"))) { - ret =3D qemuMonitorReportError(test, "Missing command name in = %s", cmdstr); - goto cleanup; - } - - cmdargs =3D virJSONValueObjectGet(val, "arguments"); - } else { - if (VIR_STRDUP(cmdcopy, cmdstr) < 0) - return -1; - - cmdname =3D cmdcopy; + if (!(val =3D virJSONValueFromString(cmdstr))) + return -1; =20 - if (!(tmp =3D strchr(cmdcopy, ' '))) { - ret =3D qemuMonitorReportError(test, - "Cannot find command name in '%s'= ", - cmdstr); - goto cleanup; - } - *tmp =3D '\0'; + if (!(cmdname =3D virJSONValueObjectGetString(val, "execute"))) { + ret =3D qemuMonitorReportError(test, "Missing command name in %s",= cmdstr); + goto cleanup; } =20 + cmdargs =3D virJSONValueObjectGet(val, "arguments"); if ((rc =3D qemuMonitorTestProcessCommandDefaultValidate(test, cmdname= , cmdargs)) < 0) goto cleanup; =20 @@ -646,7 +616,6 @@ qemuMonitorTestProcessCommandDefault(qemuMonitorTestPtr= test, ret =3D qemuMonitorTestAddResponse(test, data->response); =20 cleanup: - VIR_FREE(cmdcopy); virJSONValueFree(val); return ret; } @@ -689,23 +658,21 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTest= Ptr test, int rc; =20 /* JSON strings will be reformatted to simplify checking */ - if (test->json || test->agent) { - if (!(json =3D virJSONValueFromString(cmdstr)) || - !(reformatted =3D virJSONValueToString(json, false))) - return -1; + if (!(json =3D virJSONValueFromString(cmdstr)) || + !(reformatted =3D virJSONValueToString(json, false))) + return -1; =20 - cmdstr =3D reformatted; + cmdstr =3D reformatted; =20 - /* 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"); + /* in this case we do a best-effort schema check if we can find the co= mmand */ + if ((cmdname =3D virJSONValueObjectGetString(json, "execute"))) { + cmdargs =3D virJSONValueObjectGet(json, "arguments"); =20 - if ((rc =3D qemuMonitorTestProcessCommandDefaultValidate(test,= cmdname, cmdargs)) < 0) - return -1; + if ((rc =3D qemuMonitorTestProcessCommandDefaultValidate(test, cmd= name, cmdargs)) < 0) + return -1; =20 - if (rc =3D=3D 1) - return 0; - } + if (rc =3D=3D 1) + return 0; } =20 if (STREQ(data->command_name, cmdstr)) { @@ -756,11 +723,7 @@ qemuMonitorTestAddItemVerbatim(qemuMonitorTestPtr test, VIR_STRDUP(data->cmderr, cmderr) < 0) goto error; =20 - if (test->json || test->agent) - data->command_name =3D virJSONStringReformat(command, false); - else - ignore_value(VIR_STRDUP(data->command_name, command)); - + data->command_name =3D virJSONStringReformat(command, false); if (!data->command_name) goto error; =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599675; cv=none; d=zoho.com; s=zohoarc; b=fnURaN6xGRYOWZsLx6Zr7VUPxM0dwRU6FS6N7gNPsfWGbzcJVPqyTr1rdWXKv0f3VEqT/DxzFBUF4CwGa0fjunPddHhXd1DL5zxYT1b9X+cvFmDhYmFVaE+9eFGGX6bEzmgO+bReqoPrd8Kxiq8kO0hENnuPtGOKzQZUD0B1KhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599675; 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=wVEGMokIQznUNCLQh8G/m81oZhnE5mtMcM8fYwVvyTY=; b=aaey48XIimO2YH6oABH5Pkz/5puPwBdZGGk+IMU/d+h81zVNoxb+X9V5mA4GVryF3Q6FVGvVbZ882HVMrKCikOI35gEJ9VBl/b/NcLhp+sMsM585AnH8F0aLyRwY0QQ0hzEbhwE/XSAKSpvbtsgeDBdTY5p6rKQvae8hxDclXtQ= 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 1560599675578466.9884304956453; Sat, 15 Jun 2019 04:54:35 -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 E8C3F368E3; Sat, 15 Jun 2019 11:54:33 +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 C2E7098B4; Sat, 15 Jun 2019 11:54:33 +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 5A3791806B1F; Sat, 15 Jun 2019 11:54:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBrvei003724 for ; Sat, 15 Jun 2019 07:53:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id A38C019700; Sat, 15 Jun 2019 11:53:57 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id A83801975F for ; Sat, 15 Jun 2019 11:53:53 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:06 +0200 Message-Id: <757dadeb180b90a6b35afb5d9d735ddd3983c2c8.1560599610.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/12] tests: qemuMonitorReportError: use VIR_AUTOFREE 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-Type: text/plain; charset="utf-8" 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]); Sat, 15 Jun 2019 11:54:34 +0000 (UTC) Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index f1104e0ff9..313ecb01fd 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -197,8 +197,8 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const c= har *errmsg, ...) { va_list msgargs; VIR_AUTOFREE(char *) tmp =3D NULL; - char *msg =3D NULL; - char *jsonmsg =3D NULL; + VIR_AUTOFREE(char *) msg =3D NULL; + VIR_AUTOFREE(char *) jsonmsg =3D NULL; int ret =3D -1; =20 va_start(msgargs, errmsg); @@ -219,8 +219,6 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const c= har *errmsg, ...) =20 cleanup: va_end(msgargs); - VIR_FREE(msg); - VIR_FREE(jsonmsg); return ret; } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599688; cv=none; d=zoho.com; s=zohoarc; b=cf2z1QdEonzyCQqwz5U5KB82AqZlEymBbAv7SOoBECEUMPu/W8VI2S0FXFbp+NMDJ+oTWOWWG4neeOyenO65yedIwsFR0xobk6e73mHEl5eOMdCFZrraBpKpIsXMF5SlpAwXcn2dmVvUBd3s+dcegPkxXy9k2VUR5v4/kn5Veu0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599688; 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=GJ37KIeWWRwA9x8saIAwreH5RJczzcqia8CK8E5fftQ=; b=jvmHaK09wjSV3CtwBDOSjRJITL1OF4q2YtlxxtJ2mZXxLsHNRIHMvOnqmTG9pcXZA5QSnhC4KS+anh7gOqqaCdeZRqNUHnvAIjyik5rLoZfmtd9N/9kleK671xeuk3ht/xTEFfWPFZRfRX4euNL+jPYNj74KFPK0tjsojF3ar+Q= 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 1560599688877325.22645240134716; Sat, 15 Jun 2019 04:54:48 -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 4D73DC058CBA; Sat, 15 Jun 2019 11:54:47 +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 2903E605C9; Sat, 15 Jun 2019 11:54:47 +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 E10D1206D9; Sat, 15 Jun 2019 11:54:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBrxCk003776 for ; Sat, 15 Jun 2019 07:53:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id 95E861975F; Sat, 15 Jun 2019 11:53:59 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC3FF19700 for ; Sat, 15 Jun 2019 11:53:57 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:07 +0200 Message-Id: <757d4dafb2844fc6c63de31157bfa65110e5f5c2.1560599610.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/12] tests: refactor qemuMonitorTestProcessCommandDefault 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-Type: text/plain; charset="utf-8" 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]); Sat, 15 Jun 2019 11:54:47 +0000 (UTC) Use VIR_AUTOPTR and get rid of the 'ret' variable. Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 313ecb01fd..ca678e9bd5 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -584,38 +584,29 @@ qemuMonitorTestProcessCommandDefault(qemuMonitorTestP= tr test, const char *cmdstr) { struct qemuMonitorTestHandlerData *data =3D item->opaque; - virJSONValuePtr val =3D NULL; + VIR_AUTOPTR(virJSONValue) val =3D NULL; virJSONValuePtr cmdargs =3D NULL; const char *cmdname; - int ret =3D -1; int rc; =20 if (!(val =3D virJSONValueFromString(cmdstr))) return -1; =20 - if (!(cmdname =3D virJSONValueObjectGetString(val, "execute"))) { - ret =3D qemuMonitorReportError(test, "Missing command name in %s",= cmdstr); - goto cleanup; - } + if (!(cmdname =3D virJSONValueObjectGetString(val, "execute"))) + return qemuMonitorReportError(test, "Missing command name in %s", = cmdstr); =20 cmdargs =3D virJSONValueObjectGet(val, "arguments"); if ((rc =3D qemuMonitorTestProcessCommandDefaultValidate(test, cmdname= , cmdargs)) < 0) - goto cleanup; - - if (rc =3D=3D 1) { - ret =3D 0; - goto cleanup; - } + return -1; + if (rc =3D=3D 1) + return 0; =20 - if (data->command_name && STRNEQ(data->command_name, cmdname)) - ret =3D qemuMonitorTestAddInvalidCommandResponse(test, data->comma= nd_name, + if (data->command_name && STRNEQ(data->command_name, cmdname)) { + return qemuMonitorTestAddInvalidCommandResponse(test, data->comman= d_name, cmdname); - else - ret =3D qemuMonitorTestAddResponse(test, data->response); - - cleanup: - virJSONValueFree(val); - return ret; + } else { + return qemuMonitorTestAddResponse(test, data->response); + } } =20 =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599668; cv=none; d=zoho.com; s=zohoarc; b=IU2GKlFDuMVjg52A6nROTKT4smhpEF7j0PA+rb2wM5+iWWZT+aOUfxPMojWtbbE5zcJtTKJv5aDpGcIovOhzE3pS2IBrFURMuO93EX8iSt6L6XDbZIQSsv7zMO1KnrqZaWLQnhb7LGL671YaMz0pYBAy7a3aMJn6haYoqAv7TrA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599668; 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=orj5XUyjY06ioHjWdzotW4Eu4XqZ6VMY2tn+hLzE39k=; b=Mt2BEbHPtPEG8fYtu5f5Ect1f/yB8PoOwZOHhhoIuIPO5pAurwQ5JqmVVDUpw16sJjnNj6Xei8aLE5Xn6qzkF10DvZUagaPTl2i4THUQthqhglZa12Irc8f1oaY2gR+nxOcJLjtha3rdLU7BsOOAHQvQlkv/IM/vEyQTZfItQlc= 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 1560599668977879.2052212328566; Sat, 15 Jun 2019 04:54:28 -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 138A6C057F30; Sat, 15 Jun 2019 11:54:27 +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 DE9921001B23; Sat, 15 Jun 2019 11:54:26 +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 A0207206D7; Sat, 15 Jun 2019 11:54:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBs1bh003834 for ; Sat, 15 Jun 2019 07:54:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id D88D81975F; Sat, 15 Jun 2019 11:54:01 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0F6C2194A6 for ; Sat, 15 Jun 2019 11:53:59 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:08 +0200 Message-Id: <3ba8670a171d580223fb672fe8b64f486cf8fc87.1560599610.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/12] tests: refactor qemuMonitorTestProcessCommandDefaultValidate 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-Type: text/plain; charset="utf-8" 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.32]); Sat, 15 Jun 2019 11:54:27 +0000 (UTC) Use VIR_AUTO* for cleanup and virBufferCurrentContent instead of virBufferContentAndReset. Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index ca678e9bd5..6be4de8059 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -524,11 +524,10 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMoni= torTestPtr test, const char *cmdname, virJSONValuePtr args) { - virBuffer debug =3D VIR_BUFFER_INITIALIZER; + VIR_AUTOCLEAN(virBuffer) debug =3D VIR_BUFFER_INITIALIZER; virJSONValuePtr schemaroot; - virJSONValuePtr emptyargs =3D NULL; - char *schemapath =3D NULL; - int ret =3D -1; + VIR_AUTOPTR(virJSONValue) emptyargs =3D NULL; + VIR_AUTOFREE(char *) schemapath =3D NULL; =20 if (!test->qapischema) return 0; @@ -538,43 +537,34 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMoni= torTestPtr test, return 0; =20 if (virAsprintf(&schemapath, "%s/arg-type", cmdname) < 0) - goto cleanup; + return -1; =20 if (virQEMUQAPISchemaPathGet(schemapath, test->qapischema, &schemaroot= ) < 0 || !schemaroot) { if (qemuMonitorReportError(test, "command '%s' not found in QAPI schema", cmdname) =3D=3D 0) - ret =3D 1; - goto cleanup; + return 1; + return -1; } =20 if (!args) { if (!(emptyargs =3D virJSONValueNewObject())) - goto cleanup; + return -1; =20 args =3D emptyargs; } =20 if (testQEMUSchemaValidate(args, schemaroot, test->qapischema, &debug)= < 0) { - char *debugmsg =3D virBufferContentAndReset(&debug); if (qemuMonitorReportError(test, "failed to validate arguments of '%s' " "against QAPI schema: %s", - cmdname, debugmsg) =3D=3D 0) - ret =3D 1; - - VIR_FREE(debugmsg); - goto cleanup; + cmdname, virBufferCurrentContent(&debug= )) =3D=3D 0) + return 1; + return -1; } =20 - ret =3D 0; - - cleanup: - virBufferFreeAndReset(&debug); - virJSONValueFree(emptyargs); - VIR_FREE(schemapath); - return ret; + return 0; } =20 =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599680; cv=none; d=zoho.com; s=zohoarc; b=aOPetX6zGw8Nk2bFfOGYodeaZiXMAIzovwpJQdx01+jfQ2KqLBm+OTvU9n/kFPY4sHaCTRCo8koo8QdR98zO5k/9fbiZ++KLJePUScJdXWNjMLk033BHpqAweaZcN5oDYcctIE76qlh9C/nsyu0F3w22wZWlVSUeF5i2O28Hx7g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599680; 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=Q4FrwGsfN+xIVg1YJgoni53xMsX4YgsNjR80QaVomfo=; b=i6z1twRmz4jC93OirVHhsaWODpbpKZR4ger7QerVt+wrRFNLP6FrNwNP5xUSKjQN2TPgICjv+wHpSgIFi2LPhT1VKT2xN2oVsKF32nEBgjxVx4IH6WbNZuyOrEG0XcguUmBdKAxGzLay5qBOQGpJcLe9a1ZoWQzu8pzrhrpENr8= 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 1560599680910662.0664477927257; Sat, 15 Jun 2019 04:54:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E11EC045129; Sat, 15 Jun 2019 11:54:39 +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 5696617D1D; Sat, 15 Jun 2019 11:54:39 +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 149FA1806B23; Sat, 15 Jun 2019 11:54:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBs4co003905 for ; Sat, 15 Jun 2019 07:54:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC339196A7; Sat, 15 Jun 2019 11:54:04 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D576025262 for ; Sat, 15 Jun 2019 11:54:02 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:09 +0200 Message-Id: <5d5f4049204136d30dedbba73c7209e1d3d543d7.1560599610.git.jtomko@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/12] tests: qemuMonitorTestAddUnexpectedErrorResponse: VIR_AUTOFREE 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-Type: text/plain; charset="utf-8" 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Sat, 15 Jun 2019 11:54:39 +0000 (UTC) Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 6be4de8059..c053712573 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -160,16 +160,12 @@ static int qemuMonitorTestAddUnexpectedErrorResponse(qemuMonitorTestPtr test, const char *command) { - char *msg; - int ret; + VIR_AUTOFREE(char *) msg =3D NULL; =20 if (virAsprintf(&msg, "unexpected command: '%s'", command) < 0) return -1; =20 - ret =3D qemuMonitorTestAddErrorResponse(test, msg); - - VIR_FREE(msg); - return ret; + return qemuMonitorTestAddErrorResponse(test, msg); } =20 =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 08:41:56 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=1560599685; cv=none; d=zoho.com; s=zohoarc; b=aBKO/3oeX9+1gN27ibOMwOjYYnbt3p0pPzcHrE+wNHXZTYcXACVp9q8jHb5AqMtkN4rMqWrzR/VR/f0FYlrronldVDYLdpxH7t+fII/Ti+HnUiD/qssPVinMFFBJwMRXSSr6pZw75WOYRSU1YpyMA2sIF1g3RfKahPSE1djJ8/A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560599685; 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=SmLNTa/FM4I/8rWq23zkyPtafhMhq2FM2HMHswIAfmM=; b=Vgvt+xuDdd1sgxHvToiPDCMeCFsLHf2cgNmIFWRMAmBWWfprdAZ6WzYkh/ezffdprlzQTaq2SuPIgbRlJHnXa8RkhAIyC5CyUhvrUsCUZ8f7mAKMHzT/X9GMpQJxNIjnYPqnZGf3+WWWrZqnHqg2mDHzdNoXKfj9evjKN3XgW18= 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 1560599685699874.2890557383043; Sat, 15 Jun 2019 04:54:45 -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 CE3F18553F; Sat, 15 Jun 2019 11:54:43 +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 A5CC5605CB; Sat, 15 Jun 2019 11:54:43 +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 6431B206D6; Sat, 15 Jun 2019 11:54:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5FBs6u6003956 for ; Sat, 15 Jun 2019 07:54:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id A690C196A7; Sat, 15 Jun 2019 11:54:06 +0000 (UTC) Received: from lpt.redhat.com (ovpn-200-22.brq.redhat.com [10.40.200.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B8941975F for ; Sat, 15 Jun 2019 11:54:05 +0000 (UTC) From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Date: Sat, 15 Jun 2019 13:54:10 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/12] tests: qemuMonitorTestAddInvalidCommandResponse: VIR_AUTOFREE 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-Type: text/plain; charset="utf-8" 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.28]); Sat, 15 Jun 2019 11:54:44 +0000 (UTC) Signed-off-by: J=C3=A1n Tomko --- tests/qemumonitortestutils.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index c053712573..c14ffb23b9 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -174,17 +174,13 @@ qemuMonitorTestAddInvalidCommandResponse(qemuMonitorT= estPtr test, const char *expectedcommand, const char *actualcommand) { - char *msg; - int ret; + VIR_AUTOFREE(char *) msg =3D NULL; =20 if (virAsprintf(&msg, "expected command '%s' got '%s'", expectedcommand, actualcommand) < 0) return -1; =20 - ret =3D qemuMonitorTestAddErrorResponse(test, msg); - - VIR_FREE(msg); - return ret; + return qemuMonitorTestAddErrorResponse(test, msg); } =20 =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list