From patchwork Mon Apr 15 23:09:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 162285 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3508156jan; Mon, 15 Apr 2019 16:09:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4hJtaiUoaMPUmo08GOeCkny9v0CqBzY4QlgPvctJLROXn2FZZfXmEthPyP2qv1czr5CYz X-Received: by 2002:a37:9bd4:: with SMTP id d203mr59548567qke.58.1555369775170; Mon, 15 Apr 2019 16:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555369775; cv=none; d=google.com; s=arc-20160816; b=xnA1BRrcqWpYUejUBSprysnnhwJRfnqqLnBFwqiNXBrE3unbL7h3Pd4UKdWzU5tvnz CpcrMDJ/2+ebgohr9nkw+LYfoDnG9hDbmbKaSHCE+RtwCt0o3epYgX4H1TyMuR0rorrR zAAXZxv2gVXS8O8I/tLMYxFteUzmb1ph0bE9zC2eO9wDxwmCAufL9Ox6PUrrf2Z5jfNa lIngpOmdnmX1yH3RiPmMwr9YRXq6PtqA6Eovj8W9u2/AdZggbR7fhdj0MwlZCIZ6p0Xh C7Nthqv76s8LdzKRbVlc/j7FxSSpHJuBMXrqjH6Oxa8NmbOaJzazfQTRz6A/Ud5WsieD 5jSQ== 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 :cc:mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=RfYp1gNJVYFEiFMeVdu6Qs7gNdNdk0e4U/H5RQb6riE=; b=iyVC4M8f3MPdXfJE4/WJYJH82kfvC5bIrdO7Sahh52GNSebhZCe9Ect0iOFjckcvpr WPkM0L7nS2nsP43rAiVmwZdq4IyLZz/gW6SzWBNt2Gi9UXcy59a6itvg03KYbsgbH0Wi k8cLHrYWkZ5v0FibDHoO3hjXIqtrkNGzPKCBgRaK9VCx+svosSA9oUt2Ge8mPWBqhQZE P+Qr5mjEuZLnin7UEI4BtQ30gIrKyt5wVVZKWPs/llRfoZICKJ5NW/owZzOoo/JUoyCz akZbNumvIaq7uEMM5G2gG1DRwlJF0qdlOjzQU2jiwwktBXI3QVOf//suPwr4Jhz7YsPi 1EOQ== 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 d44si4583864qvd.22.2019.04.15.16.09.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 16:09:35 -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-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC6A2882F2; Mon, 15 Apr 2019 23:09:33 +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 7879C1001E7C; Mon, 15 Apr 2019 23:09:32 +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 61BC341F3E; Mon, 15 Apr 2019 23:09:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3FN9R7x019605 for ; Mon, 15 Apr 2019 19:09:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 683AC60C5F; Mon, 15 Apr 2019 23:09:27 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-124-108.rdu2.redhat.com [10.10.124.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id D459C60C05; Mon, 15 Apr 2019 23:09:26 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 15 Apr 2019 19:09:15 -0400 Message-Id: <3abd123ee44624f2a2da812b0764aae0d06b0906.1555369583.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: =?utf-8?q?J=C3=A1n_Tomko?= , Andrea Bolognani Subject: [libvirt] [PATCH v2 1/6] tests: qemuxml2xml: Set name in 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 15 Apr 2019 23:09:34 +0000 (UTC) Use the same pattern that is used in qemuxml2argvtest, setting the name in a static testQemuInfo instance inside the test macros Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 47 +++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-) -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 8a7a56f764..59c0c2c483 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -90,19 +90,18 @@ testCompareStatusXMLToXMLFiles(const void *opaque) static int testInfoSetPaths(struct testQemuInfo *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) + abs_srcdir, info->name) < 0) goto error; if (virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s-%s.xml", - abs_srcdir, name, + abs_srcdir, info->name, when == WHEN_ACTIVE ? "active" : "inactive") < 0) goto error; @@ -111,7 +110,7 @@ testInfoSetPaths(struct testQemuInfo *info, if (virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s.xml", - abs_srcdir, name) < 0) + abs_srcdir, info->name) < 0) goto error; } @@ -126,11 +125,10 @@ testInfoSetPaths(struct testQemuInfo *info, static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/"; static int -testInfoSetStatusPaths(struct testQemuInfo *info, - const char *name) +testInfoSetStatusPaths(struct testQemuInfo *info) { - if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 || - virAsprintf(&info->outfile, "%s%s-out.xml", statusPath, name) < 0) + if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, info->name) < 0 || + virAsprintf(&info->outfile, "%s%s-out.xml", statusPath, info->name) < 0) goto error; return 0; @@ -148,7 +146,6 @@ mymain(void) { int ret = 0; char *fakerootdir; - struct testQemuInfo info; virQEMUDriverConfigPtr cfg = NULL; virHashTablePtr capslatest = NULL; @@ -168,39 +165,40 @@ mymain(void) setenv("LIBVIRT_FAKE_ROOT_DIR", fakerootdir, 1); - memset(&info, 0, sizeof(info)); - if (qemuTestDriverInit(&driver) < 0) return EXIT_FAILURE; cfg = virQEMUDriverGetConfig(&driver); -# define DO_TEST_FULL(name, when, ...) \ +# define DO_TEST_FULL(_name, when, ...) \ do { \ + static struct testQemuInfo info = { \ + .name = _name, \ + }; \ if (testQemuInfoSetArgs(&info, capslatest, \ __VA_ARGS__, \ ARG_END) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ - VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \ + VIR_TEST_DEBUG("Failed to generate test data for '%s'", _name); \ return -1; \ } \ \ if (when & WHEN_INACTIVE) { \ - if (testInfoSetPaths(&info, name, WHEN_INACTIVE) < 0) { \ - VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", name); \ + if (testInfoSetPaths(&info, WHEN_INACTIVE) < 0) { \ + VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", _name); \ return -1; \ } \ - if (virTestRun("QEMU XML-2-XML-inactive " name, \ + if (virTestRun("QEMU XML-2-XML-inactive " _name, \ testXML2XMLInactive, &info) < 0) \ ret = -1; \ } \ \ if (when & WHEN_ACTIVE) { \ - if (testInfoSetPaths(&info, name, WHEN_ACTIVE) < 0) { \ - VIR_TEST_DEBUG("Failed to generate active paths for '%s'", name); \ + if (testInfoSetPaths(&info, WHEN_ACTIVE) < 0) { \ + VIR_TEST_DEBUG("Failed to generate active paths for '%s'", _name); \ return -1; \ } \ - if (virTestRun("QEMU XML-2-XML-active " name, \ + if (virTestRun("QEMU XML-2-XML-active " _name, \ testXML2XMLActive, &info) < 0) \ ret = -1; \ } \ @@ -1253,18 +1251,21 @@ mymain(void) QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_MCH_EXTENDED_TSEG_MBYTES); -# define DO_TEST_STATUS(name) \ +# define DO_TEST_STATUS(_name) \ do { \ + static struct testQemuInfo info = { \ + .name = _name, \ + }; \ 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); \ + testInfoSetStatusPaths(&info) < 0) { \ + VIR_TEST_DEBUG("Failed to generate status test data for '%s'", _name); \ return -1; \ } \ \ - if (virTestRun("QEMU status XML-2-XML " name, \ + if (virTestRun("QEMU status XML-2-XML " _name, \ testCompareStatusXMLToXMLFiles, &info) < 0) \ ret = -1; \ \