From patchwork Thu Mar 14 14:44:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 160350 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp15595251jad; Thu, 14 Mar 2019 07:44:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqypLAXyvDxFYEWN4x5Ly9LZZBFQqh6cZU3pHhcSOOoXjiZiLWLL3cFhcEyBRKIgtrO8sXLa X-Received: by 2002:a05:620a:1245:: with SMTP id a5mr16565574qkl.340.1552574694502; Thu, 14 Mar 2019 07:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552574694; cv=none; d=google.com; s=arc-20160816; b=aRb9hNO8rYHevqZSh2PmpWkrEpc3r3EFLQrz/XyVQNXZRwqALE0Bh6hiQ4Gi3/doUD gcOFflUd9n+75v4rzbvJrtFl8Wy2+1Ud6H1kP7P9jXfAQRj17eTA9fev3wFF2kUNfbOE 6ZxhmvVYFVOzT+9OK1Uc/aGJQ2LUWbhO7hJq0nBVtL485UQHh2swalSBCQN9bb2Xyw6m /d0gST9whwQM82tUKHBG/6GIYbmfe8Sw5/Wwi7apLoAJm6tDvMQYvwVZjWTZT3dTx13X OOWWoIuMoUzTo1PXuo5tIyPeKQ3STSAiramWbG3GmZ+ujF33b7ULwTGgBaGN6VgzZu7m atWQ== 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=CerImO44L9AIhKloj6UISPTZOckhDpHO0p8v02W28Q0=; b=T66r6ouwrPNvRFsN14KwOvwCEy4eEvQR3ImVwyGPyJK8FOrTHLcbvSgQRLwuk231bA 1U1xfHuoeGbfiMdaRXHLTzoOJgZyIfeNCytnwzWw6h3joHUjEv+MkymH2KcjeJD7MWE+ tyELCn8in/qKAXz9LUq7YK+FtvqG9sXC6UqXkHNw0bzrp3DFGCj3KwC+L77Wt5gVL28w 2R1Upwq1Gtx4LHnKxR0Kpb+cUHZTZHz7tXnuTfTX3VDbmYzx9seDPIaZWeBF72Iglaza RQuLFUr8PGdYHfNntyRSBEYkgrdcMbXE6GLooK++VGZbX+STmkCfsTa3CI4+gN4ztoGM S9YA== 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 p123si1042749qkc.60.2019.03.14.07.44.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2019 07:44:54 -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 269BEC08E293; Thu, 14 Mar 2019 14:44:53 +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 F21805C241; Thu, 14 Mar 2019 14:44: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 AC008181A137; Thu, 14 Mar 2019 14:44:52 +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 x2EEimKX024659 for ; Thu, 14 Mar 2019 10:44:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7E55160FDB; Thu, 14 Mar 2019 14:44:48 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-124-177.rdu2.redhat.com [10.10.124.177]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4661060F89; Thu, 14 Mar 2019 14:44:46 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Thu, 14 Mar 2019 10:44:10 -0400 Message-Id: <3ff1cdf384d4f47a84ff76a894374d618c83732a.1552574299.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 Subject: [libvirt] [PATCH 17/21] tests: qemuxml2argv: build capsfile in DO_TEST_CAPS_INTERNAL 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.31]); Thu, 14 Mar 2019 14:44:53 +0000 (UTC) Rather than make callers do it. The operative info is just arch and ver which we are passing in already. Fold in stripmachinealiases too since it is just dependent on ver value Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list Reviewed-by: Andrea Bolognani diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4b34bbcb63..496e33f4e5 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -786,13 +786,20 @@ mymain(void) * the test cases should be forked using DO_TEST_CAPS_VER with the appropriate * version. */ -# define DO_TEST_CAPS_INTERNAL(_name, arch, ver, \ - capsfile, stripmachinealiases, ...) \ +# define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata/caps_" + +# define DO_TEST_CAPS_INTERNAL(_name, arch, ver, ...) \ do { \ static struct testInfo info = { \ .name = _name, \ .suffix = "." arch "-" ver, \ }; \ + static const char *capsfile = TEST_CAPS_PATH ver "." arch ".xml"; \ + static bool stripmachinealiases; \ + if (STREQ(ver, "latest")) { \ + capsfile = virHashLookup(capslatest, arch); \ + stripmachinealiases = true; \ + } \ if (!(info.qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(arch), \ capsfile))) \ return EXIT_FAILURE; \ @@ -807,23 +814,15 @@ mymain(void) virObjectUnref(info.qemuCaps); \ } while (0) -# define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata/caps_" - -# define DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ...) \ - DO_TEST_CAPS_INTERNAL(name, arch, ver, \ - TEST_CAPS_PATH ver "." arch ".xml", false, \ - __VA_ARGS__) # define DO_TEST_CAPS_ARCH_VER(name, arch, ver) \ - DO_TEST_CAPS_ARCH_VER_FULL(name, arch, ver, ARG_END) + DO_TEST_CAPS_INTERNAL(name, arch, ver, ARG_END) # define DO_TEST_CAPS_VER(name, ver) \ DO_TEST_CAPS_ARCH_VER(name, "x86_64", ver) # define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ - DO_TEST_CAPS_INTERNAL(name, arch, "latest", \ - virHashLookup(capslatest, arch), true, \ - __VA_ARGS__) + DO_TEST_CAPS_INTERNAL(name, arch, "latest", __VA_ARGS__) # define DO_TEST_CAPS_ARCH_LATEST(name, arch) \ DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ARG_END)