From nobody Mon Feb 2 07:30:42 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=1769611676; cv=none; d=zohomail.com; s=zohoarc; b=hc4BIQtJp7zRUG4lNVBJzp+gtgS0wWkVrjhzBsYpxiF3R17lHCkZn1sR4Spaa/Fv7d/X4naDtkVdWGcSyjsh5HDakqJC6MQp+3dPv8tNB+7OKhTRcm6sdFiAol9tw8rEZlRhfeC+hf3U4bD4ZceqrL235vpsvsUjV1QJI4DmWS8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1769611676; 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=8ctH/l1/GeAn8GyIe/q6XSJjj5nfGmF5NeBTWgJI5i8=; b=BIE0uPae3zo7m3lqQIDWeISNvgYaGC4XFyULQJ5GRvOf2U3CdTgQzfCxxb2yrnS0YehsBuvSyMFIa4ZFipdMdLqgBTaBv8Z8ccXfXpZPneB/ZP76w0n+aC3aZL6Fpr2dBWcWGxXSA835ce26G09LDRkHht7J0ju2QFU7koMs81c= 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 1769611676636363.51410179164964; Wed, 28 Jan 2026 06:47:56 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id CB06441B82; Wed, 28 Jan 2026 09:47:55 -0500 (EST) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 04B2F44128; Wed, 28 Jan 2026 09:33:43 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id BF25541BF3; Wed, 28 Jan 2026 09:33:36 -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 DB055418B2 for ; Wed, 28 Jan 2026 09:31:03 -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-324-zfdjGmgyMNuoPXAA0PqR6A-1; Wed, 28 Jan 2026 09:31:01 -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 E009418005BA for ; Wed, 28 Jan 2026 14:31:00 +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 4991A19540E9 for ; Wed, 28 Jan 2026 14:31:00 +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=1769610663; 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=8ctH/l1/GeAn8GyIe/q6XSJjj5nfGmF5NeBTWgJI5i8=; b=IS+itCr/xH+U1IpsYHqriZs5ZnETVjyQU8a66Cmb0zh9roG347LhRl1VcAGHTASh8Ap101 M98RDMahFITgviBH0O0yBvgdoSUKlFtpyk7X0lPucVpjpdTHgfPDBr2qA2Db4WiyK3k5l2 LCx+GZCOgY2dkscY/S++W7J8kHMO00E= X-MC-Unique: zfdjGmgyMNuoPXAA0PqR6A-1 X-Mimecast-MFC-AGG-ID: zfdjGmgyMNuoPXAA0PqR6A_1769610661 To: devel@lists.libvirt.org Subject: [PATCH 14/20] networkxml2xmltest: Move path generation into testRun() Date: Wed, 28 Jan 2026 15:30:35 +0100 Message-ID: <6ef3b79760a550d25d4bf93fbd4f03fc54f70cf0.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: gFIPnuA8ON9gN0SMSQnnVciBeSE55JG4ajbwvNmUwKE_1769610661 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: DWHOJ5UFTFBWN2FHX43VTLUDFLAXWF2L X-Message-ID-Hash: DWHOJ5UFTFBWN2FHX43VTLUDFLAXWF2L 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: 1769611679099154100 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Michal Privoznik This effectively dissolves testCompareXMLToXMLHelper() into testRun(). Motivation is that parts of data generated inside of testCompareXMLToXMLHelper() is going to be reused from the caller (testRun()). Signed-off-by: Michal Privoznik --- tests/networkxml2xmltest.c | 69 +++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 39 deletions(-) diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index 552364818d..2a537d77c0 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -22,86 +22,69 @@ typedef enum { TEST_COMPARE_NET_XML2XML_RESULT_FAIL_COMPARE, } testCompareNetXML2XMLResult; =20 +struct testInfo { + const char *name; + unsigned int flags; + testCompareNetXML2XMLResult expectResult; + virNetworkXMLOption *xmlopt; + const char *inxml; + const char *outxml; +}; + static int -testCompareXMLToXMLFiles(const char *inxml, - const char *outxml, - unsigned int flags, - testCompareNetXML2XMLResult expectResult, - virNetworkXMLOption *xmlopt) +testCompareXMLToXMLFiles(const void *data) { + struct testInfo *info =3D (void *) data; g_autofree char *actual =3D NULL; int ret; testCompareNetXML2XMLResult result =3D TEST_COMPARE_NET_XML2XML_RESULT= _SUCCESS; g_autoptr(virNetworkDef) dev =3D NULL; =20 - if (!(dev =3D virNetworkDefParse(NULL, inxml, xmlopt, false))) { + if (!(dev =3D virNetworkDefParse(NULL, info->inxml, info->xmlopt, fals= e))) { result =3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE; goto cleanup; } - if (expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PARSE) + if (info->expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_PAR= SE) goto cleanup; =20 if (networkValidateTests(dev) < 0) { result =3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_VALIDATE; goto cleanup; } - if (expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_VALIDATE) + if (info->expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_VAL= IDATE) goto cleanup; =20 - if (!(actual =3D virNetworkDefFormat(dev, xmlopt, flags))) { + if (!(actual =3D virNetworkDefFormat(dev, info->xmlopt, info->flags)))= { result =3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FORMAT; goto cleanup; } - if (expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FORMAT) + if (info->expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_FOR= MAT) goto cleanup; =20 - if (virTestCompareToFile(actual, outxml) < 0) { + if (virTestCompareToFile(actual, info->outxml) < 0) { result =3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_COMPARE; goto cleanup; } - if (expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_COMPARE) + if (info->expectResult =3D=3D TEST_COMPARE_NET_XML2XML_RESULT_FAIL_COM= PARE) goto cleanup; =20 cleanup: - if (result =3D=3D expectResult) { + if (result =3D=3D info->expectResult) { ret =3D 0; - if (expectResult !=3D TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS) { + if (info->expectResult !=3D TEST_COMPARE_NET_XML2XML_RESULT_SUCCES= S) { VIR_TEST_DEBUG("Got expected failure code=3D%d msg=3D%s", result, virGetLastErrorMessage()); } } else { ret =3D -1; VIR_TEST_DEBUG("Expected result code=3D%d but received code=3D%d", - expectResult, result); + info->expectResult, result); } virResetLastError(); =20 return ret; } =20 -struct testInfo { - const char *name; - unsigned int flags; - testCompareNetXML2XMLResult expectResult; - virNetworkXMLOption *xmlopt; -}; - -static int -testCompareXMLToXMLHelper(const void *data) -{ - const struct testInfo *info =3D data; - int result =3D -1; - g_autofree char *inxml =3D NULL; - g_autofree char *outxml =3D NULL; - - inxml =3D g_strdup_printf("%s/networkxml2xmlin/%s.xml", abs_srcdir, in= fo->name); - outxml =3D g_strdup_printf("%s/networkxml2xmlout/%s.xml", abs_srcdir, = info->name); - - result =3D testCompareXMLToXMLFiles(inxml, outxml, info->flags, - info->expectResult, info->xmlopt); - - return result; -} =20 static void testRun(const char *name, @@ -112,8 +95,16 @@ testRun(const char *name, { g_autofree char *name_xml2xml =3D g_strdup_printf("Network XML-2-XML %= s", name); struct testInfo info =3D { .name =3D name, .flags =3D flags, .expectRe= sult =3D expectResult, .xmlopt =3D xmlopt }; + g_autofree char *inxml =3D NULL; + g_autofree char *outxml =3D NULL; =20 - virTestRunLog(ret, name_xml2xml, testCompareXMLToXMLHelper, &info); + inxml =3D g_strdup_printf("%s/networkxml2xmlin/%s.xml", abs_srcdir, na= me); + outxml =3D g_strdup_printf("%s/networkxml2xmlout/%s.xml", abs_srcdir, = name); + + info.inxml =3D inxml; + info.outxml =3D outxml; + + virTestRunLog(ret, name_xml2xml, testCompareXMLToXMLFiles, &info); } =20 static int --=20 2.52.0