From patchwork Mon Apr 1 16:47:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161554 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687999jan; Mon, 1 Apr 2019 09:48:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqxrWdAPQOe6fGiZsY9F2NF68NZ5Y9GTMbh6wwjRmvpyqKWCNfydlG3BUd0DQ/sGkryQ2JgM X-Received: by 2002:ac8:2850:: with SMTP id 16mr54630826qtr.84.1554137285133; Mon, 01 Apr 2019 09:48:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137285; cv=none; d=google.com; s=arc-20160816; b=aOJQ7rJf4B/ULr5pzWS2CLG8SZB0TItjb+J90sG3Dmkrnf8O2Ov/Lg2cGDRoNQdgtk pLQZL3c454qbD5kAWmeIyKDRdSiwBBW2NvPLLUs9yNnBV0Zy6RLk3qgYccbTEgMZAYo0 VJyjhplnjxXjnmQ/lV5RY6hwI6LH6MMxD0Dnh+FaZ9DPNM/nT7vTtuI+lVM5AFbR71mm 31yRQcwaWP+ivBu3LE1AUtXDCTjrVE4u0BrwImvua8J4Tulgd2Yq/x7X0YI3jBS1G/qw U3nL9siaKs2jIHjB08MgVfxlHFR0sZu7W8S8q8N9pg6FeNMvtJ+FswLip1/hdOcN5geR Aihg== 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=a2KSIoDOLbC+1zMsmd316Ca/7+xUailQh0NG8jkHURo=; b=jJkRLEC8cAjFYyikSWBzs0fGq1ybP7eqZchGGGXMWRiMVyQOTzyHnQt7t4VvduLexz QjC8uG+iAQTANZ3hMjWp15a3GkOeWCQFFxom0TTCqn7pQqN2EK6DujgbnMwzPnM0atKM kmNDiRwueSL638c2LKE7Q53vnU2Cec6IvgWcrVuBjYLRgElSvmgIZwrQe843cUJ/6uMH FJEt24GFm+quX3QgyyxdCguoOt9tpzMd57h6wOBCug34VIoHTXImOf75DNxwemxK/cBo 7eYR/L/BPK6/zu6fwt6WOd8T5pf+QpzHPQlhQxxHGI2bf2AlcipGVrOcS/pJBiA0zL6J +oyg== 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 201si446474qkj.70.2019.04.01.09.48.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:48:05 -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 A66D6C007340; Mon, 1 Apr 2019 16:48:03 +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 79DC460FAB; Mon, 1 Apr 2019 16:48:03 +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 299CC3F5CC; Mon, 1 Apr 2019 16:48:03 +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 x31GldKo026730 for ; Mon, 1 Apr 2019 12:47:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E75F5C27C; Mon, 1 Apr 2019 16:47:39 +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 ACD5B5C25A; Mon, 1 Apr 2019 16:47:38 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:24 -0400 Message-Id: <2c2e42731c05ba2c59fccc483e1a079bc99b4f4b.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 08/12] tests: add testQemuGetCapsLatest 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.32]); Mon, 01 Apr 2019 16:48:04 +0000 (UTC) Move the capslatest building from qemuxml2argv to testutilsqemu Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 25 ++----------------------- tests/testutilsqemu.c | 37 +++++++++++++++++++++++++++++++++++++ tests/testutilsqemu.h | 1 + 3 files changed, 40 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/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index a51bdb2453..b2dda3845d 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -590,15 +590,8 @@ testInfoSetPaths(struct testQemuInfo *info, const char *suffix) static int mymain(void) { - int ret = 0, i; + int ret = 0; char *fakerootdir; - const char *archs[] = { - "aarch64", - "ppc64", - "riscv64", - "s390x", - "x86_64", - }; virHashTablePtr capslatest = NULL; if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { @@ -667,24 +660,10 @@ mymain(void) if (VIR_STRDUP(driver.config->nvramDir, "/var/lib/libvirt/qemu/nvram") < 0) return EXIT_FAILURE; - capslatest = virHashCreate(4, virHashValueFree); + capslatest = testQemuGetCapsLatest(); if (!capslatest) return EXIT_FAILURE; - VIR_TEST_VERBOSE("\n"); - - for (i = 0; i < ARRAY_CARDINALITY(archs); ++i) { - char *cap = testQemuGetLatestCapsForArch(abs_srcdir "/qemucapabilitiesdata", - archs[i], "xml"); - - if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0) - return EXIT_FAILURE; - - VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap); - } - - VIR_TEST_VERBOSE("\n"); - virFileWrapperAddPrefix(SYSCONFDIR "/qemu/firmware", abs_srcdir "/qemufirmwaredata/etc/qemu/firmware"); virFileWrapperAddPrefix(PREFIX "/share/qemu/firmware", diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 6286c7b3c7..66464d4101 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -1062,3 +1062,40 @@ testQemuInfoClear(struct testQemuInfo *info) VIR_FREE(info->outfile); virObjectUnref(info->qemuCaps); } + + +virHashTablePtr +testQemuGetCapsLatest(void) +{ + const char *archs[] = { + "aarch64", + "ppc64", + "riscv64", + "s390x", + "x86_64", + }; + virHashTablePtr capslatest; + size_t i; + + if (!(capslatest = virHashCreate(4, virHashValueFree))) + goto error; + + VIR_TEST_VERBOSE("\n"); + + for (i = 0; i < ARRAY_CARDINALITY(archs); ++i) { + char *cap = testQemuGetLatestCapsForArch(abs_srcdir "/qemucapabilitiesdata", + archs[i], "xml"); + + if (!cap || virHashAddEntry(capslatest, archs[i], cap) < 0) + goto error; + + VIR_TEST_VERBOSE("latest caps for %s: %s\n", archs[i], cap); + } + + VIR_TEST_VERBOSE("\n"); + return capslatest; + + error: + virHashFree(capslatest); + return NULL; +} diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index f6ae2a38d3..6d4719dc12 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -109,6 +109,7 @@ int testQemuCapsIterate(const char *dirname, int testQemuInfoSetArgs(struct testQemuInfo *info, virHashTablePtr capslatest, ...); void testQemuInfoClear(struct testQemuInfo *info); +virHashTablePtr testQemuGetCapsLatest(void); # endif