From nobody Mon Feb 2 07:31:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1769611586; cv=none; d=zohomail.com; s=zohoarc; b=hG8NuVmR1KAc02n8B/Tisa2P/Nj1OL82OgxMxnghVsjapkzlHb2ZQKr9390RVWjg2K+pXJBugbQ4lcq/GR0bW9VFquhuFIJ4JVxbfKUrThpqcVcqTifwOG28E4en01il/m1u697NCLzZxMe3gC/ei1ridUoqdx44x3JtBuleXpw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769611586; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=V+hCyE4Alzx68hX71XNTkcuISqXZyze3DS5jACKGfk0=; b=X+KBVc94dgs2SJVqqkoNJ5NCZnc8iiF7EBhQOk0/ebi8BaSQekZQPK4L65a3OlhzufH7QfuzESDtKkm+Pfxxr0N//rU64X0VKX2LXNvavVwhdnbcJoF+o6SZ7ybLYMTU5maS80w5m71SpJhd1f9q52H95TLtBKAKOeeln/3TdQc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1769611586760301.27374284995824; Wed, 28 Jan 2026 06:46:26 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 1F5CB4195C; Wed, 28 Jan 2026 09:46:26 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 41F89440BD; Wed, 28 Jan 2026 09:32:47 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 83A6441B62; Wed, 28 Jan 2026 09:32:43 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CD0EF417D6 for ; Wed, 28 Jan 2026 09:31:01 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-600-VuEFOFgGMfiInhBt-UenoQ-1; Wed, 28 Jan 2026 09:30:59 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id E13F61800451 for ; Wed, 28 Jan 2026 14:30:58 +0000 (UTC) Received: from moe (unknown [10.43.3.236]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4AE26195419E for ; Wed, 28 Jan 2026 14:30:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1769610661; h=from:from: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; bh=V+hCyE4Alzx68hX71XNTkcuISqXZyze3DS5jACKGfk0=; b=NbFovHwQVB766hgk1GMD1/3Sy/Tm79FG6rFwPsHmU53GVXMuWqTWYmXzQU6BBzMlGhkqXS tW8P+wlSwcYTUEt+TLvJPb5h9RJC6S/ywpSd1oIs3IOjjYgKmi5n9VDPAiYKPfm9bCH9c0 W8TwN3/kD38teV+5xA7GisSKzZQzom4= X-MC-Unique: VuEFOFgGMfiInhBt-UenoQ-1 X-Mimecast-MFC-AGG-ID: VuEFOFgGMfiInhBt-UenoQ_1769610659 To: devel@lists.libvirt.org Subject: [PATCH 12/20] networkxml2xmltest: Don't recreate xmlopt object Date: Wed, 28 Jan 2026 15:30:33 +0100 Message-ID: <8427239efecc1e480c5cb398d6e47d4f662a500a.1769610369.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vm0e_5BGNPXkkx-tHpbpzk6bRPf8VcAaGNE_O-m-bnQ_1769610659 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: KWTBJVVGROEVKL434E3FX4AKG7ZNVYNY X-Message-ID-Hash: KWTBJVVGROEVKL434E3FX4AKG7ZNVYNY X-MailFrom: mprivozn@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Michal Privoznik via Devel Reply-To: Michal Privoznik X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1769611589637154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik The aim of virNetworkXMLOption object is to provide some immutable data to XML parser (e.g. various callbacks). Since the object is immutable, it can be created once and then reused by all test cases. Signed-off-by: Michal Privoznik --- tests/networkxml2xmltest.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index 10eed8173e..325a43c385 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -23,18 +23,16 @@ typedef enum { } testCompareNetXML2XMLResult; =20 static int -testCompareXMLToXMLFiles(const char *inxml, const char *outxml, +testCompareXMLToXMLFiles(const char *inxml, + const char *outxml, unsigned int flags, - testCompareNetXML2XMLResult expectResult) + testCompareNetXML2XMLResult expectResult, + virNetworkXMLOption *xmlopt) { g_autofree char *actual =3D NULL; int ret; testCompareNetXML2XMLResult result =3D TEST_COMPARE_NET_XML2XML_RESULT= _SUCCESS; g_autoptr(virNetworkDef) dev =3D NULL; - g_autoptr(virNetworkXMLOption) xmlopt =3D NULL; - - if (!(xmlopt =3D networkDnsmasqCreateXMLConf())) - goto cleanup; =20 if (!(dev =3D virNetworkDefParse(NULL, inxml, xmlopt, false))) { result =3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE; @@ -85,6 +83,7 @@ struct testInfo { const char *name; unsigned int flags; testCompareNetXML2XMLResult expectResult; + virNetworkXMLOption *xmlopt; }; =20 static int @@ -99,7 +98,7 @@ testCompareXMLToXMLHelper(const void *data) outxml =3D g_strdup_printf("%s/networkxml2xmlout/%s.xml", abs_srcdir, = info->name); =20 result =3D testCompareXMLToXMLFiles(inxml, outxml, info->flags, - info->expectResult); + info->expectResult, info->xmlopt); =20 return result; } @@ -107,11 +106,15 @@ testCompareXMLToXMLHelper(const void *data) static int mymain(void) { + g_autoptr(virNetworkXMLOption) xmlopt =3D NULL; int ret =3D 0; =20 + if (!(xmlopt =3D networkDnsmasqCreateXMLConf())) + return -1; + #define DO_TEST_FULL(name, flags, expectResult) \ do { \ - const struct testInfo info =3D {name, flags, expectResult}; \ + const struct testInfo info =3D {name, flags, expectResult, xmlopt}= ; \ if (virTestRun("Network XML-2-XML " name, \ testCompareXMLToXMLHelper, &info) < 0) \ ret =3D -1; \ --=20 2.52.0