From patchwork Mon Apr 1 16:47:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161550 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687876jan; Mon, 1 Apr 2019 09:47:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwh6mwgLS8Omv2AK8p+KP2NlJxPH+0Es2nq5/pqki9a5CoR4EQun4AMsfryrV9c8aA4LgjX X-Received: by 2002:ae9:e8c7:: with SMTP id a190mr50582624qkg.311.1554137277881; Mon, 01 Apr 2019 09:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137277; cv=none; d=google.com; s=arc-20160816; b=WOngBlCuLHXAU2gy61utc0zYmBHdx4qWr5IN5S6Kb7TeCgZ6i2nivULsFHTZQkybzM i7TwAY/RMJQ/I/biGCamKHoISK5RiC5A0BOvM7qWupV2BUqyZnRA/UWjJj4tJpNqUCbW cw4F5O2woL/cfRnktr2am1bvIpNVrPUEh4BouW2P5dTcQc+6Eoz9I6m3hzTsTHeZo46K gwZINzdkGUZkU97wkwFLgUSK2qr4ZYwOQhNCPn/38CJQLkyPuUubROWIxl+sU3wMbAiK CtSSsjNhIhDS2SHBHeMH/W8zuMhDQxoarjoRU+cMT4XGTpv+X7F+a94z1GrxPWkE4u0a MOOg== 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=5CKU7ulISNhOtaI7Ad2vqP4mgEb00B3KIBu+IqWfFm4=; b=v55X89mtAItQgD+GOZVNvQJChI94KWO+cgDBKpTqNg7yp2bx49MtMCXYxfLHUY/Hbi xTrw/0hllNgiZpwwokNCMk27/UilBehMYynqtcz6Yw48eiL/qXp9l7aiHFXHHLfucxc9 dmkJWqmtpsKvUPZdoUEpDf8bJmq5eVuAe3ErC45pY3pwY7zU+Q4TincoswWwvUs9H3jb 0+BFL/hY+KO0Z9e//BB8LavhiR8ZvR09R6MGPQKcoY2Jraol498TfpypWPXKLMGZGC/3 enqFinQACkF8LLgqNGu5TIn7cLQBSrkt/WqLG5vCdVzcVwQz+gqJLO0ZMz9m5F0C5EZO eHJA== 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 y6si69457qkf.93.2019.04.01.09.47.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:57 -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-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) 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 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: , 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) 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(-) -- 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 ba622a3d2f..e60c69872a 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -88,26 +88,6 @@ testCompareStatusXMLToXMLFiles(const void *opaque) } -static int -testInfoSetCommon(struct testQemuInfo *info, - int gic) -{ - if (!(info->qemuCaps = 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 = NULL; + virHashTablePtr capslatest = NULL; + + capslatest = testQemuGetCapsLatest(); + if (!capslatest) + abort(); if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { fprintf(stderr, "Out of memory\n"); @@ -192,11 +177,14 @@ mymain(void) # 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) # 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") == NULL) virFileDeleteTree(fakerootdir); + virHashFree(capslatest); qemuTestDriverFree(&driver); VIR_FREE(fakerootdir);