From patchwork Mon Apr 1 16:47:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161548 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687814jan; Mon, 1 Apr 2019 09:47:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbEkH3qdDdz6S2E/B4DKx0n8ZoXcoVN5/pUcXsqTdoLShk1DpNbQifyORWq6y7TBTjhs2c X-Received: by 2002:a0c:f68a:: with SMTP id p10mr51098879qvn.126.1554137273865; Mon, 01 Apr 2019 09:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137273; cv=none; d=google.com; s=arc-20160816; b=UbU4oTR5vkdq+HUtwlMluTJzoZGI4oqy9fQfp7N0dRWxH4tqeCPwtkBzHfFc2wj9L6 dgXhcEFembw5BXEG2GOECMSJp6fyNxGRYO8tQr9rQtqDBttEsk5oN2iqbAswRKeujm/V O7IM483tkVRJA/gp/ZSfrPpOMkVK5I3gRVKlN2jDTBXZGO/BmJdhJL53OOCwBFvhJn6g Pd0oi+KOMeFDTmc1fMPMez3BXnysv6NZey52xhayYS8S7h3/4ekXWZlxysHFUulwq11u x1BphmwYFQ09OnUYeAyBt3XmPuEh8VCGrix9GuPsgrnyvhR0DNPyH6RySG6gOiD7VUQ/ xcjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=EsvPvTXTGtcVYVONEuZVolcyT/X1Hel3Hy3k98g7f98=; b=dKowDATkDAuopg4G/8AwLe+R3XXMp6KZJdVg6qbbeQ8Xbnk/oPsMd3IWVe/KEDwU83 mqXHdiLlr5baJk2iQ8YmT591TmPtk1aYeQNMNXntB/YCw4mX/2sD4IYbPCTuqVLkMvRT xr7ikVSnh+RMgcojBTIFem8F8Y4sKcoC45CZECy5Tgx9Yo4tGN2VK+NhljKvTOfE1kmz atRFbNBkvqAvEWRY9oiEN5fAhL2ZaXwTZDsxplj2tl7WRLTmpxeraG9AIxu5Nunq/X1N sZR4ZM938+LHkX3bCQurxGyedl43qupw6YAAM0j4majqGybnlS2h0jTFW+3dHIKTwfqF XiiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id a23si1683818qth.45.2019.04.01.09.47.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:53 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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) Delivered-To: libvirt-list@redhat.com 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: , 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) 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(-) -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list 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; virQEMUCapsPtr qemuCaps; }; @@ -40,8 +39,7 @@ testXML2XMLActive(const void *opaque) const struct testInfo *info = opaque; return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, - info->infile, info->outfile, true, - 0, + info->infile, info->outfile, true, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); } @@ -51,9 +49,8 @@ testXML2XMLInactive(const void *opaque) { const struct testInfo *info = opaque; - return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, - info->outInactiveName, false, - 0, + return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, + info->infile, info->outfile, false, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); } @@ -103,7 +100,6 @@ testInfoClear(struct testInfo *info) { VIR_FREE(info->infile); VIR_FREE(info->outfile); - VIR_FREE(info->outInactiveName); 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; - 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 == WHEN_ACTIVE ? "active" : "inactive") < 0) + goto error; - if (virAsprintf(&info->outInactiveName, - "%s/qemuxml2xmloutdata/%s.xml", - abs_srcdir, name) < 0) - goto error; - } - } + if (!virFileExists(info->outfile)) { + VIR_FREE(info->outfile); - 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; - } } return 0; @@ -227,20 +209,27 @@ mymain(void) # 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 = -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 = -1; \