From nobody Sun Feb 8 22:07:50 2026 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