From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155413726174643.621147074740065; Mon, 1 Apr 2019 09:47:41 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D85488311; Mon, 1 Apr 2019 16:47:40 +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 4176F28543; Mon, 1 Apr 2019 16:47:39 +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 E166841F3E; Mon, 1 Apr 2019 16:47:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GlYNA026652 for ; Mon, 1 Apr 2019 12:47:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7ADFD5C27C; Mon, 1 Apr 2019 16:47:34 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 167985C28C; Mon, 1 Apr 2019 16:47:33 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:17 -0400 Message-Id: <8cc14a94c53a1cf2a82231817680bb47f57cbc26.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/12] tests: qemuxml2xml: Break out testInfoSet*Paths 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 01 Apr 2019 16:47:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" These will need to be separate to share testInfo with qemuxml2argv Signed-off-by: Cole Robinson Reviewed-by: Andrea Bolognani --- tests/qemuxml2xmltest.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 83a0d1cf7b..2dfa9e628b 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -129,16 +129,11 @@ testInfoSetCommon(struct testInfo *info, return -1; } =20 - static int -testInfoSet(struct testInfo *info, - const char *name, - int when, - int gic) +testInfoSetPaths(struct testInfo *info, + const char *name, + int when) { - if (testInfoSetCommon(info, gic) < 0) - return -1; - if (virAsprintf(&info->inName, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, name) < 0) goto error; @@ -186,13 +181,9 @@ testInfoSet(struct testInfo *info, static const char *statusPath =3D abs_srcdir "/qemustatusxml2xmldata/"; =20 static int -testInfoSetStatus(struct testInfo *info, - const char *name, - int gic) +testInfoSetStatusPaths(struct testInfo *info, + const char *name) { - if (testInfoSetCommon(info, gic) < 0) - return -1; - if (virAsprintf(&info->inName, "%s%s-in.xml", statusPath, name) < 0 || virAsprintf(&info->outActiveName, "%s%s-out.xml", statusPath, name= ) < 0) goto error; @@ -236,7 +227,8 @@ mymain(void) =20 # define DO_TEST_FULL(name, when, gic, ...) \ do { \ - if (testInfoSet(&info, name, when, gic) < 0) { \ + if (testInfoSetCommon(&info, gic) < 0 || \ + testInfoSetPaths(&info, name, when) < 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", name);= \ return -1; \ } \ @@ -1241,7 +1233,8 @@ mymain(void) =20 # define DO_TEST_STATUS(name) \ do { \ - if (testInfoSetStatus(&info, name, GIC_NONE) < 0) { \ + if (testInfoSetCommon(&info, GIC_NONE) < 0 || \ + testInfoSetStatusPaths(&info, name) < 0) { \ VIR_TEST_DEBUG("Failed to generate status test data for '%s'",= name); \ return -1; \ } \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 155413726205264.4696584433824; Mon, 1 Apr 2019 09:47:42 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 1E7C459447; Mon, 1 Apr 2019 16:47:40 +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 41726601A5; Mon, 1 Apr 2019 16:47:39 +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 D2BE741F3D; Mon, 1 Apr 2019 16:47:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GlZsS026661 for ; Mon, 1 Apr 2019 12:47:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E05D5C28C; Mon, 1 Apr 2019 16:47:35 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id ABC1E5C25A; Mon, 1 Apr 2019 16:47:34 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:18 -0400 Message-Id: <31040eaf236a6e468dc9e88cebaff6bada2a9b58.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] tests: qemuxml2xml: Add info->{in, out}file 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 01 Apr 2019 16:47:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Just renamed from existing inName and outActiveName Signed-off-by: Cole Robinson Reviewed-by: Andrea Bolognani --- tests/qemuxml2xmltest.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 2dfa9e628b..0ced565fbc 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -26,8 +26,8 @@ enum { }; =20 struct testInfo { - char *inName; - char *outActiveName; + char *infile; + char *outfile; char *outInactiveName; =20 virQEMUCapsPtr qemuCaps; @@ -40,7 +40,7 @@ testXML2XMLActive(const void *opaque) const struct testInfo *info =3D opaque; =20 return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, - info->inName, info->outActiveName, t= rue, + info->infile, info->outfile, true, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCC= ESS); } @@ -51,7 +51,7 @@ testXML2XMLInactive(const void *opaque) { const struct testInfo *info =3D opaque; =20 - return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->in= Name, + return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->in= file, info->outInactiveName, false, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCC= ESS); @@ -66,13 +66,13 @@ testCompareStatusXMLToXMLFiles(const void *opaque) char *actual =3D NULL; int ret =3D -1; =20 - if (!(obj =3D virDomainObjParseFile(data->inName, driver.caps, driver.= xmlopt, + if (!(obj =3D virDomainObjParseFile(data->infile, driver.caps, driver.= xmlopt, VIR_DOMAIN_DEF_PARSE_STATUS | VIR_DOMAIN_DEF_PARSE_ACTUAL_NET | VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES= | VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE | VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARS= E_FAIL))) { - VIR_TEST_DEBUG("\nfailed to parse '%s'\n", data->inName); + VIR_TEST_DEBUG("\nfailed to parse '%s'\n", data->infile); goto cleanup; } =20 @@ -82,11 +82,11 @@ testCompareStatusXMLToXMLFiles(const void *opaque) VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET | VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATE= S | VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST))= ) { - VIR_TEST_DEBUG("\nfailed to format back '%s'\n", data->inName); + VIR_TEST_DEBUG("\nfailed to format back '%s'\n", data->infile); goto cleanup; } =20 - if (virTestCompareToFile(actual, data->outActiveName) < 0) + if (virTestCompareToFile(actual, data->outfile) < 0) goto cleanup; =20 ret =3D 0; @@ -101,8 +101,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque) static void testInfoClear(struct testInfo *info) { - VIR_FREE(info->inName); - VIR_FREE(info->outActiveName); + VIR_FREE(info->infile); + VIR_FREE(info->outfile); VIR_FREE(info->outInactiveName); =20 virObjectUnref(info->qemuCaps); @@ -134,7 +134,7 @@ testInfoSetPaths(struct testInfo *info, const char *name, int when) { - if (virAsprintf(&info->inName, "%s/qemuxml2argvdata/%s.xml", + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, name) < 0) goto error; =20 @@ -155,15 +155,15 @@ testInfoSetPaths(struct testInfo *info, } =20 if (when & WHEN_ACTIVE) { - if (virAsprintf(&info->outActiveName, + if (virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s-active.xml", abs_srcdir, name) < 0) goto error; =20 - if (!virFileExists(info->outActiveName)) { - VIR_FREE(info->outActiveName); + if (!virFileExists(info->outfile)) { + VIR_FREE(info->outfile); =20 - if (virAsprintf(&info->outActiveName, + if (virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s.xml", abs_srcdir, name) < 0) goto error; @@ -184,8 +184,8 @@ static int testInfoSetStatusPaths(struct testInfo *info, const char *name) { - if (virAsprintf(&info->inName, "%s%s-in.xml", statusPath, name) < 0 || - virAsprintf(&info->outActiveName, "%s%s-out.xml", statusPath, name= ) < 0) + if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 || + virAsprintf(&info->outfile, "%s%s-out.xml", statusPath, name) < 0) goto error; =20 return 0; @@ -240,7 +240,7 @@ mymain(void) ret =3D -1; \ } \ \ - if (info.outActiveName) { \ + if (info.outfile) { \ if (virTestRun("QEMU XML-2-XML-active " name, \ testXML2XMLActive, &info) < 0) \ ret =3D -1; \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137273697806.7700095213289; Mon, 1 Apr 2019 09:47:53 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 62520C024FE6; Mon, 1 Apr 2019 16:47:52 +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 3C95B5C27C; Mon, 1 Apr 2019 16:47:52 +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 0063B3FAF4; Mon, 1 Apr 2019 16:47:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GlZQ9026671 for ; Mon, 1 Apr 2019 12:47:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id CCEB15C28C; Mon, 1 Apr 2019 16:47:35 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C9535C25A; Mon, 1 Apr 2019 16:47:35 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:19 -0400 Message-Id: <6451264a9031a9fd8182a0a4459166bcfb54125a.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/12] tests: qemuxml2xml: Remove info->outActiveName 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 01 Apr 2019 16:47:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Reuse info->outfile for it. This requires us to set paths before each virTestRun invocation Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 61 +++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 36 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 0ced565fbc..538ccae8fd 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -28,7 +28,6 @@ enum { struct testInfo { char *infile; char *outfile; - char *outInactiveName; =20 virQEMUCapsPtr qemuCaps; }; @@ -40,8 +39,7 @@ testXML2XMLActive(const void *opaque) const struct testInfo *info =3D opaque; =20 return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, - info->infile, info->outfile, true, - 0, + info->infile, info->outfile, true, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCC= ESS); } =20 @@ -51,9 +49,8 @@ testXML2XMLInactive(const void *opaque) { const struct testInfo *info =3D opaque; =20 - return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->in= file, - info->outInactiveName, false, - 0, + return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, + info->infile, info->outfile, false, = 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCC= ESS); } =20 @@ -103,7 +100,6 @@ testInfoClear(struct testInfo *info) { VIR_FREE(info->infile); VIR_FREE(info->outfile); - VIR_FREE(info->outInactiveName); =20 virObjectUnref(info->qemuCaps); } @@ -134,40 +130,26 @@ testInfoSetPaths(struct testInfo *info, const char *name, int when) { + VIR_FREE(info->infile); + VIR_FREE(info->outfile); + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, name) < 0) goto error; =20 - if (when & WHEN_INACTIVE) { - if (virAsprintf(&info->outInactiveName, - "%s/qemuxml2xmloutdata/%s-inactive.xml", - abs_srcdir, name) < 0) - goto error; - - if (!virFileExists(info->outInactiveName)) { - VIR_FREE(info->outInactiveName); + if (virAsprintf(&info->outfile, + "%s/qemuxml2xmloutdata/%s-%s.xml", + abs_srcdir, name, + when =3D=3D WHEN_ACTIVE ? "active" : "inactive") < 0) + goto error; =20 - if (virAsprintf(&info->outInactiveName, - "%s/qemuxml2xmloutdata/%s.xml", - abs_srcdir, name) < 0) - goto error; - } - } + if (!virFileExists(info->outfile)) { + VIR_FREE(info->outfile); =20 - if (when & WHEN_ACTIVE) { if (virAsprintf(&info->outfile, - "%s/qemuxml2xmloutdata/%s-active.xml", + "%s/qemuxml2xmloutdata/%s.xml", abs_srcdir, name) < 0) goto error; - - if (!virFileExists(info->outfile)) { - VIR_FREE(info->outfile); - - if (virAsprintf(&info->outfile, - "%s/qemuxml2xmloutdata/%s.xml", - abs_srcdir, name) < 0) - goto error; - } } =20 return 0; @@ -227,20 +209,27 @@ mymain(void) =20 # define DO_TEST_FULL(name, when, gic, ...) \ do { \ - if (testInfoSetCommon(&info, gic) < 0 || \ - testInfoSetPaths(&info, name, when) < 0) { \ + if (testInfoSetCommon(&info, gic) < 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", name);= \ return -1; \ } \ virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ \ - if (info.outInactiveName) { \ + if (when & WHEN_INACTIVE) { \ + if (testInfoSetPaths(&info, name, WHEN_INACTIVE) < 0) { \ + VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'= ", name); \ + return -1; \ + } \ if (virTestRun("QEMU XML-2-XML-inactive " name, \ testXML2XMLInactive, &info) < 0) \ ret =3D -1; \ } \ \ - if (info.outfile) { \ + if (when & WHEN_ACTIVE) { \ + if (testInfoSetPaths(&info, name, WHEN_ACTIVE) < 0) { \ + VIR_TEST_DEBUG("Failed to generate active paths for '%s'",= name); \ + return -1; \ + } \ if (virTestRun("QEMU XML-2-XML-active " name, \ testXML2XMLActive, &info) < 0) \ ret =3D -1; \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137277466768.0660276780193; Mon, 1 Apr 2019 09:47:57 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 1997F5944D; Mon, 1 Apr 2019 16:47:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DE14187B9; Mon, 1 Apr 2019 16:47:55 +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 9CE281819AFF; Mon, 1 Apr 2019 16:47:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31Glamh026682 for ; Mon, 1 Apr 2019 12:47:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id A247D5C27C; Mon, 1 Apr 2019 16:47:36 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D1985C28C; Mon, 1 Apr 2019 16:47:35 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:20 -0400 Message-Id: <30eaad11068f933f64ac07af35495bb5b2953377.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/12] tests: qemuxml2argv: Add info->{in, out}file 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 01 Apr 2019 16:47:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Track infile and outfile in testInfo. This is step towards moving path creation out of the test case, which will eventually help sharing more code with qemuxml2xmltest.c Signed-off-by: Cole Robinson Reviewed-by: Andrea Bolognani --- tests/qemuxml2argvtest.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0c0dcae197..ff7bacf8db 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -299,6 +299,8 @@ typedef enum { struct testInfo { const char *name; const char *suffix; + char *infile; + char *outfile; virQEMUCapsPtr qemuCaps; const char *migrateFrom; int migrateFd; @@ -427,8 +429,6 @@ static int testCompareXMLToArgv(const void *data) { struct testInfo *info =3D (void *) data; - char *xml =3D NULL; - char *args =3D NULL; char *migrateURI =3D NULL; char *actualargv =3D NULL; const char *suffix =3D info->suffix; @@ -471,9 +471,9 @@ testCompareXMLToArgv(const void *data) if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) goto cleanup; =20 - if (virAsprintf(&xml, "%s/qemuxml2argvdata/%s.xml", + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, info->name) < 0 || - virAsprintf(&args, "%s/qemuxml2argvdata/%s%s.args", + virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", abs_srcdir, info->name, suffix) < 0) goto cleanup; =20 @@ -486,7 +486,8 @@ testCompareXMLToArgv(const void *data) goto cleanup; =20 parseFlags |=3D VIR_DOMAIN_DEF_PARSE_INACTIVE; - if (!(vm->def =3D virDomainDefParseFile(xml, driver.caps, driver.xmlop= t, + if (!(vm->def =3D virDomainDefParseFile(info->infile, + driver.caps, driver.xmlopt, NULL, parseFlags))) { if (flags & FLAG_EXPECT_PARSE_ERROR) goto ok; @@ -502,7 +503,7 @@ testCompareXMLToArgv(const void *data) goto cleanup; =20 if (!virDomainDefCheckABIStability(vm->def, vm->def, driver.xmlopt)) { - VIR_TEST_DEBUG("ABI stability check failed on %s", xml); + VIR_TEST_DEBUG("ABI stability check failed on %s", info->infile); goto cleanup; } =20 @@ -570,7 +571,7 @@ testCompareXMLToArgv(const void *data) if (!(actualargv =3D virCommandToString(cmd, false))) goto cleanup; =20 - if (virTestCompareToFile(actualargv, args) < 0) + if (virTestCompareToFile(actualargv, info->outfile) < 0) goto cleanup; =20 ret =3D 0; @@ -600,8 +601,6 @@ testCompareXMLToArgv(const void *data) virSetConnectStorage(NULL); virObjectUnref(conn); VIR_FREE(migrateURI); - VIR_FREE(xml); - VIR_FREE(args); return ret; } =20 @@ -754,6 +753,8 @@ testInfoSetArgs(struct testInfo *info, static void testInfoClear(struct testInfo *info) { + VIR_FREE(info->infile); + VIR_FREE(info->outfile); virObjectUnref(info->qemuCaps); } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137273474600.1113630056052; Mon, 1 Apr 2019 09:47:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65FE07F746; Mon, 1 Apr 2019 16:47:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E896BA93; Mon, 1 Apr 2019 16:47:52 +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 F2921180338A; Mon, 1 Apr 2019 16:47:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GlbdB026695 for ; Mon, 1 Apr 2019 12:47:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 405805C27C; Mon, 1 Apr 2019 16:47:37 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFEC15C25A; Mon, 1 Apr 2019 16:47:36 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:21 -0400 Message-Id: <360558146ac0c43c7779c522d0b4d90078ccd950.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/12] tests: qemuxml2argv: add testInfoSetPaths 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 01 Apr 2019 16:47:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This moves infile and outfile building outside the test case, which better fits the pattern of qemuxml2xmltest. It also lets us drop the qemuxml2argtest-specific 'suffix' from testInfo Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index ff7bacf8db..a3fee41ea9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -298,7 +298,6 @@ typedef enum { =20 struct testInfo { const char *name; - const char *suffix; char *infile; char *outfile; virQEMUCapsPtr qemuCaps; @@ -431,7 +430,6 @@ testCompareXMLToArgv(const void *data) struct testInfo *info =3D (void *) data; char *migrateURI =3D NULL; char *actualargv =3D NULL; - const char *suffix =3D info->suffix; unsigned int flags =3D info->flags; unsigned int parseFlags =3D info->parseFlags; int ret =3D -1; @@ -448,9 +446,6 @@ testCompareXMLToArgv(const void *data) if (!(conn =3D virGetConnect())) goto cleanup; =20 - if (!suffix) - suffix =3D ""; - conn->secretDriver =3D &fakeSecretDriver; conn->storageDriver =3D &fakeStorageDriver; conn->nwfilterDriver =3D &fakeNWFilterDriver; @@ -471,12 +466,6 @@ testCompareXMLToArgv(const void *data) if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) goto cleanup; =20 - if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", - abs_srcdir, info->name) < 0 || - virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", - abs_srcdir, info->name, suffix) < 0) - goto cleanup; - if (info->migrateFrom && !(migrateURI =3D qemuMigrationDstGetURI(info->migrateFrom, info->migrateFd))) @@ -758,6 +747,17 @@ testInfoClear(struct testInfo *info) virObjectUnref(info->qemuCaps); } =20 +static int +testInfoSetPaths(struct testInfo *info, const char *suffix) +{ + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", + abs_srcdir, info->name) < 0 || + virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", + abs_srcdir, info->name, suffix ? suffix : "") < 0) + return -1; + return 0; +} + # define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX" =20 static int @@ -883,11 +883,12 @@ mymain(void) do { \ static struct testInfo info =3D { \ .name =3D _name, \ - .suffix =3D _suffix, \ }; \ if (testInfoSetArgs(&info, capslatest, \ __VA_ARGS__, ARG_END) < 0) \ return EXIT_FAILURE; \ + if (testInfoSetPaths(&info, _suffix)) \ + return EXIT_FAILURE; \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ testCompareXMLToArgv, &info) < 0) \ ret =3D -1; \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137280949702.5976142109207; Mon, 1 Apr 2019 09:48:00 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5D8D6699B; Mon, 1 Apr 2019 16:47:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AB3C27CD6; Mon, 1 Apr 2019 16:47:59 +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 4945C181A135; Mon, 1 Apr 2019 16:47:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GlbQB026707 for ; Mon, 1 Apr 2019 12:47:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id D9D325C27C; Mon, 1 Apr 2019 16:47:37 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 737A45C206; Mon, 1 Apr 2019 16:47:37 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:22 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/12] tests: qemuxml2argv: Rename testInfo* to testQemuInfo* 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 01 Apr 2019 16:48:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In preparation for moving these bits to a shared place, rename them to match one of the testqemuutils.c function prefixes. Rename info->flags handling too as it will need to be moved testInfoSetPaths isn't renamed because it will stay local Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a3fee41ea9..b87d2e3fb9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -294,9 +294,9 @@ typedef enum { FLAG_FIPS =3D 1 << 2, FLAG_REAL_CAPS =3D 1 << 3, FLAG_SKIP_LEGACY_CPUS =3D 1 << 4, -} virQemuXML2ArgvTestFlags; +} testQemuInfoFlags; =20 -struct testInfo { +struct testQemuInfo { const char *name; char *infile; char *outfile; @@ -380,7 +380,7 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy) =20 =20 static int -testUpdateQEMUCaps(const struct testInfo *info, +testUpdateQEMUCaps(const struct testQemuInfo *info, virDomainObjPtr vm, virCapsPtr caps) { @@ -410,7 +410,7 @@ testUpdateQEMUCaps(const struct testInfo *info, =20 =20 static int -testCheckExclusiveFlags(int flags) +testQemuInfoCheckExclusiveFlags(int flags) { virCheckFlags(FLAG_EXPECT_FAILURE | FLAG_EXPECT_PARSE_ERROR | @@ -427,7 +427,7 @@ testCheckExclusiveFlags(int flags) static int testCompareXMLToArgv(const void *data) { - struct testInfo *info =3D (void *) data; + struct testQemuInfo *info =3D (void *) data; char *migrateURI =3D NULL; char *actualargv =3D NULL; unsigned int flags =3D info->flags; @@ -460,7 +460,7 @@ testCompareXMLToArgv(const void *data) if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_ENABLE_FIPS)) flags |=3D FLAG_FIPS; =20 - if (testCheckExclusiveFlags(info->flags) < 0) + if (testQemuInfoCheckExclusiveFlags(info->flags) < 0) goto cleanup; =20 if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) @@ -605,14 +605,14 @@ typedef enum { ARG_CAPS_ARCH, ARG_CAPS_VER, ARG_END, -} testInfoArgName; +} testQemuInfoArgName; =20 static int -testInfoSetArgs(struct testInfo *info, - virHashTablePtr capslatest, ...) +testQemuInfoSetArgs(struct testQemuInfo *info, + virHashTablePtr capslatest, ...) { va_list argptr; - testInfoArgName argname; + testQemuInfoArgName argname; virQEMUCapsPtr qemuCaps =3D NULL; int gic =3D GIC_NONE; char *capsarch =3D NULL; @@ -622,7 +622,7 @@ testInfoSetArgs(struct testInfo *info, int ret =3D -1; =20 va_start(argptr, capslatest); - argname =3D va_arg(argptr, testInfoArgName); + argname =3D va_arg(argptr, testQemuInfoArgName); while (argname !=3D ARG_END) { switch (argname) { case ARG_QEMU_CAPS: @@ -684,7 +684,7 @@ testInfoSetArgs(struct testInfo *info, goto cleanup; } =20 - argname =3D va_arg(argptr, testInfoArgName); + argname =3D va_arg(argptr, testQemuInfoArgName); } =20 if (!!capsarch ^ !!capsver) { @@ -740,7 +740,7 @@ testInfoSetArgs(struct testInfo *info, } =20 static void -testInfoClear(struct testInfo *info) +testQemuInfoClear(struct testQemuInfo *info) { VIR_FREE(info->infile); VIR_FREE(info->outfile); @@ -748,7 +748,7 @@ testInfoClear(struct testInfo *info) } =20 static int -testInfoSetPaths(struct testInfo *info, const char *suffix) +testInfoSetPaths(struct testQemuInfo *info, const char *suffix) { if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, info->name) < 0 || @@ -881,18 +881,18 @@ mymain(void) */ # define DO_TEST_INTERNAL(_name, _suffix, ...) \ do { \ - static struct testInfo info =3D { \ + static struct testQemuInfo info =3D { \ .name =3D _name, \ }; \ - if (testInfoSetArgs(&info, capslatest, \ - __VA_ARGS__, ARG_END) < 0) \ + if (testQemuInfoSetArgs(&info, capslatest, \ + __VA_ARGS__, ARG_END) < 0) \ return EXIT_FAILURE; \ if (testInfoSetPaths(&info, _suffix)) \ return EXIT_FAILURE; \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ testCompareXMLToArgv, &info) < 0) \ ret =3D -1; \ - testInfoClear(&info); \ + testQemuInfoClear(&info); \ } while (0) =20 # define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137273566720.5601490067729; Mon, 1 Apr 2019 09:47:53 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 6CD5059449; Mon, 1 Apr 2019 16:47:52 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 408855C28C; Mon, 1 Apr 2019 16:47:52 +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 04377180338B; Mon, 1 Apr 2019 16:47:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31Glc30026712 for ; Mon, 1 Apr 2019 12:47:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D1605C27C; Mon, 1 Apr 2019 16:47:38 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13E995C25A; Mon, 1 Apr 2019 16:47:37 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:23 -0400 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/12] tests: Move testQemuInfo* to testutilsqemu 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 01 Apr 2019 16:47:52 +0000 (UTC) Content-Type: text/plain; charset="utf-8" So it can eventually be shared with qemuxml2xml Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 173 --------------------------------------- tests/testutilsqemu.c | 144 ++++++++++++++++++++++++++++++++ tests/testutilsqemu.h | 39 +++++++++ 3 files changed, 183 insertions(+), 173 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b87d2e3fb9..a51bdb2453 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -288,25 +288,6 @@ static virNWFilterDriver fakeNWFilterDriver =3D { .nwfilterBindingDelete =3D fakeNWFilterBindingDelete, }; =20 -typedef enum { - FLAG_EXPECT_FAILURE =3D 1 << 0, - FLAG_EXPECT_PARSE_ERROR =3D 1 << 1, - FLAG_FIPS =3D 1 << 2, - FLAG_REAL_CAPS =3D 1 << 3, - FLAG_SKIP_LEGACY_CPUS =3D 1 << 4, -} testQemuInfoFlags; - -struct testQemuInfo { - const char *name; - char *infile; - char *outfile; - virQEMUCapsPtr qemuCaps; - const char *migrateFrom; - int migrateFd; - unsigned int flags; - unsigned int parseFlags; -}; - =20 static int testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy) @@ -593,160 +574,6 @@ testCompareXMLToArgv(const void *data) return ret; } =20 -# define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata" - -typedef enum { - ARG_QEMU_CAPS, - ARG_GIC, - ARG_MIGRATE_FROM, - ARG_MIGRATE_FD, - ARG_FLAGS, - ARG_PARSEFLAGS, - ARG_CAPS_ARCH, - ARG_CAPS_VER, - ARG_END, -} testQemuInfoArgName; - -static int -testQemuInfoSetArgs(struct testQemuInfo *info, - virHashTablePtr capslatest, ...) -{ - va_list argptr; - testQemuInfoArgName argname; - virQEMUCapsPtr qemuCaps =3D NULL; - int gic =3D GIC_NONE; - char *capsarch =3D NULL; - char *capsver =3D NULL; - VIR_AUTOFREE(char *) capsfile =3D NULL; - int flag; - int ret =3D -1; - - va_start(argptr, capslatest); - argname =3D va_arg(argptr, testQemuInfoArgName); - while (argname !=3D ARG_END) { - switch (argname) { - case ARG_QEMU_CAPS: - if (qemuCaps || !(qemuCaps =3D virQEMUCapsNew())) - goto cleanup; - - while ((flag =3D va_arg(argptr, int)) < QEMU_CAPS_LAST) - virQEMUCapsSet(qemuCaps, flag); - - /* Some tests are run with NONE capabilities, which is just - * another name for QEMU_CAPS_LAST. If that is the case the - * arguments look like this : - * - * ARG_QEMU_CAPS, NONE, QEMU_CAPS_LAST, ARG_END - * - * Fetch one argument more and if it is QEMU_CAPS_LAST then - * break from the switch() to force getting next argument - * in the line. If it is not QEMU_CAPS_LAST then we've - * fetched real ARG_* and we must process it. - */ - if ((flag =3D va_arg(argptr, int)) !=3D QEMU_CAPS_LAST) { - argname =3D flag; - continue; - } - - break; - - case ARG_GIC: - gic =3D va_arg(argptr, int); - break; - - case ARG_MIGRATE_FROM: - info->migrateFrom =3D va_arg(argptr, char *); - break; - - case ARG_MIGRATE_FD: - info->migrateFd =3D va_arg(argptr, int); - break; - - case ARG_FLAGS: - info->flags =3D va_arg(argptr, int); - break; - - case ARG_PARSEFLAGS: - info->parseFlags =3D va_arg(argptr, int); - break; - - case ARG_CAPS_ARCH: - capsarch =3D va_arg(argptr, char *); - break; - - case ARG_CAPS_VER: - capsver =3D va_arg(argptr, char *); - break; - - case ARG_END: - default: - fprintf(stderr, "Unexpected test info argument"); - goto cleanup; - } - - argname =3D va_arg(argptr, testQemuInfoArgName); - } - - if (!!capsarch ^ !!capsver) { - fprintf(stderr, "ARG_CAPS_ARCH and ARG_CAPS_VER " - "must be specified together.\n"); - goto cleanup; - } - - if (qemuCaps && (capsarch || capsver)) { - fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_A= RCH " - "or ARG_CAPS_VER\n"); - goto cleanup; - } - - if (!qemuCaps && capsarch && capsver) { - bool stripmachinealiases =3D false; - - if (STREQ(capsver, "latest")) { - if (VIR_STRDUP(capsfile, virHashLookup(capslatest, capsarch)) = < 0) - goto cleanup; - stripmachinealiases =3D true; - } else if (virAsprintf(&capsfile, "%s/caps_%s.%s.xml", - TEST_CAPS_PATH, capsver, capsarch) < 0) { - goto cleanup; - } - - if (!(qemuCaps =3D qemuTestParseCapabilitiesArch(virArchFromString= (capsarch), - capsfile))) { - goto cleanup; - } - - if (stripmachinealiases) - virQEMUCapsStripMachineAliases(qemuCaps); - info->flags |=3D FLAG_REAL_CAPS; - } - - if (!qemuCaps) { - fprintf(stderr, "No qemuCaps generated\n"); - goto cleanup; - } - VIR_STEAL_PTR(info->qemuCaps, qemuCaps); - - if (gic !=3D GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, gic) < 0) - goto cleanup; - - ret =3D 0; - - cleanup: - virObjectUnref(qemuCaps); - va_end(argptr); - - return ret; -} - -static void -testQemuInfoClear(struct testQemuInfo *info) -{ - VIR_FREE(info->infile); - VIR_FREE(info->outfile); - virObjectUnref(info->qemuCaps); -} - static int testInfoSetPaths(struct testQemuInfo *info, const char *suffix) { diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index dffe473944..6286c7b3c7 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -918,3 +918,147 @@ testQemuCapsIterate(const char *dirname, =20 return ret; } + + +#define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata" + +int +testQemuInfoSetArgs(struct testQemuInfo *info, + virHashTablePtr capslatest, ...) +{ + va_list argptr; + testQemuInfoArgName argname; + virQEMUCapsPtr qemuCaps =3D NULL; + int gic =3D GIC_NONE; + char *capsarch =3D NULL; + char *capsver =3D NULL; + VIR_AUTOFREE(char *) capsfile =3D NULL; + int flag; + int ret =3D -1; + + va_start(argptr, capslatest); + argname =3D va_arg(argptr, testQemuInfoArgName); + while (argname !=3D ARG_END) { + switch (argname) { + case ARG_QEMU_CAPS: + if (qemuCaps || !(qemuCaps =3D virQEMUCapsNew())) + goto cleanup; + + while ((flag =3D va_arg(argptr, int)) < QEMU_CAPS_LAST) + virQEMUCapsSet(qemuCaps, flag); + + /* Some tests are run with NONE capabilities, which is just + * another name for QEMU_CAPS_LAST. If that is the case the + * arguments look like this : + * + * ARG_QEMU_CAPS, NONE, QEMU_CAPS_LAST, ARG_END + * + * Fetch one argument more and if it is QEMU_CAPS_LAST then + * break from the switch() to force getting next argument + * in the line. If it is not QEMU_CAPS_LAST then we've + * fetched real ARG_* and we must process it. + */ + if ((flag =3D va_arg(argptr, int)) !=3D QEMU_CAPS_LAST) { + argname =3D flag; + continue; + } + + break; + + case ARG_GIC: + gic =3D va_arg(argptr, int); + break; + + case ARG_MIGRATE_FROM: + info->migrateFrom =3D va_arg(argptr, char *); + break; + + case ARG_MIGRATE_FD: + info->migrateFd =3D va_arg(argptr, int); + break; + + case ARG_FLAGS: + info->flags =3D va_arg(argptr, int); + break; + + case ARG_PARSEFLAGS: + info->parseFlags =3D va_arg(argptr, int); + break; + + case ARG_CAPS_ARCH: + capsarch =3D va_arg(argptr, char *); + break; + + case ARG_CAPS_VER: + capsver =3D va_arg(argptr, char *); + break; + + case ARG_END: + default: + fprintf(stderr, "Unexpected test info argument"); + goto cleanup; + } + + argname =3D va_arg(argptr, testQemuInfoArgName); + } + + if (!!capsarch ^ !!capsver) { + fprintf(stderr, "ARG_CAPS_ARCH and ARG_CAPS_VER " + "must be specified together.\n"); + goto cleanup; + } + + if (qemuCaps && (capsarch || capsver)) { + fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_A= RCH " + "or ARG_CAPS_VER\n"); + goto cleanup; + } + + if (!qemuCaps && capsarch && capsver) { + bool stripmachinealiases =3D false; + + if (STREQ(capsver, "latest")) { + if (VIR_STRDUP(capsfile, virHashLookup(capslatest, capsarch)) = < 0) + goto cleanup; + stripmachinealiases =3D true; + } else if (virAsprintf(&capsfile, "%s/caps_%s.%s.xml", + TEST_CAPS_PATH, capsver, capsarch) < 0) { + goto cleanup; + } + + if (!(qemuCaps =3D qemuTestParseCapabilitiesArch(virArchFromString= (capsarch), + capsfile))) { + goto cleanup; + } + + if (stripmachinealiases) + virQEMUCapsStripMachineAliases(qemuCaps); + info->flags |=3D FLAG_REAL_CAPS; + } + + if (!qemuCaps) { + fprintf(stderr, "No qemuCaps generated\n"); + goto cleanup; + } + VIR_STEAL_PTR(info->qemuCaps, qemuCaps); + + if (gic !=3D GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, gic) < 0) + goto cleanup; + + ret =3D 0; + + cleanup: + virObjectUnref(qemuCaps); + va_end(argptr); + + return ret; +} + + +void +testQemuInfoClear(struct testQemuInfo *info) +{ + VIR_FREE(info->infile); + VIR_FREE(info->outfile); + virObjectUnref(info->qemuCaps); +} diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index 183ce915f1..f6ae2a38d3 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -32,6 +32,41 @@ enum { GIC_BOTH, }; =20 + +typedef enum { + ARG_QEMU_CAPS, + ARG_GIC, + ARG_MIGRATE_FROM, + ARG_MIGRATE_FD, + ARG_FLAGS, + ARG_PARSEFLAGS, + ARG_CAPS_ARCH, + ARG_CAPS_VER, + ARG_END, +} testQemuInfoArgName; + + +typedef enum { + FLAG_EXPECT_FAILURE =3D 1 << 0, + FLAG_EXPECT_PARSE_ERROR =3D 1 << 1, + FLAG_FIPS =3D 1 << 2, + FLAG_REAL_CAPS =3D 1 << 3, + FLAG_SKIP_LEGACY_CPUS =3D 1 << 4, +} testQemuInfoFlags; + + +struct testQemuInfo { + const char *name; + char *infile; + char *outfile; + virQEMUCapsPtr qemuCaps; + const char *migrateFrom; + int migrateFd; + unsigned int flags; + unsigned int parseFlags; +}; + + virCapsPtr testQemuCapsInit(void); virDomainXMLOptionPtr testQemuXMLConfInit(void); =20 @@ -71,6 +106,10 @@ int testQemuCapsIterate(const char *dirname, testQemuCapsIterateCallback callback, void *opaque); =20 +int testQemuInfoSetArgs(struct testQemuInfo *info, + virHashTablePtr capslatest, ...); +void testQemuInfoClear(struct testQemuInfo *info); + # endif =20 #endif /* LIBVIRT_TESTUTILSQEMU_H */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137285888956.1635458479277; Mon, 1 Apr 2019 09:48:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A66D6C007340; Mon, 1 Apr 2019 16:48:03 +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 79DC460FAB; Mon, 1 Apr 2019 16:48:03 +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 299CC3F5CC; Mon, 1 Apr 2019 16:48:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GldKo026730 for ; Mon, 1 Apr 2019 12:47:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E75F5C27C; Mon, 1 Apr 2019 16:47:39 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id ACD5B5C25A; Mon, 1 Apr 2019 16:47:38 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:24 -0400 Message-Id: <2c2e42731c05ba2c59fccc483e1a079bc99b4f4b.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/12] tests: add testQemuGetCapsLatest 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 01 Apr 2019 16:48:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Move the capslatest building from qemuxml2argv to testutilsqemu Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 25 ++----------------------- tests/testutilsqemu.c | 37 +++++++++++++++++++++++++++++++++++++ tests/testutilsqemu.h | 1 + 3 files changed, 40 insertions(+), 23 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a51bdb2453..b2dda3845d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -590,15 +590,8 @@ testInfoSetPaths(struct testQemuInfo *info, const char= *suffix) static int mymain(void) { - int ret =3D 0, i; + int ret =3D 0; char *fakerootdir; - const char *archs[] =3D { - "aarch64", - "ppc64", - "riscv64", - "s390x", - "x86_64", - }; virHashTablePtr capslatest =3D NULL; =20 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { @@ -667,24 +660,10 @@ mymain(void) if (VIR_STRDUP(driver.config->nvramDir, "/var/lib/libvirt/qemu/nvram")= < 0) return EXIT_FAILURE; =20 - capslatest =3D virHashCreate(4, virHashValueFree); + capslatest =3D testQemuGetCapsLatest(); if (!capslatest) return EXIT_FAILURE; =20 - VIR_TEST_VERBOSE("\n"); - - for (i =3D 0; i < ARRAY_CARDINALITY(archs); ++i) { - char *cap =3D testQemuGetLatestCapsForArch(abs_srcdir "/qemucapabi= litiesdata", - archs[i], "xml"); - - if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0) - return EXIT_FAILURE; - - VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap); - } - - VIR_TEST_VERBOSE("\n"); - virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware", abs_srcdir "/qemufirmwaredata/etc/qemu/firmwar= e"); virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware", diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 6286c7b3c7..66464d4101 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -1062,3 +1062,40 @@ testQemuInfoClear(struct testQemuInfo *info) VIR_FREE(info->outfile); virObjectUnref(info->qemuCaps); } + + +virHashTablePtr +testQemuGetCapsLatest(void) +{ + const char *archs[] =3D { + "aarch64", + "ppc64", + "riscv64", + "s390x", + "x86_64", + }; + virHashTablePtr capslatest; + size_t i; + + if (!(capslatest =3D virHashCreate(4, virHashValueFree))) + goto error; + + VIR_TEST_VERBOSE("\n"); + + for (i =3D 0; i < ARRAY_CARDINALITY(archs); ++i) { + char *cap =3D testQemuGetLatestCapsForArch(abs_srcdir "/qemucapabi= litiesdata", + archs[i], "xml"); + + if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0) + goto error; + + VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap); + } + + VIR_TEST_VERBOSE("\n"); + return capslatest; + + error: + virHashFree(capslatest); + return NULL; +} diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index f6ae2a38d3..6d4719dc12 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -109,6 +109,7 @@ int testQemuCapsIterate(const char *dirname, int testQemuInfoSetArgs(struct testQemuInfo *info, virHashTablePtr capslatest, ...); void testQemuInfoClear(struct testQemuInfo *info); +virHashTablePtr testQemuGetCapsLatest(void); =20 # endif =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137279673498.8254687747061; Mon, 1 Apr 2019 09:47:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FA0D6697B; Mon, 1 Apr 2019 16:47:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0615828540; Mon, 1 Apr 2019 16:47:58 +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 B39D4181A000; Mon, 1 Apr 2019 16:47:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GldA5026744 for ; Mon, 1 Apr 2019 12:47:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id B33F35C27C; Mon, 1 Apr 2019 16:47:39 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49AE05C206; Mon, 1 Apr 2019 16:47:39 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:25 -0400 Message-Id: <277ec917f362a5185bb1603ff98aed3e9f54a138.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/12] tests: qemuxml2xml: Use struct testQemuInfo 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 01 Apr 2019 16:47:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The qemuxml2xml testInfo is now just a subset of testQemuInfo, so it's a drop in replacement Signed-off-by: Cole Robinson Reviewed-by: Andrea Bolognani --- tests/qemuxml2xmltest.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 538ccae8fd..ba622a3d2f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -25,18 +25,11 @@ enum { WHEN_BOTH =3D 3, }; =20 -struct testInfo { - char *infile; - char *outfile; - - virQEMUCapsPtr qemuCaps; -}; - =20 static int testXML2XMLActive(const void *opaque) { - const struct testInfo *info =3D opaque; + const struct testQemuInfo *info =3D opaque; =20 return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, info->outfile, true, 0, @@ -47,7 +40,7 @@ testXML2XMLActive(const void *opaque) static int testXML2XMLInactive(const void *opaque) { - const struct testInfo *info =3D opaque; + const struct testQemuInfo *info =3D opaque; =20 return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, info->outfile, false, = 0, @@ -58,7 +51,7 @@ testXML2XMLInactive(const void *opaque) static int testCompareStatusXMLToXMLFiles(const void *opaque) { - const struct testInfo *data =3D opaque; + const struct testQemuInfo *data =3D opaque; virDomainObjPtr obj =3D NULL; char *actual =3D NULL; int ret =3D -1; @@ -95,18 +88,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque) } =20 =20 -static void -testInfoClear(struct testInfo *info) -{ - VIR_FREE(info->infile); - VIR_FREE(info->outfile); - - virObjectUnref(info->qemuCaps); -} - - static int -testInfoSetCommon(struct testInfo *info, +testInfoSetCommon(struct testQemuInfo *info, int gic) { if (!(info->qemuCaps =3D virQEMUCapsNew())) @@ -121,12 +104,12 @@ testInfoSetCommon(struct testInfo *info, return 0; =20 error: - testInfoClear(info); + testQemuInfoClear(info); return -1; } =20 static int -testInfoSetPaths(struct testInfo *info, +testInfoSetPaths(struct testQemuInfo *info, const char *name, int when) { @@ -155,7 +138,7 @@ testInfoSetPaths(struct testInfo *info, return 0; =20 error: - testInfoClear(info); + testQemuInfoClear(info); return -1; } =20 @@ -163,7 +146,7 @@ testInfoSetPaths(struct testInfo *info, static const char *statusPath =3D abs_srcdir "/qemustatusxml2xmldata/"; =20 static int -testInfoSetStatusPaths(struct testInfo *info, +testInfoSetStatusPaths(struct testQemuInfo *info, const char *name) { if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 || @@ -173,7 +156,7 @@ testInfoSetStatusPaths(struct testInfo *info, return 0; =20 error: - testInfoClear(info); + testQemuInfoClear(info); return -1; } =20 @@ -185,7 +168,7 @@ mymain(void) { int ret =3D 0; char *fakerootdir; - struct testInfo info; + struct testQemuInfo info; virQEMUDriverConfigPtr cfg =3D NULL; =20 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { @@ -234,7 +217,7 @@ mymain(void) testXML2XMLActive, &info) < 0) \ ret =3D -1; \ } \ - testInfoClear(&info); \ + testQemuInfoClear(&info); \ } while (0) =20 # define NONE QEMU_CAPS_LAST @@ -1232,7 +1215,7 @@ mymain(void) testCompareStatusXMLToXMLFiles, &info) < 0) \ ret =3D -1; \ \ - testInfoClear(&info); \ + testQemuInfoClear(&info); \ } while (0) =20 =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137277751619.7740421221804; Mon, 1 Apr 2019 09:47:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F75431688EA; Mon, 1 Apr 2019 16:47:56 +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 01732BA56; Mon, 1 Apr 2019 16:47:56 +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 B90933FA46; Mon, 1 Apr 2019 16:47:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GleNH026749 for ; Mon, 1 Apr 2019 12:47:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4E5215C28C; Mon, 1 Apr 2019 16:47:40 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id DDDE75C206; Mon, 1 Apr 2019 16:47:39 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:26 -0400 Message-Id: <7bc2aa8526e1ceab5c756a8b52ef20493cb98afa.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/12] tests: qemuxml2xml: Use testQemuInfoSetArgs 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 01 Apr 2019 16:47:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" No functional change, just replacing the old custom infrastructure Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index ba622a3d2f..e60c69872a 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -88,26 +88,6 @@ testCompareStatusXMLToXMLFiles(const void *opaque) } =20 =20 -static int -testInfoSetCommon(struct testQemuInfo *info, - int gic) -{ - if (!(info->qemuCaps =3D virQEMUCapsNew())) - goto error; - - if (testQemuCapsSetGIC(info->qemuCaps, gic) < 0) - goto error; - - if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) - goto error; - - return 0; - - error: - testQemuInfoClear(info); - return -1; -} - static int testInfoSetPaths(struct testQemuInfo *info, const char *name, @@ -170,6 +150,11 @@ mymain(void) char *fakerootdir; struct testQemuInfo info; virQEMUDriverConfigPtr cfg =3D NULL; + virHashTablePtr capslatest =3D NULL; + + capslatest =3D testQemuGetCapsLatest(); + if (!capslatest) + abort(); =20 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { fprintf(stderr, "Out of memory\n"); @@ -192,11 +177,14 @@ mymain(void) =20 # define DO_TEST_FULL(name, when, gic, ...) \ do { \ - if (testInfoSetCommon(&info, gic) < 0) { \ + if (testQemuInfoSetArgs(&info, capslatest, \ + ARG_GIC, gic, \ + ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST= , \ + ARG_END) < 0 || \ + qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) <= 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", name);= \ return -1; \ } \ - virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ \ if (when & WHEN_INACTIVE) { \ if (testInfoSetPaths(&info, name, WHEN_INACTIVE) < 0) { \ @@ -1205,7 +1193,10 @@ mymain(void) =20 # define DO_TEST_STATUS(name) \ do { \ - if (testInfoSetCommon(&info, GIC_NONE) < 0 || \ + if (testQemuInfoSetArgs(&info, capslatest, \ + ARG_QEMU_CAPS, QEMU_CAPS_LAST, \ + ARG_END) < 0 || \ + qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) <= 0 || \ testInfoSetStatusPaths(&info, name) < 0) { \ VIR_TEST_DEBUG("Failed to generate status test data for '%s'",= name); \ return -1; \ @@ -1262,6 +1253,7 @@ mymain(void) if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); =20 + virHashFree(capslatest); qemuTestDriverFree(&driver); VIR_FREE(fakerootdir); =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137281228559.1969678849712; Mon, 1 Apr 2019 09:48:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE05B3086223; Mon, 1 Apr 2019 16:47:59 +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 95F885D71D; Mon, 1 Apr 2019 16:47:59 +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 58CEC3FA4C; Mon, 1 Apr 2019 16:47:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31GleDu026762 for ; Mon, 1 Apr 2019 12:47:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id E2F8A5C25A; Mon, 1 Apr 2019 16:47:40 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7C80B5C28C; Mon, 1 Apr 2019 16:47:40 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:27 -0400 Message-Id: <77c18aaabd25aa26c4aa2c41cca0d7ee71f562b8.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/12] tests: qemuxml2xml: make GIC handling optional 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 01 Apr 2019 16:48:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Make all users of GIC_X use ARG_GIC explicitly, and drop the required gic parameter from DO_TEST_FULL Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 85 ++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 30 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index e60c69872a..3b5314df78 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -175,11 +175,10 @@ mymain(void) =20 cfg =3D virQEMUDriverGetConfig(&driver); =20 -# define DO_TEST_FULL(name, when, gic, ...) \ +# define DO_TEST_FULL(name, when, ...) \ do { \ if (testQemuInfoSetArgs(&info, capslatest, \ - ARG_GIC, gic, \ - ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST= , \ + __VA_ARGS__, \ ARG_END) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) <= 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", name);= \ @@ -211,7 +210,7 @@ mymain(void) # define NONE QEMU_CAPS_LAST =20 # define DO_TEST(name, ...) \ - DO_TEST_FULL(name, WHEN_BOTH, GIC_NONE, __VA_ARGS__) + DO_TEST_FULL(name, WHEN_BOTH, ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LA= ST) =20 =20 =20 @@ -490,17 +489,22 @@ mymain(void) DO_TEST("blkdeviotune-max-length", NONE); DO_TEST("controller-usb-order", NONE); =20 - DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, GIC_NONE, NO= NE); - DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE, GIC_NONE, NON= E); - DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE, GIC_NONE, NO= NE); - DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE, GIC_NONE, NONE= ); + DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, + ARG_QEMU_CAPS, QEMU_CAPS_LAST); + DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE, + ARG_QEMU_CAPS, QEMU_CAPS_LAST, NONE); + DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE); DO_TEST("seclabel-static", NONE); DO_TEST("seclabel-static-labelskip", NONE); DO_TEST("seclabel-none", NONE); DO_TEST("seclabel-dac-none", NONE); DO_TEST("seclabel-dynamic-none", NONE); DO_TEST("seclabel-device-multiple", NONE); - DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, GIC_NONE,= NONE); + DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE); DO_TEST("numad-static-vcpu-no-numatune", NONE); =20 DO_TEST("disk-scsi-lun-passthrough-sgio", @@ -1048,27 +1052,48 @@ mymain(void) QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VNC); =20 - DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-default-v2", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-default-v3", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-default-both", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_BOTH, NONE); + DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-default-v2", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-default-v3", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-default-both", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); =20 DO_TEST("memory-hotplug", NONE); DO_TEST("memory-hotplug-nonuma", NONE); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon May 6 13:59:05 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1554137285454118.28799517415894; Mon, 1 Apr 2019 09:48:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 511209B303; Mon, 1 Apr 2019 16:48:04 +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 24C1A5DC1E; Mon, 1 Apr 2019 16:48:04 +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 D52673F5CD; Mon, 1 Apr 2019 16:48:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x31Glf9U026770 for ; Mon, 1 Apr 2019 12:47:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 908215C27C; Mon, 1 Apr 2019 16:47:41 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-124-128.rdu2.redhat.com [10.10.124.128]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C98D5C25A; Mon, 1 Apr 2019 16:47:41 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:28 -0400 Message-Id: <6f9a1738d7d6d824c00c08191e9ff50a2784cdb6.1554137098.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/12] tests: qemuxml2xml: Add DO_TEST_CAPS* 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 01 Apr 2019 16:48:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Add DO_TEST_CAPS* macros, lifted from qemuxml2argvtest. Use it on a few recently added xml2xml tests that use DO_TEST_CAPS in the argv test case. The firmware examples require breaking the symlink and creating our own test file. Also add a test for os-firmware-efi which seems to have been missed. One subtle difference compared to qemuxml2argv is output file naming. qemuxml2xml uses a system where if specially named files ${basename}-active.xml or ${basename}-inactive.xml exist, those are used as output, otherwise just ${basename}.xml is used. I'm not quite sure how to make this fit with the caps suffix naming scheme used in qemuxml2argv, where for example DO_CAPS_LATEST will always add a -latest suffix to basename. This code by default will store the output in ${basename}.xml with no -latest suffix. This makes it easier to convert DO_TEST calls to CAPS variants, because it won't require any test file rename/removal, but if we ever want to add more than one qemuxml2xml output for a single input, it will require special file naming to not collide. IMO that's not a big deal as it follows the existing -active pattern. But it's a divergence from qemuxml2argv behavior Signed-off-by: Cole Robinson --- tests/qemuxml2argvdata/vhost-vsock.xml | 2 +- .../aarch64-os-firmware-efi.xml | 32 +++++++- tests/qemuxml2xmloutdata/os-firmware-bios.xml | 69 +++++++++++++++- .../os-firmware-efi-secboot.xml | 69 +++++++++++++++- tests/qemuxml2xmloutdata/os-firmware-efi.xml | 69 +++++++++++++++- tests/qemuxml2xmltest.c | 81 +++++++------------ 6 files changed, 267 insertions(+), 55 deletions(-) mode change 120000 =3D> 100644 tests/qemuxml2xmloutdata/aarch64-os-firmwar= e-efi.xml mode change 120000 =3D> 100644 tests/qemuxml2xmloutdata/os-firmware-bios.x= ml mode change 120000 =3D> 100644 tests/qemuxml2xmloutdata/os-firmware-efi-se= cboot.xml mode change 120000 =3D> 100644 tests/qemuxml2xmloutdata/os-firmware-efi.xml diff --git a/tests/qemuxml2argvdata/vhost-vsock.xml b/tests/qemuxml2argvdat= a/vhost-vsock.xml index bc550ace4e..f594c53f48 100644 --- a/tests/qemuxml2argvdata/vhost-vsock.xml +++ b/tests/qemuxml2argvdata/vhost-vsock.xml @@ -15,7 +15,7 @@ restart /usr/bin/qemu-system-x86_64 - +
diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml b/tests/q= emuxml2xmloutdata/aarch64-os-firmware-efi.xml deleted file mode 120000 index beea6b2955..0000000000 --- a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/aarch64-os-firmware-efi.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml b/tests/q= emuxml2xmloutdata/aarch64-os-firmware-efi.xml new file mode 100644 index 0000000000..529ce6f3c2 --- /dev/null +++ b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml @@ -0,0 +1,31 @@ + + aarch64test + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1048576 + 1 + + hvm + /aarch64.kernel + /aarch64.initrd + earlyprintk console=3DttyAMA0,115200n8 rw root=3D/dev/vda roo= twait + /aarch64.dtb + + + + + + + + + cortex-a53 + + + destroy + restart + restart + + /usr/bin/qemu-system-aarch64 + + + diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.xml b/tests/qemuxml2= xmloutdata/os-firmware-bios.xml deleted file mode 120000 index 3d36d5df68..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-bios.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-bios.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.xml b/tests/qemuxml2= xmloutdata/os-firmware-bios.xml new file mode 100644 index 0000000000..63886666dd --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-bios.xml @@ -0,0 +1,68 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + /var/lib/libvirt/qemu/nvram/fedora_VARS.fd + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml b/tests/q= emuxml2xmloutdata/os-firmware-efi-secboot.xml deleted file mode 120000 index 93e184e2d2..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-efi-secboot.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml b/tests/q= emuxml2xmloutdata/os-firmware-efi-secboot.xml new file mode 100644 index 0000000000..a285e06334 --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml @@ -0,0 +1,68 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + /var/lib/libvirt/qemu/nvram/fedora_VARS.fd + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.xml b/tests/qemuxml2x= mloutdata/os-firmware-efi.xml deleted file mode 120000 index 15cfad1ea0..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-efi.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-efi.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.xml b/tests/qemuxml2x= mloutdata/os-firmware-efi.xml new file mode 100644 index 0000000000..46a7b1b780 --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-efi.xml @@ -0,0 +1,68 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + /var/lib/libvirt/qemu/nvram/fedora_VARS.fd + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 3b5314df78..6ae3cbb11f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -91,7 +91,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque) static int testInfoSetPaths(struct testQemuInfo *info, const char *name, - int when) + int when, + const char *suffix) { VIR_FREE(info->infile); VIR_FREE(info->outfile); @@ -101,9 +102,10 @@ testInfoSetPaths(struct testQemuInfo *info, goto error; =20 if (virAsprintf(&info->outfile, - "%s/qemuxml2xmloutdata/%s-%s.xml", + "%s/qemuxml2xmloutdata/%s-%s%s.xml", abs_srcdir, name, - when =3D=3D WHEN_ACTIVE ? "active" : "inactive") < 0) + when =3D=3D WHEN_ACTIVE ? "active" : "inactive", + suffix) < 0) goto error; =20 if (!virFileExists(info->outfile)) { @@ -175,7 +177,7 @@ mymain(void) =20 cfg =3D virQEMUDriverGetConfig(&driver); =20 -# define DO_TEST_FULL(name, when, ...) \ +# define DO_TEST_INTERNAL(name, suffix, when, ...) \ do { \ if (testQemuInfoSetArgs(&info, capslatest, \ __VA_ARGS__, \ @@ -186,7 +188,7 @@ mymain(void) } \ \ if (when & WHEN_INACTIVE) { \ - if (testInfoSetPaths(&info, name, WHEN_INACTIVE) < 0) { \ + if (testInfoSetPaths(&info, name, WHEN_INACTIVE, suffix) < 0) = { \ VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'= ", name); \ return -1; \ } \ @@ -196,7 +198,7 @@ mymain(void) } \ \ if (when & WHEN_ACTIVE) { \ - if (testInfoSetPaths(&info, name, WHEN_ACTIVE) < 0) { \ + if (testInfoSetPaths(&info, name, WHEN_ACTIVE, suffix) < 0) { \ VIR_TEST_DEBUG("Failed to generate active paths for '%s'",= name); \ return -1; \ } \ @@ -209,9 +211,26 @@ mymain(void) =20 # define NONE QEMU_CAPS_LAST =20 +# define DO_TEST_FULL(name, when, ...) \ + DO_TEST_INTERNAL(name, "", when, __VA_ARGS__) + # define DO_TEST(name, ...) \ DO_TEST_FULL(name, WHEN_BOTH, ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LA= ST) =20 +# define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \ + DO_TEST_INTERNAL(name, "." arch "-" ver, WHEN_BOTH, \ + ARG_CAPS_ARCH, arch, \ + ARG_CAPS_VER, ver, \ + __VA_ARGS__) + +# define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ + DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) + +# define DO_TEST_CAPS_ARCH_LATEST(name, arch) \ + DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END) + +# define DO_TEST_CAPS_LATEST(name) \ + DO_TEST_CAPS_ARCH_LATEST(name, "x86_64") =20 =20 /* Unset or set all envvars here that are copied in qemudBuildCommandL= ine @@ -979,36 +998,14 @@ mymain(void) DO_TEST("smbios", NONE); DO_TEST("smbios-multiple-type2", NONE); =20 - DO_TEST("os-firmware-bios", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); - DO_TEST("os-firmware-efi", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); - DO_TEST("os-firmware-efi-secboot", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); + DO_TEST_CAPS_LATEST("os-firmware-bios"); + DO_TEST_CAPS_LATEST("os-firmware-efi"); + DO_TEST_CAPS_LATEST("os-firmware-efi-secboot"); =20 DO_TEST("aarch64-aavmf-virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST("aarch64-os-firmware-efi", - QEMU_CAPS_DEVICE_VIRTIO_MMIO); + DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64"); DO_TEST("aarch64-virtio-pci-default", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, QEMU_CAPS_DEVICE_VIRTIO_MMIO, @@ -1256,24 +1253,8 @@ mymain(void) DO_TEST("riscv64-virt-pci", QEMU_CAPS_OBJECT_GPEX); =20 - DO_TEST("virtio-transitional", - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, - QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - QEMU_CAPS_DEVICE_VHOST_VSOCK, - QEMU_CAPS_VIRTIO_INPUT_HOST, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST("virtio-non-transitional", - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, - QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - QEMU_CAPS_DEVICE_VHOST_VSOCK, - QEMU_CAPS_VIRTIO_INPUT_HOST, - QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_CAPS_LATEST("virtio-transitional"); + DO_TEST_CAPS_LATEST("virtio-non-transitional"); =20 if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list