From nobody Sun Feb 8 15:46:50 2026 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