From nobody Mon Feb 9 01:11:56 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1632145803; cv=none; d=zohomail.com; s=zohoarc; b=kNNk0LV0n/58Gw+WGzs3lwwMbChduEjO6XCjQuwUN2DoLz1+fIiMS3/sS35mJrtc2EsAxCp1eChfQS+IzQJ2jir8f3/3zWT/9N+xoagSc7RKwbAk56+8XGTIC47ResrvFPtcUokXs55xxoxDh1k7xU2nORJuz82jNgPLgaKaImg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632145803; 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=kUDOcC66IkrcWrTP88tCICw0lTOYNj2fG5wzId05Yec=; b=ikmjA3NqYr1gFPeRDJ9t6eMQgbRfs+eD/22PNtECfKwfjJQyGk44bUD59kwv2G73fgGWo1y5RO+5fgKVXftbhI1J8NYyYUiKwAkeDPwRQGCfRbgmgS1KBH/K/1j33FuOb/owvADxm5deiD2glc7vvpTPrkogI5ToJa6ggBQbjRo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 16321458031461022.1766228347084; Mon, 20 Sep 2021 06:50:03 -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-202-ci5A5DQeNzi_9W_Qy14PGg-1; Mon, 20 Sep 2021 09:50:00 -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 B53A8101AFAB; Mon, 20 Sep 2021 13:49:55 +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 94F715D9D5; Mon, 20 Sep 2021 13:49:55 +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 588121805986; Mon, 20 Sep 2021 13:49:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 18KDnrbA009293 for ; Mon, 20 Sep 2021 09:49:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9E61F6D988; Mon, 20 Sep 2021 13:49:53 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id F10141346F for ; Mon, 20 Sep 2021 13:49:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632145802; 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=kUDOcC66IkrcWrTP88tCICw0lTOYNj2fG5wzId05Yec=; b=FN+bdwCxsFRdL/ODsP5LkQRePj4zhKbQc62cBEgpwM0MFbD9UesJvazA0r3e8hHT5vbpjK MS68njTF2ldFcrx6AVZuBTsBfr9+JfpxjPfuQmx15v6YxeXoUCuwmKteQJZtE8BT/vfdVW LPPYoqh6mbdUawxQLhPHhiZz5BEKAV0= X-MC-Unique: ci5A5DQeNzi_9W_Qy14PGg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [RFC PATCH 4/7] testQEMUSchemaValidateEnum: Refactor logic to simplify switching to new QMP schema format Date: Mon, 20 Sep 2021 15:49:35 +0200 Message-Id: <3e377c7e272f55c629554782989d9f659d8f5b93.1632145487.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1632145803749100005 Content-Type: text/plain; charset="utf-8" QEMU-6.2 is reporting enum values in the new 'members' array which we'll be switching to. Rewrite the logic so that adding the new checker is more straightforward. Signed-off-by: Peter Krempa --- tests/testutilsqemuschema.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c index f6347231a8..e75345b582 100644 --- a/tests/testutilsqemuschema.c +++ b/tests/testutilsqemuschema.c @@ -319,7 +319,6 @@ testQEMUSchemaValidateEnum(virJSONValue *obj, { const char *objstr; virJSONValue *values =3D NULL; - virJSONValue *value; size_t i; if (virJSONValueGetType(obj) !=3D VIR_JSON_TYPE_STRING) { @@ -329,24 +328,24 @@ testQEMUSchemaValidateEnum(virJSONValue *obj, objstr =3D virJSONValueGetString(obj); - if (!(values =3D virJSONValueObjectGetArray(root, "values"))) { - virBufferAsprintf(ctxt->debug, "ERROR: missing enum values in sche= ma '%s'", - NULLSTR(virJSONValueObjectGetString(root, "name"= ))); - return -2; - } - - for (i =3D 0; i < virJSONValueArraySize(values); i++) { - value =3D virJSONValueArrayGet(values, i); + if ((values =3D virJSONValueObjectGetArray(root, "values"))) { + for (i =3D 0; i < virJSONValueArraySize(values); i++) { + virJSONValue *value =3D virJSONValueArrayGet(values, i); - if (STREQ_NULLABLE(objstr, virJSONValueGetString(value))) { - virBufferAsprintf(ctxt->debug, "'%s' OK", NULLSTR(objstr)); - return 0; + if (STREQ_NULLABLE(objstr, virJSONValueGetString(value))) { + virBufferAsprintf(ctxt->debug, "'%s' OK", NULLSTR(objstr)); + return 0; + } } + + virBufferAsprintf(ctxt->debug, "ERROR: enum value '%s' is not in s= chema", + NULLSTR(objstr)); + return -1; } - virBufferAsprintf(ctxt->debug, "ERROR: enum value '%s' is not in schem= a", - NULLSTR(objstr)); - return -1; + virBufferAsprintf(ctxt->debug, "ERROR: missing enum values in schema '= %s'", + NULLSTR(virJSONValueObjectGetString(root, "name"))); + return -2; } --=20 2.31.1