From nobody Mon Feb 9 01:30:59 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1585739258; cv=none; d=zohomail.com; s=zohoarc; b=MspHShuHaGHw3PaAp//Cun+kF0G2YUeFd8rnfXZHBHdDCqtjXq8/UUQXMGbKP6iDzf4Rb9d8BQQQs+zWCBNvt5MhDz5WJoD0XwqUAJS155AbG/zJYLlfzhcHeQNZC7r5dCA52AJ3ZC5TCGkxWcI82ovfUmvVGuOg7IWGKb/Ih7U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585739258; 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; bh=r7jS9BVTSdgk0YLw04lhDIChJn/NwKlnLyyoHRyGMYk=; b=fuJc+r5lYym1iiyhzXYW6/2q52qVTOVywz7g/YBlFSa67DwIFiwhnd1B3IJ28sNEY1pZnCvVtsH8mabsbkCdSQxfACaS5h8Zf5wEPfaIwONUbhJ9sS001MqyGYu2uJbB2NYM8iJ1wOSfvSOUu9+dzDHG53E4bdTiaeyaprgFkjE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1585739258349489.6899944673585; Wed, 1 Apr 2020 04:07:38 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-175-gP2lqaDyMLuMI3-kqv22xA-1; Wed, 01 Apr 2020 07:07:35 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9DE10107ACCD; Wed, 1 Apr 2020 11:07:29 +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 704385DA66; Wed, 1 Apr 2020 11:07:29 +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 206CB86C1B; Wed, 1 Apr 2020 11:07:29 +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 031B3tbH025868 for ; Wed, 1 Apr 2020 07:03:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 554DBA63A3; Wed, 1 Apr 2020 11:03:55 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD123A63A2 for ; Wed, 1 Apr 2020 11:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585739257; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=r7jS9BVTSdgk0YLw04lhDIChJn/NwKlnLyyoHRyGMYk=; b=Uy0ozwQZv7V19FQ2Hz6OHVO3ZXT1uIn/5hSz6aM7Mh9Fs6uuPyQth2/ZdHop9OAGv2Rxpi QOXbZQQCCBb2i/Qi6pX88ptlb+WZVaGrW7HypMMAg7QilEm9meHLfrVUcxUhWZmtfo+3+w bE3dCPkEtytN+7KwUoQWLq+CYYYzFx0= X-MC-Unique: gP2lqaDyMLuMI3-kqv22xA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/5] qemuMonitorTestProcessCommandDefaultValidate: Output validator output to stderr Date: Wed, 1 Apr 2020 13:03:46 +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 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: , 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Trying to squeeze the validator output into the monitor reply message doesn't make sense and doesn't work well as it's not well formed JSON: 54) qemuMonitorJSONAddNetdev ... l= ibvirt: error : internal error: cannot parse json { "error": { "desc": "f= ailed to validate arguments of 'netdev_add' against QAPI schema: { ERROR: variant 'test' for discriminator 'type' not found ", "class": "UnexpectedCommand" } }: lexical error: invalid character in= side string. ev_add' against QAPI schema: { ERROR: variant 'test' for (right here) ------^ FAILED Output it to stderr if requested and just note that schema validation failed in the error message: 54) qemuMonitorJSONAddNetdev ... failed to validate arguments of 'netdev_add' against QAPI schema args: { "id": "net0", "type": "test" } validator output: { ERROR: variant 'test' for discriminator 'type' not found libvirt: QEMU Driver error : internal error: unable to execute QEMU command= 'netdev_add': failed to validate arguments of 'netdev_add' against QAPI sc= hema (to see debug output use VIR_TEST_DEBUG=3D2) FAILED Signed-off-by: Peter Krempa --- tests/qemumonitortestutils.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 159b1b909e..992d2a4e71 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -538,10 +538,19 @@ qemuMonitorTestProcessCommandDefaultValidate(qemuMoni= torTestPtr test, args =3D emptyargs =3D virJSONValueNewObject(); if (testQEMUSchemaValidate(args, schemaroot, test->qapischema, &debug)= < 0) { + if (virTestGetDebug() =3D=3D 2) { + g_autofree char *argstr =3D virJSONValueToString(args, true); + fprintf(stderr, + "\nfailed to validate arguments of '%s' against QAPI s= chema\n" + "args:\n%s\nvalidator output:\n %s\n", + cmdname, NULLSTR(argstr), virBufferCurrentContent(&deb= ug)); + } + if (qemuMonitorReportError(test, "failed to validate arguments of '%s' " - "against QAPI schema: %s", - cmdname, virBufferCurrentContent(&debug= )) =3D=3D 0) + "against QAPI schema " + "(to see debug output use VIR_TEST_DEBU= G=3D2)", + cmdname) =3D=3D 0) return 1; return -1; } --=20 2.25.1