From nobody Mon Feb 9 05:01:08 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=1632145811; cv=none; d=zohomail.com; s=zohoarc; b=STD1vtbuSd8dySyD7SvAyDMCJ7bnaHoKjt433L4lswtZCa6z0a8EhckYQB9eNA2nLRIJ8NcFaBkcsP6hmwLj7lCVSMNs47zUSMEVS1UKp2G2JwIXlSyFCVdTp8ggjtiZnAiNr1RCrMzqZT/6RPUiEZY/kuWaYsyasqdmmLqosB0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632145811; 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=Cp72JGhTOPs4YUqJJmhViGHXtM0h5pRqfTscJ8SFrOo=; b=Z4PSw4QatboTAbj77b26gMKiOyoGqgMB763CINa+p1EG6lpv20mbnuVgidnMLuDCiQUkaXx9wvbhwXfIrL70yw3QaJmHBa7RRFYKs5NDwAJdO6iXtRIjfJEkfODEbZmgRA4fJfYRcn/+c0fU8qk0luUFgcm6k52Iy/KctuSm2qE= 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 1632145811638231.3811385298976; Mon, 20 Sep 2021 06:50:11 -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-240-_Pf-2hYsM2SnsWbQOVabew-1; Mon, 20 Sep 2021 09:50:08 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC674A40CA; Mon, 20 Sep 2021 13:50:01 +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 BAA4269FAD; Mon, 20 Sep 2021 13:50:01 +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 7F1A24EA3A; Mon, 20 Sep 2021 13:50:01 +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 18KDnsHi009302 for ; Mon, 20 Sep 2021 09:49:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id B014E1346F; Mon, 20 Sep 2021 13:49:54 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1AF856D98B for ; Mon, 20 Sep 2021 13:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632145810; 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=Cp72JGhTOPs4YUqJJmhViGHXtM0h5pRqfTscJ8SFrOo=; b=WGl5jYMcrtk/layPa//N7UADDS7AVJ/mScDWvdqFNF50vmw5n06D4k+uFJMJ+iK7TSbeTl 8WptfwtcvQLleWM8IaF462NvmsldcFPOQun6jh86m2v/W0ZMsFxpvntfTM1zdgxU953ss4 GjKOrWpWc8eEMW4qOb+J5j6VW6JmlTM= X-MC-Unique: _Pf-2hYsM2SnsWbQOVabew-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [RFC PATCH 5/7] testQEMUSchemaValidateEnum: Use new 'members' for 'enum' meta type Date: Mon, 20 Sep 2021 15:49:36 +0200 Message-Id: <0504b2499c40457ce28e88e23e7746495c2d78f8.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.11 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: 1632145813039100002 Content-Type: text/plain; charset="utf-8" Switch to the new more featured way to report enum members which will also allow us to detect use of deprecated members. Signed-off-by: Peter Krempa --- tests/testutilsqemuschema.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/testutilsqemuschema.c b/tests/testutilsqemuschema.c index e75345b582..7398c73ccc 100644 --- a/tests/testutilsqemuschema.c +++ b/tests/testutilsqemuschema.c @@ -319,6 +319,7 @@ testQEMUSchemaValidateEnum(virJSONValue *obj, { const char *objstr; virJSONValue *values =3D NULL; + virJSONValue *members =3D NULL; size_t i; if (virJSONValueGetType(obj) !=3D VIR_JSON_TYPE_STRING) { @@ -328,6 +329,22 @@ testQEMUSchemaValidateEnum(virJSONValue *obj, objstr =3D virJSONValueGetString(obj); + /* qemu-6.2 added a "members" array superseding "values" */ + if ((members =3D virJSONValueObjectGetArray(root, "members"))) { + for (i =3D 0; i < virJSONValueArraySize(members); i++) { + virJSONValue *member =3D virJSONValueArrayGet(members, i); + + if (STREQ_NULLABLE(objstr, virJSONValueObjectGetString(member,= "name"))) { + 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; + } + if ((values =3D virJSONValueObjectGetArray(root, "values"))) { for (i =3D 0; i < virJSONValueArraySize(values); i++) { virJSONValue *value =3D virJSONValueArrayGet(values, i); --=20 2.31.1