From nobody Sun Feb 8 17:03:33 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=1664872504; cv=none; d=zohomail.com; s=zohoarc; b=Ex7VuTAUtV4B+pO/qduZATKI1oLHdAEwTnSsTJ6erSJZ2FKhDL63bjPf3vLGw4AZN9WTyLmzqZ860sTTiEhYC/7yME3P1uQLOS306TocEIVVwC5bAcpotQRmPzf1zeZzE+dB9mW9Smi2hQu/1G6wljBUV5XKWKiRsKZczROOh0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664872504; 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=UI1hwtP4Nv+nBO/VgE4BVOvwfnibLAUN7CWtIggBIF0=; b=F05enIQSu8+C2lm4CCWspC0tWRzJGBtXKOZ4PYoZl0MvN3y1eGEF5eK8LGOo/lK0yvgFCRmwuwIshU6tfx0zKbUk72neq/6AP6P3jJoH4fTVMQAgPme2A9bk/PwXYWGX7c35TRkUSTClwW56TBqq126on/MQKpmTWqcdNKhBY0k= 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 1664872504034960.7214884723425; Tue, 4 Oct 2022 01:35:04 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-503-sfqXT8n0MP2rJIPhXBs61g-1; Tue, 04 Oct 2022 04:33:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4510E857AAA; Tue, 4 Oct 2022 08:33:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31BD3140EBF3; Tue, 4 Oct 2022 08:33:28 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2785119465A2; Tue, 4 Oct 2022 08:33:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B8EF8194658F for ; Tue, 4 Oct 2022 08:33:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A8C5640C6EC3; Tue, 4 Oct 2022 08:33:26 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 285FA40C6EC2 for ; Tue, 4 Oct 2022 08:33:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664872503; 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=UI1hwtP4Nv+nBO/VgE4BVOvwfnibLAUN7CWtIggBIF0=; b=U7mR+PfdTqLexEwVkJPlFX2SBTHTj+l1FbTGPq7Rv3Zf2hf5QJsNawx7nE2HhgrsddW31e Qm0IkiawiUMyfKtzSURaQLU6cmrZKRbUQwl30O+6j2AeH/Mo4SJEZ3vBD0blDstR0UdXBH 3h7EucO2XM7rjNYfeGNL182HmWPOnzE= X-MC-Unique: sfqXT8n0MP2rJIPhXBs61g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/43] tests: qemuxml2argv: Use virXMLParse properly Date: Tue, 4 Oct 2022 10:32:42 +0200 Message-Id: <295985d040ecf8aa874cbd738fc046fa32e685a5.1664870258.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 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: 1664872505908100001 Content-Type: text/plain; charset="utf-8" Don't validate the root node and don't allocate a private XPath context when virXMLParse can do that internally. Signed-off-by: Peter Krempa --- tests/qemuxml2argvtest.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 89bed6a46e..8785c96ce1 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -626,7 +626,6 @@ testCompareXMLToArgv(const void *data) qemuDomainObjPrivate *priv =3D NULL; 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; g_autoptr(virIdentity) sysident =3D virIdentityGetSystem(); @@ -673,21 +672,9 @@ testCompareXMLToArgv(const void *data) goto cleanup; if (!(xml =3D virXMLParse(info->infile, NULL, "(domain_definition)", - NULL, NULL, NULL, false))) + "domain", &ctxt, NULL, false))) goto cleanup; - root =3D xmlDocGetRootElement(xml); - if (!virXMLNodeNameEqual(root, "domain")) { - VIR_TEST_VERBOSE("unexpected root element <%s>, expecting = ", - root->name); - goto cleanup; - } - - if (!(ctxt =3D virXMLXPathContextNew(xml))) - goto cleanup; - - ctxt->node =3D root; - if ((archstr =3D virXPathString("string(./os/type[1]/@arch)", ctxt))) arch =3D virArchFromString(archstr); @@ -722,7 +709,7 @@ testCompareXMLToArgv(const void *data) parseFlags |=3D VIR_DOMAIN_DEF_PARSE_INACTIVE; - if (!(vm->def =3D virDomainDefParseNode(xml, root, driver.xmlopt, NULL, + if (!(vm->def =3D virDomainDefParseNode(xml, ctxt->node, driver.xmlopt= , NULL, parseFlags))) { err =3D virGetLastError(); if (!err) { --=20 2.37.3