From nobody Mon Feb 9 06:34:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1617980536; cv=none; d=zohomail.com; s=zohoarc; b=JaG4OnewnmfPnJWACdsBNI94yWHXI0uAN3fnehlRIRiDWRlFDH7uSSk/GpefbW//SBW6sYdD+VscTscBBbrqrcoZ71dXcWwWIVg27/1+V/2wY7Kr33xrUJVYOXoRbljlXfyQv848sQVQoHS7W9fxSAZad0jVc+BmURPrd3OhcLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617980536; 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=ijxCGRXenN7ppJ996N2wR09nhR2j+Ga2ywtJPmR6h+8=; b=gxa2+CiR4eYEL0XlAJkTwyQzTwQ4rpslQufO7/psKUGyl/7JstvRLPWFzaaAxrNeyhPgwdQ2FNDUMQ3wf7iJQLl+9kb/BP6ltEM18+dKYu60OQOetxZH7jWhyinKFEJiOz79qP6B4VSGlHNd/VxBejiwblfksdNFzsjRQ0LwkHU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1617980536955217.0121807474992; Fri, 9 Apr 2021 08:02:16 -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-546-d7bCJ_O2MIa3a75qAG1oLA-1; Fri, 09 Apr 2021 11:00:56 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id AB8F08E73D2; Fri, 9 Apr 2021 15:00:14 +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 83D605C1A1; Fri, 9 Apr 2021 15:00:14 +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 2CAC655345; Fri, 9 Apr 2021 15:00:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 139EvlWa023834 for ; Fri, 9 Apr 2021 10:57:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5857A14106; Fri, 9 Apr 2021 14:57:47 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id B922360D79 for ; Fri, 9 Apr 2021 14:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617980535; 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=ijxCGRXenN7ppJ996N2wR09nhR2j+Ga2ywtJPmR6h+8=; b=VQk5idwrdEEHNanoZ8sAcWl9sKAWIshCd0PU1f4C2N4goQM9RKZmCC0kFDzqYhxePjP0+g Kh6FjfiNKSjdFDIG4ZY4FnbNPwCYs3Udi+6gc6ULBdiaS73ipUttZb0iBNikV1lV6joA6T /QmrItxijqm8d3i3MMlSGMy9mrlB5qM= X-MC-Unique: d7bCJ_O2MIa3a75qAG1oLA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [RFC PATCH 18/43] qemuxml2argvtest: Parse 'arch' from XML early Date: Fri, 9 Apr 2021 16:56:54 +0200 Message-Id: <4ff9e4e0d7e06ee0c269827454b2e48bebb02d83.1617979432.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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.16 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) Content-Type: text/plain; charset="utf-8" If we want to provide correct (fake) caps already for the XML parser we need to be able to parse the arch early so that we can properly initialize the caps cache prior to calling the XML parser. This patch adds code which parses the arch and updates the caps cache prior to the parse step. Signed-off-by: Peter Krempa Reviewed-by: Pavel Hrdina --- tests/qemuxml2argvtest.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index aa6ae9bb4b..eb1bec88f2 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -353,13 +353,13 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy) static int testUpdateQEMUCaps(const struct testQemuInfo *info, - virDomainObjPtr vm, + virArch arch, virCapsPtr caps) { if (!caps) return -1; - virQEMUCapsSetArch(info->qemuCaps, vm->def->os.arch); + virQEMUCapsSetArch(info->qemuCaps, arch); virQEMUCapsInitQMPBasicArch(info->qemuCaps); @@ -648,6 +648,8 @@ testCompareXMLToArgv(const void *data) g_autoptr(xmlDoc) xml =3D NULL; g_autoptr(xmlXPathContext) ctxt =3D NULL; xmlNodePtr root; + g_autofree char *archstr =3D NULL; + virArch arch =3D VIR_ARCH_NONE; if (info->arch !=3D VIR_ARCH_NONE && info->arch !=3D VIR_ARCH_X86_64) qemuTestSetHostArch(&driver, info->arch); @@ -686,6 +688,17 @@ testCompareXMLToArgv(const void *data) ctxt->node =3D root; + if ((archstr =3D virXPathString("string(./os/type[1]/@arch)", ctxt))) { + if ((arch =3D virArchFromString(archstr)) =3D=3D VIR_ARCH_NONE) { + arch =3D virArchFromHost(); + } + } + + if (!(info->flags & FLAG_REAL_CAPS)) { + if (testUpdateQEMUCaps(info, arch, driver.caps) < 0) + goto cleanup; + } + if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) goto cleanup; @@ -739,7 +752,7 @@ testCompareXMLToArgv(const void *data) goto cleanup; if (!(info->flags & FLAG_REAL_CAPS)) { - if (testUpdateQEMUCaps(info, vm, driver.caps) < 0) + if (testUpdateQEMUCaps(info, vm->def->os.arch, driver.caps) < 0) goto cleanup; if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) = < 0) goto cleanup; --=20 2.30.2