From nobody Mon Feb 9 02:14:23 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 1547421224355643.329757244962; Sun, 13 Jan 2019 15:13:44 -0800 (PST) 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 4020F356D5; Sun, 13 Jan 2019 23:13:42 +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 08C328378B; Sun, 13 Jan 2019 23:13:42 +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 AF4E418436BF; Sun, 13 Jan 2019 23:13:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0DND9U5028614 for ; Sun, 13 Jan 2019 18:13:09 -0500 Received: by smtp.corp.redhat.com (Postfix) id E4AB617A9F; Sun, 13 Jan 2019 23:13:09 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-120-202.rdu2.redhat.com [10.10.120.202]) by smtp.corp.redhat.com (Postfix) with ESMTP id 49904608DC; Sun, 13 Jan 2019 23:13:09 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Sun, 13 Jan 2019 18:12:04 -0500 Message-Id: <0cfd161706183af03ce62bd43b8c4ed062661031.1547420060.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/6] tests: qemuxml2xml: Add basic DO_TEST_CAPS impl 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.30]); Sun, 13 Jan 2019 23:13:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 57 ++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 82e2c0ee0f..b686a585e8 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -117,10 +117,10 @@ testInfoClear(struct testInfo *info) =20 static int testInfoSetCommon(struct testInfo *info, - int gic) + int gic, + virQEMUCapsPtr qemuCaps) { - if (!(info->qemuCaps =3D virQEMUCapsNew())) - goto error; + info->qemuCaps =3D qemuCaps; =20 if (testQemuCapsSetGIC(info->qemuCaps, gic) < 0) goto error; @@ -140,9 +140,10 @@ static int testInfoSet(struct testInfo *info, const char *name, int when, - int gic) + int gic, + virQEMUCapsPtr qemuCaps) { - if (testInfoSetCommon(info, gic) < 0) + if (testInfoSetCommon(info, gic, qemuCaps) < 0) return -1; =20 if (virAsprintf(&info->inName, "%s/qemuxml2argvdata/%s.xml", @@ -194,9 +195,10 @@ static const char *statusPath =3D abs_srcdir "/qemusta= tusxml2xmldata/"; static int testInfoSetStatus(struct testInfo *info, const char *name, - int gic) + int gic, + virQEMUCapsPtr qemuCaps) { - if (testInfoSetCommon(info, gic) < 0) + if (testInfoSetCommon(info, gic, qemuCaps) < 0) return -1; =20 if (virAsprintf(&info->inName, "%s%s-in.xml", statusPath, name) < 0 || @@ -220,6 +222,7 @@ mymain(void) char *fakerootdir; struct testInfo info; virQEMUDriverConfigPtr cfg =3D NULL; + virQEMUCapsPtr qemuCaps =3D NULL; =20 if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { fprintf(stderr, "Out of memory\n"); @@ -240,14 +243,8 @@ mymain(void) =20 cfg =3D virQEMUDriverGetConfig(&driver); =20 -# define DO_TEST_FULL(name, when, gic, ...) \ +# define DO_TEST_RUN(name, info) \ do { \ - if (testInfoSet(&info, name, when, 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 (virTestRun("QEMU XML-2-XML-inactive " name, \ testXML2XMLInactive, &info) < 0) \ @@ -262,6 +259,34 @@ mymain(void) testInfoClear(&info); \ } while (0) =20 +# define DO_TEST_FULL(name, when, gic, ...) \ + do { \ + if (!(qemuCaps =3D virQEMUCapsNew())) \ + return -1; \ + if (testInfoSet(&info, name, when, gic, qemuCaps) < 0) { \ + VIR_TEST_DEBUG("Failed to generate test data for '%s'", name);= \ + return -1; \ + } \ + virQEMUCapsSetList(info.qemuCaps, __VA_ARGS__, QEMU_CAPS_LAST); \ + DO_TEST_RUN(name, info); \ + } while (0) + +# define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata/caps_" + +# define DO_TEST_CAPS(name, arch, ver) \ + do { \ + if (!(qemuCaps =3D qemuTestParseCapabilitiesArch(virArchFromString= (arch), \ + TEST_CAPS_PATH ver = "." arch ".xml"))) { \ + printf("bad\n"); \ + return -1; \ + } \ + if (testInfoSet(&info, name, WHEN_BOTH, GIC_NONE, qemuCaps) < 0) {= \ + VIR_TEST_DEBUG("Failed to generate test data for '%s'", name);= \ + return -1; \ + } \ + DO_TEST_RUN(name, info); \ + } while (0) + # define NONE QEMU_CAPS_LAST =20 # define DO_TEST(name, ...) \ @@ -1233,7 +1258,9 @@ mymain(void) =20 # define DO_TEST_STATUS(name) \ do { \ - if (testInfoSetStatus(&info, name, GIC_NONE) < 0) { \ + if (!(qemuCaps =3D virQEMUCapsNew())) \ + return -1; \ + if (testInfoSetStatus(&info, name, GIC_NONE, qemuCaps) < 0) { \ VIR_TEST_DEBUG("Failed to generate status test data for '%s'",= name); \ return -1; \ } \ --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list