From patchwork Mon Apr 1 16:47:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161543 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687594jan; Mon, 1 Apr 2019 09:47:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5PFSAQL4RuKyCt9xP3RzdXo+xLlwF4KRPfYDQMpK6dpoqrtr+WeoxUrTVNmLiw/4Va1Ra X-Received: by 2002:a05:620a:11b5:: with SMTP id c21mr41365846qkk.222.1554137261486; Mon, 01 Apr 2019 09:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137261; cv=none; d=google.com; s=arc-20160816; b=b7lrMr4D2FKWVG6bZ3qDXbUOrXtCaN1M9shjeOQyks0EE1+RN6XSpxbSSz0wEfQHe5 9RJ6vINZpERFvUyrmXBQf7jBCW1XQPVgZgRxnUnHCjTPwkDdOHfdE7+7f0xUO9BG4+QR IX6Wu8pKrqL+2owQSAGAltS9MoUYbjXCBOpqs4Vhm1R/ibVz92W0QoeRJBwLsNavZKPW z4pObO4eYjaVFid40Ad4Fx64IiB8BYlhElplJ1eALHdX6HZ13TOykZiyOegJaYndn4Am NLuZckwlKYn6uCNqz3LaOKDf7d3EAE+2sc7xJ1ToUUGupUq2ttWCfoS2n0mn6GkVcKRQ 9dlg== 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=8uAT8Yd9tHzw9eeFoBonT07UnjKVfb+B7BuGw/DxYIU=; b=XsJN0xlZkUB1gggi94wI46lF7GiznQRrG0a864yqUIckXyikWTtfhENi0btsod5x8N xJljSMJ4a9Epgl1tWAaq+bMqCD+u/pjxTtJlLIBs07FFF0yWu6Ak39RUWMG3PaAEyUWI +DsjKdXE32X8Qb6ZoLZGikHVHRB0lzG0zSPg7m04vnwo02cJsrVLxJuOjIRYIbSmhn/y mSYXEv1EBaVynaNGOSKKQ5HKj9AO1g/OB44LBTxk8/vZAsmeyljk9SL9yYorc5ng24S8 BiqBCOe2aYQQXYYJs5qfJX54MCj8hwaFRVWNL43bzxyvFIohd5TVct5t483tH7L2ZhfX ADrw== 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 k20si2966914qkg.102.2019.04.01.09.47.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:41 -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-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1D85488311; Mon, 1 Apr 2019 16:47:40 +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 4176F28543; Mon, 1 Apr 2019 16:47:39 +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 E166841F3E; Mon, 1 Apr 2019 16:47:35 +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 x31GlYNA026652 for ; Mon, 1 Apr 2019 12:47:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7ADFD5C27C; Mon, 1 Apr 2019 16:47:34 +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 167985C28C; Mon, 1 Apr 2019 16:47:33 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:17 -0400 Message-Id: <8cc14a94c53a1cf2a82231817680bb47f57cbc26.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 01/12] tests: qemuxml2xml: Break out testInfoSet*Paths 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 01 Apr 2019 16:47:40 +0000 (UTC) These will need to be separate to share testInfo with qemuxml2argv Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 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 83a0d1cf7b..2dfa9e628b 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -129,16 +129,11 @@ testInfoSetCommon(struct testInfo *info, return -1; } - static int -testInfoSet(struct testInfo *info, - const char *name, - int when, - int gic) +testInfoSetPaths(struct testInfo *info, + const char *name, + int when) { - if (testInfoSetCommon(info, gic) < 0) - return -1; - if (virAsprintf(&info->inName, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, name) < 0) goto error; @@ -186,13 +181,9 @@ testInfoSet(struct testInfo *info, static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/"; static int -testInfoSetStatus(struct testInfo *info, - const char *name, - int gic) +testInfoSetStatusPaths(struct testInfo *info, + const char *name) { - if (testInfoSetCommon(info, gic) < 0) - return -1; - if (virAsprintf(&info->inName, "%s%s-in.xml", statusPath, name) < 0 || virAsprintf(&info->outActiveName, "%s%s-out.xml", statusPath, name) < 0) goto error; @@ -236,7 +227,8 @@ mymain(void) # define DO_TEST_FULL(name, when, gic, ...) \ do { \ - if (testInfoSet(&info, name, when, gic) < 0) { \ + if (testInfoSetCommon(&info, gic) < 0 || \ + testInfoSetPaths(&info, name, when) < 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \ return -1; \ } \ @@ -1241,7 +1233,8 @@ mymain(void) # define DO_TEST_STATUS(name) \ do { \ - if (testInfoSetStatus(&info, name, GIC_NONE) < 0) { \ + if (testInfoSetCommon(&info, GIC_NONE) < 0 || \ + testInfoSetStatusPaths(&info, name) < 0) { \ VIR_TEST_DEBUG("Failed to generate status test data for '%s'", name); \ return -1; \ } \ From patchwork Mon Apr 1 16:47:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161545 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687608jan; Mon, 1 Apr 2019 09:47:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqyb/ZBLR0Hty5ThTsbiAZuLgc6xpFklPQ6GQ9LSJC/GdfUHrHPSzQ68K8HJ0pYF1nWXBY/L X-Received: by 2002:ac8:2d56:: with SMTP id o22mr55886914qta.321.1554137261550; Mon, 01 Apr 2019 09:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137261; cv=none; d=google.com; s=arc-20160816; b=vtRAZ1j6ni2peK2l8FnWpGagzbnSijWjVUvUSkDjvzEef1q8MTbuBAnVvg1V0rih8+ FZibxBhUtssf5K2G0tUIzgVmR4mN3DSCAc9vn4zq9adEEvnKYvTZCVc77OagRQB2tcme tjkRmqq0jpKbdl0Hw6VEj1JFLtrBfjakVGdSprrcYl+PK46GT9Egqjs/mgmyj55Fgk2p 312t0N0GElZYKfSIBq6CUI/28M0kv3VvoceNt+xoTK9IGmTUUoKL3sI5+wF03BpllweA yc/a7M/BVwvAzlZt/Ue33T7qZLVJbKI2anA894g0uAOhw53grVSmxWiKmdnhs0+Ah1Uc ap+Q== 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=+4NGX0ovBMSYF9KWkhTHRVXXugsxcQHFdrnNH98RhCM=; b=oClG12bt1Em4MRpaNyrpMNClJt92/rjvF0vvA4JQRWSvT5nLVK/BB7+yYlnrUDUKxC qLCfJyVYc+86P6szlpYcAFbhwihh9h4LUbDVF3mr6x+KR2QfGwAetKUC/jktOLad8eTD GS2E+tR/mEqFzfB7OryQluUqRRXQ3mkyEmWQlWnvKKXIPDqVFFFgCWG10gF1FxZoLivv 6KTcUC5KMHSGtPsR+qChxrTNUD6ZiTwywToaT7wY/enMDpM5TjldSQ5l166LFAIf9g+/ OAmyESfQq0mg4Fs7LyvTf4xK43wrAPe0tS3FEZaA8tgcltltUVdo2XgO2ZS7AAefrKLV FX9w== 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 u189si1171444qkc.88.2019.04.01.09.47.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:41 -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-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1E7C459447; Mon, 1 Apr 2019 16:47:40 +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 41726601A5; Mon, 1 Apr 2019 16:47:39 +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 D2BE741F3D; Mon, 1 Apr 2019 16:47:36 +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 x31GlZsS026661 for ; Mon, 1 Apr 2019 12:47:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E05D5C28C; Mon, 1 Apr 2019 16:47:35 +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 ABC1E5C25A; Mon, 1 Apr 2019 16:47:34 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:18 -0400 Message-Id: <31040eaf236a6e468dc9e88cebaff6bada2a9b58.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 02/12] tests: qemuxml2xml: Add info->{in, out}file 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 01 Apr 2019 16:47:40 +0000 (UTC) Just renamed from existing inName and outActiveName Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 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 2dfa9e628b..0ced565fbc 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -26,8 +26,8 @@ enum { }; struct testInfo { - char *inName; - char *outActiveName; + char *infile; + char *outfile; char *outInactiveName; virQEMUCapsPtr qemuCaps; @@ -40,7 +40,7 @@ testXML2XMLActive(const void *opaque) const struct testInfo *info = opaque; return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, - info->inName, info->outActiveName, true, + info->infile, info->outfile, true, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); } @@ -51,7 +51,7 @@ testXML2XMLInactive(const void *opaque) { const struct testInfo *info = opaque; - return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->inName, + return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, info->outInactiveName, false, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); @@ -66,13 +66,13 @@ testCompareStatusXMLToXMLFiles(const void *opaque) char *actual = NULL; int ret = -1; - if (!(obj = virDomainObjParseFile(data->inName, driver.caps, driver.xmlopt, + if (!(obj = virDomainObjParseFile(data->infile, driver.caps, driver.xmlopt, VIR_DOMAIN_DEF_PARSE_STATUS | VIR_DOMAIN_DEF_PARSE_ACTUAL_NET | VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES | VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE | VIR_DOMAIN_DEF_PARSE_ALLOW_POST_PARSE_FAIL))) { - VIR_TEST_DEBUG("\nfailed to parse '%s'\n", data->inName); + VIR_TEST_DEBUG("\nfailed to parse '%s'\n", data->infile); goto cleanup; } @@ -82,11 +82,11 @@ testCompareStatusXMLToXMLFiles(const void *opaque) VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET | VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES | VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST))) { - VIR_TEST_DEBUG("\nfailed to format back '%s'\n", data->inName); + VIR_TEST_DEBUG("\nfailed to format back '%s'\n", data->infile); goto cleanup; } - if (virTestCompareToFile(actual, data->outActiveName) < 0) + if (virTestCompareToFile(actual, data->outfile) < 0) goto cleanup; ret = 0; @@ -101,8 +101,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque) static void testInfoClear(struct testInfo *info) { - VIR_FREE(info->inName); - VIR_FREE(info->outActiveName); + VIR_FREE(info->infile); + VIR_FREE(info->outfile); VIR_FREE(info->outInactiveName); virObjectUnref(info->qemuCaps); @@ -134,7 +134,7 @@ testInfoSetPaths(struct testInfo *info, const char *name, int when) { - if (virAsprintf(&info->inName, "%s/qemuxml2argvdata/%s.xml", + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, name) < 0) goto error; @@ -155,15 +155,15 @@ testInfoSetPaths(struct testInfo *info, } if (when & WHEN_ACTIVE) { - if (virAsprintf(&info->outActiveName, + if (virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s-active.xml", abs_srcdir, name) < 0) goto error; - if (!virFileExists(info->outActiveName)) { - VIR_FREE(info->outActiveName); + if (!virFileExists(info->outfile)) { + VIR_FREE(info->outfile); - if (virAsprintf(&info->outActiveName, + if (virAsprintf(&info->outfile, "%s/qemuxml2xmloutdata/%s.xml", abs_srcdir, name) < 0) goto error; @@ -184,8 +184,8 @@ static int testInfoSetStatusPaths(struct testInfo *info, const char *name) { - if (virAsprintf(&info->inName, "%s%s-in.xml", statusPath, name) < 0 || - virAsprintf(&info->outActiveName, "%s%s-out.xml", statusPath, name) < 0) + if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 || + virAsprintf(&info->outfile, "%s%s-out.xml", statusPath, name) < 0) goto error; return 0; @@ -240,7 +240,7 @@ mymain(void) ret = -1; \ } \ \ - if (info.outActiveName) { \ + if (info.outfile) { \ if (virTestRun("QEMU XML-2-XML-active " name, \ testXML2XMLActive, &info) < 0) \ ret = -1; \ From patchwork Mon Apr 1 16:47:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161548 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687814jan; Mon, 1 Apr 2019 09:47:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxbEkH3qdDdz6S2E/B4DKx0n8ZoXcoVN5/pUcXsqTdoLShk1DpNbQifyORWq6y7TBTjhs2c X-Received: by 2002:a0c:f68a:: with SMTP id p10mr51098879qvn.126.1554137273865; Mon, 01 Apr 2019 09:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137273; cv=none; d=google.com; s=arc-20160816; b=UbU4oTR5vkdq+HUtwlMluTJzoZGI4oqy9fQfp7N0dRWxH4tqeCPwtkBzHfFc2wj9L6 dgXhcEFembw5BXEG2GOECMSJp6fyNxGRYO8tQr9rQtqDBttEsk5oN2iqbAswRKeujm/V O7IM483tkVRJA/gp/ZSfrPpOMkVK5I3gRVKlN2jDTBXZGO/BmJdhJL53OOCwBFvhJn6g Pd0oi+KOMeFDTmc1fMPMez3BXnysv6NZey52xhayYS8S7h3/4ekXWZlxysHFUulwq11u x1BphmwYFQ09OnUYeAyBt3XmPuEh8VCGrix9GuPsgrnyvhR0DNPyH6RySG6gOiD7VUQ/ xcjg== 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=EsvPvTXTGtcVYVONEuZVolcyT/X1Hel3Hy3k98g7f98=; b=dKowDATkDAuopg4G/8AwLe+R3XXMp6KZJdVg6qbbeQ8Xbnk/oPsMd3IWVe/KEDwU83 mqXHdiLlr5baJk2iQ8YmT591TmPtk1aYeQNMNXntB/YCw4mX/2sD4IYbPCTuqVLkMvRT xr7ikVSnh+RMgcojBTIFem8F8Y4sKcoC45CZECy5Tgx9Yo4tGN2VK+NhljKvTOfE1kmz atRFbNBkvqAvEWRY9oiEN5fAhL2ZaXwTZDsxplj2tl7WRLTmpxeraG9AIxu5Nunq/X1N sZR4ZM938+LHkX3bCQurxGyedl43qupw6YAAM0j4majqGybnlS2h0jTFW+3dHIKTwfqF XiiQ== 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 a23si1683818qth.45.2019.04.01.09.47.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:53 -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 62520C024FE6; Mon, 1 Apr 2019 16:47:52 +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 3C95B5C27C; Mon, 1 Apr 2019 16:47: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 0063B3FAF4; Mon, 1 Apr 2019 16:47:51 +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 x31GlZQ9026671 for ; Mon, 1 Apr 2019 12:47:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id CCEB15C28C; Mon, 1 Apr 2019 16:47:35 +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 4C9535C25A; Mon, 1 Apr 2019 16:47:35 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:19 -0400 Message-Id: <6451264a9031a9fd8182a0a4459166bcfb54125a.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 03/12] tests: qemuxml2xml: Remove info->outActiveName 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.32]); Mon, 01 Apr 2019 16:47:52 +0000 (UTC) Reuse info->outfile for it. This requires us to set paths before each virTestRun invocation Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 61 +++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 36 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 0ced565fbc..538ccae8fd 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -28,7 +28,6 @@ enum { struct testInfo { char *infile; char *outfile; - char *outInactiveName; virQEMUCapsPtr qemuCaps; }; @@ -40,8 +39,7 @@ testXML2XMLActive(const void *opaque) const struct testInfo *info = opaque; return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, - info->infile, info->outfile, true, - 0, + info->infile, info->outfile, true, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); } @@ -51,9 +49,8 @@ testXML2XMLInactive(const void *opaque) { const struct testInfo *info = opaque; - return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, - info->outInactiveName, false, - 0, + return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, + info->infile, info->outfile, false, 0, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); } @@ -103,7 +100,6 @@ testInfoClear(struct testInfo *info) { VIR_FREE(info->infile); VIR_FREE(info->outfile); - VIR_FREE(info->outInactiveName); virObjectUnref(info->qemuCaps); } @@ -134,40 +130,26 @@ testInfoSetPaths(struct testInfo *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) goto error; - if (when & WHEN_INACTIVE) { - if (virAsprintf(&info->outInactiveName, - "%s/qemuxml2xmloutdata/%s-inactive.xml", - abs_srcdir, name) < 0) - goto error; - - if (!virFileExists(info->outInactiveName)) { - VIR_FREE(info->outInactiveName); + if (virAsprintf(&info->outfile, + "%s/qemuxml2xmloutdata/%s-%s.xml", + abs_srcdir, name, + when == WHEN_ACTIVE ? "active" : "inactive") < 0) + goto error; - if (virAsprintf(&info->outInactiveName, - "%s/qemuxml2xmloutdata/%s.xml", - abs_srcdir, name) < 0) - goto error; - } - } + if (!virFileExists(info->outfile)) { + VIR_FREE(info->outfile); - if (when & WHEN_ACTIVE) { if (virAsprintf(&info->outfile, - "%s/qemuxml2xmloutdata/%s-active.xml", + "%s/qemuxml2xmloutdata/%s.xml", abs_srcdir, name) < 0) goto error; - - if (!virFileExists(info->outfile)) { - VIR_FREE(info->outfile); - - if (virAsprintf(&info->outfile, - "%s/qemuxml2xmloutdata/%s.xml", - abs_srcdir, name) < 0) - goto error; - } } return 0; @@ -227,20 +209,27 @@ mymain(void) # define DO_TEST_FULL(name, when, gic, ...) \ do { \ - if (testInfoSetCommon(&info, gic) < 0 || \ - testInfoSetPaths(&info, name, when) < 0) { \ + if (testInfoSetCommon(&info, 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 (when & WHEN_INACTIVE) { \ + if (testInfoSetPaths(&info, name, WHEN_INACTIVE) < 0) { \ + VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", name); \ + return -1; \ + } \ if (virTestRun("QEMU XML-2-XML-inactive " name, \ testXML2XMLInactive, &info) < 0) \ ret = -1; \ } \ \ - if (info.outfile) { \ + if (when & WHEN_ACTIVE) { \ + if (testInfoSetPaths(&info, name, WHEN_ACTIVE) < 0) { \ + VIR_TEST_DEBUG("Failed to generate active paths for '%s'", name); \ + return -1; \ + } \ if (virTestRun("QEMU XML-2-XML-active " name, \ testXML2XMLActive, &info) < 0) \ ret = -1; \ From patchwork Mon Apr 1 16:47:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161549 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687872jan; Mon, 1 Apr 2019 09:47:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwm2vYTqnVna8y1fj7wb4HVPji21aazKmjcwQsyrxeypy97zLcF4tszbdMLNG8voNbArkrb X-Received: by 2002:ac8:184b:: with SMTP id n11mr53937724qtk.210.1554137277662; 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=ZcBZf0tkmnZu2e3oPP1czFEauZk/qnpfWzc+/cp8vksnDimH641kmUhxKLw571P3YK tP0OSk59ebNq0CCs8WL3eujPWfqt1wzJjj7mNycv9xmQYIu85mHRKsgMuTIqI9ZXV6Ia HDjAlvjAr0TalihcOEa+UoK5V1xvRMgZQLjdp667xSeiZ5rxANWIPZl8Mu51RtsV7glE igNOCvzm7TXQPgNziMbFT8q0kLj1j2W2JPBwrxrzdRMpQNI+sk7DgkysLrOpeOEnUwB6 XbV0wL9u6JyTmyMy2PMkPWrq/0y8yg/FMKfYFpAJl04T4X/ZJSD2BLVlwqBEenqBtLbj lsGg== 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=s/4DUu2k+HbvUv26ZEmPcCrspeOcC2BJf0K4RqssyIs=; b=vdRKRZiS+FuB/AxQnvn4BGN4OpwG0Fvy25o7Wm8tR78Hr7+ALJm9L8IfNl3/EhBImY ZebUPlmHpe0Sgz9dSeoMLAGHqQEVXbwyR6Ff1uHlG6uxz3sPcpPifJtxCR9yFJID5bRQ Zc9b0O57K0hVrwhWvidTgM1IPW++yJ/fFrCFGiY0UglZ4L5+FgRYRu4eh+BtgImNiutR dq7F0PpqrL9dwYgrmgmJL0Ilp6sQJepuS3LaE2/sbTj8H6GrFYWRanLoxMqhuhOXa//O OrqzfxiSZo58V2YdBGiRj4DxQP9p/swN/3WmIJdJSMWfVAwgsVdu94pYCFwV5Lrqrp2L ifmg== 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 y15si1517079qta.320.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-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1997F5944D; Mon, 1 Apr 2019 16:47:56 +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 DE14187B9; Mon, 1 Apr 2019 16:47:55 +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 9CE281819AFF; 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 x31Glamh026682 for ; Mon, 1 Apr 2019 12:47:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id A247D5C27C; Mon, 1 Apr 2019 16:47:36 +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 3D1985C28C; Mon, 1 Apr 2019 16:47:35 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:20 -0400 Message-Id: <30eaad11068f933f64ac07af35495bb5b2953377.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 04/12] tests: qemuxml2argv: Add info->{in, out}file 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 01 Apr 2019 16:47:56 +0000 (UTC) Track infile and outfile in testInfo. This is step towards moving path creation out of the test case, which will eventually help sharing more code with qemuxml2xmltest.c Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 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/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 0c0dcae197..ff7bacf8db 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -299,6 +299,8 @@ typedef enum { struct testInfo { const char *name; const char *suffix; + char *infile; + char *outfile; virQEMUCapsPtr qemuCaps; const char *migrateFrom; int migrateFd; @@ -427,8 +429,6 @@ static int testCompareXMLToArgv(const void *data) { struct testInfo *info = (void *) data; - char *xml = NULL; - char *args = NULL; char *migrateURI = NULL; char *actualargv = NULL; const char *suffix = info->suffix; @@ -471,9 +471,9 @@ testCompareXMLToArgv(const void *data) if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) goto cleanup; - if (virAsprintf(&xml, "%s/qemuxml2argvdata/%s.xml", + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, info->name) < 0 || - virAsprintf(&args, "%s/qemuxml2argvdata/%s%s.args", + virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", abs_srcdir, info->name, suffix) < 0) goto cleanup; @@ -486,7 +486,8 @@ testCompareXMLToArgv(const void *data) goto cleanup; parseFlags |= VIR_DOMAIN_DEF_PARSE_INACTIVE; - if (!(vm->def = virDomainDefParseFile(xml, driver.caps, driver.xmlopt, + if (!(vm->def = virDomainDefParseFile(info->infile, + driver.caps, driver.xmlopt, NULL, parseFlags))) { if (flags & FLAG_EXPECT_PARSE_ERROR) goto ok; @@ -502,7 +503,7 @@ testCompareXMLToArgv(const void *data) goto cleanup; if (!virDomainDefCheckABIStability(vm->def, vm->def, driver.xmlopt)) { - VIR_TEST_DEBUG("ABI stability check failed on %s", xml); + VIR_TEST_DEBUG("ABI stability check failed on %s", info->infile); goto cleanup; } @@ -570,7 +571,7 @@ testCompareXMLToArgv(const void *data) if (!(actualargv = virCommandToString(cmd, false))) goto cleanup; - if (virTestCompareToFile(actualargv, args) < 0) + if (virTestCompareToFile(actualargv, info->outfile) < 0) goto cleanup; ret = 0; @@ -600,8 +601,6 @@ testCompareXMLToArgv(const void *data) virSetConnectStorage(NULL); virObjectUnref(conn); VIR_FREE(migrateURI); - VIR_FREE(xml); - VIR_FREE(args); return ret; } @@ -754,6 +753,8 @@ testInfoSetArgs(struct testInfo *info, static void testInfoClear(struct testInfo *info) { + VIR_FREE(info->infile); + VIR_FREE(info->outfile); virObjectUnref(info->qemuCaps); } From patchwork Mon Apr 1 16:47:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161546 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687809jan; Mon, 1 Apr 2019 09:47:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZgIXIe2CLQPyZpqAlWiLawJXJUkW4XQ9SlozAvl09rJ36PI60oO3xb57eiLlhoX0ZN6Q5 X-Received: by 2002:a37:a412:: with SMTP id n18mr48324304qke.321.1554137273695; Mon, 01 Apr 2019 09:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137273; cv=none; d=google.com; s=arc-20160816; b=ExJBDKsfPqeDNKzMsIRc/c0qkzVboo92fX29KbR+ppUfahcZrtOm3ujy8G0Qj77thL pjHVHsZYPfbqa3Gorr3DLcUaHWSYAoZeX8FyLgpqLWO+04WNZ8wg2pq9qjxrhL8JyCaF k8i0BI2aBXQelmzo1hjFuvoSNCykMqt8dDEnc0nnwzV0btTm1eQjSkVByXvUqva6g/ST zN8vr0EfzvLTwH+qPoUr0S73AEsY5R3h95lFRpJbJfHhKkWskj94gKjUvADx1CqXHrea uOs3cYiLtn+Z65Kq7DqS1MQLZydpCX04huKob7gZ8kJIJXp9OW5zJB+JoJOQ6Lj7d/tg okRg== 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=msX+7TO6yABxS0M4P3F5+GCrpeEtYe0HQyDxerSsazo=; b=ZiLH4zTu1dtd73DYlUTXNRc+DfAX2yy1o2efXTM7lIoDGO6fUAW3++KH2H515tCkYn sx/k7FhF+4ErRnrW93Hj/riTpbu7DLLewTz/W/jdxS8CNaoTayTXJoN+Q6x8b8IQ3ffp Ktvfum2Wz9V34NggqPyRUVSFJerU6IcwYB5hCfijddt8IN6csaL969/p7/3tmysFyEmf bVZJgHXX9KnK/pd47MeC9+SOr4gEq6h7XfCHRWqEeJuovUkXBR4CD497vLjHKtNqzKVg yHm+QyPK31efnmoQPqP2qSL1i1q5e+aSMftWU6dbpS7F6b6aKSvbCI8pqJwrMK7d0urE yONw== 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 h13si2482019qtr.67.2019.04.01.09.47.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:53 -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 65FE07F746; Mon, 1 Apr 2019 16:47:52 +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 3E896BA93; Mon, 1 Apr 2019 16:47: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 F2921180338A; Mon, 1 Apr 2019 16:47:51 +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 x31GlbdB026695 for ; Mon, 1 Apr 2019 12:47:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 405805C27C; Mon, 1 Apr 2019 16:47:37 +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 CFEC15C25A; Mon, 1 Apr 2019 16:47:36 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:21 -0400 Message-Id: <360558146ac0c43c7779c522d0b4d90078ccd950.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 05/12] tests: qemuxml2argv: add testInfoSetPaths 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.27]); Mon, 01 Apr 2019 16:47:52 +0000 (UTC) This moves infile and outfile building outside the test case, which better fits the pattern of qemuxml2xmltest. It also lets us drop the qemuxml2argtest-specific 'suffix' from testInfo Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 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 ff7bacf8db..a3fee41ea9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -298,7 +298,6 @@ typedef enum { struct testInfo { const char *name; - const char *suffix; char *infile; char *outfile; virQEMUCapsPtr qemuCaps; @@ -431,7 +430,6 @@ testCompareXMLToArgv(const void *data) struct testInfo *info = (void *) data; char *migrateURI = NULL; char *actualargv = NULL; - const char *suffix = info->suffix; unsigned int flags = info->flags; unsigned int parseFlags = info->parseFlags; int ret = -1; @@ -448,9 +446,6 @@ testCompareXMLToArgv(const void *data) if (!(conn = virGetConnect())) goto cleanup; - if (!suffix) - suffix = ""; - conn->secretDriver = &fakeSecretDriver; conn->storageDriver = &fakeStorageDriver; conn->nwfilterDriver = &fakeNWFilterDriver; @@ -471,12 +466,6 @@ testCompareXMLToArgv(const void *data) if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) goto cleanup; - if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", - abs_srcdir, info->name) < 0 || - virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", - abs_srcdir, info->name, suffix) < 0) - goto cleanup; - if (info->migrateFrom && !(migrateURI = qemuMigrationDstGetURI(info->migrateFrom, info->migrateFd))) @@ -758,6 +747,17 @@ testInfoClear(struct testInfo *info) virObjectUnref(info->qemuCaps); } +static int +testInfoSetPaths(struct testInfo *info, const char *suffix) +{ + if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", + abs_srcdir, info->name) < 0 || + virAsprintf(&info->outfile, "%s/qemuxml2argvdata/%s%s.args", + abs_srcdir, info->name, suffix ? suffix : "") < 0) + return -1; + return 0; +} + # define FAKEROOTDIRTEMPLATE abs_builddir "/fakerootdir-XXXXXX" static int @@ -883,11 +883,12 @@ mymain(void) do { \ static struct testInfo info = { \ .name = _name, \ - .suffix = _suffix, \ }; \ if (testInfoSetArgs(&info, capslatest, \ __VA_ARGS__, ARG_END) < 0) \ return EXIT_FAILURE; \ + if (testInfoSetPaths(&info, _suffix)) \ + return EXIT_FAILURE; \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ testCompareXMLToArgv, &info) < 0) \ ret = -1; \ From patchwork Mon Apr 1 16:47:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161552 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687923jan; Mon, 1 Apr 2019 09:48:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxIbjqhNehpO/JTPkKsqW3OydSDAJG8HzUudt8Dr8k0iZwRpr5hWQHfnF953cTqb+vPZlJW X-Received: by 2002:a0c:9ba7:: with SMTP id o39mr52066220qve.153.1554137281066; Mon, 01 Apr 2019 09:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137281; cv=none; d=google.com; s=arc-20160816; b=ja1ijhR4gnMJ2Sl3Vh6DmxfjOu2IDmvVX2kaaePRSOo8kwpgGhOF2tp3r8zGRbqE8K yM5Kbk66Ro08RwPs6snr3YPSNo7z80GiDLtabHezKG0uUvnNQLjmNLL8Tqz0fOUwCmPG 3sSWhwMsykrNzY7Rm88QHl5jgB8T9H3YdjijD1z2QvHTMcw9rMesN+WaIWeNNWmtu9dY Gh09p68Y6XRIIlU8/g53bvm0IiZXRp6rlWgkJaCbVzlngf704aO+JI5p/bSxOK4BrDG9 FKtMWEMjU0RjxkPRK0/uRqp8yenueTkXFNthvbAn7cKe4Zaf7R4/K+dLffH4Xl9UFvDy u7rw== 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=w7L6wYjkpdzRx4bRrY1NAk9pvaeToT9jjFh6pUv8RR0=; b=fibyvA8kyGJQN3chMfuXd537QQpK14ymX7kCiPyV6M8ci0/i/SyjR8hX69hRtyBpiS 8AdzpivwTmB5yBHCzN2+hJ65+nFX4i42wvKzOBlJj5hbc7U/C0F9Kl25PRCVsehoTiFo 9LcoGrIA5CidrY/p6xItbtCGrxTWrIujVqH9hGDgQKN6oBE2tUTjKqrMWL5i/uJM+I+S 6N60yjoFNlCPHHqP5HAoZ69tCinkzqyXSy0bW8kNtzRwIho2DqInhK8M7YgtlItG0jsz fJ4skdqjt+WIp14O0j6wZuJZg04LzQTqpAzsnw89qNed/aFpQRI9B0E8lKQPdf+lf+OX ON3w== 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 s40si6446438qth.154.2019.04.01.09.48.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:48:01 -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-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B5D8D6699B; Mon, 1 Apr 2019 16:47:59 +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 8AB3C27CD6; Mon, 1 Apr 2019 16:47:59 +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 4945C181A135; Mon, 1 Apr 2019 16:47:59 +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 x31GlbQB026707 for ; Mon, 1 Apr 2019 12:47:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id D9D325C27C; Mon, 1 Apr 2019 16:47:37 +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 737A45C206; Mon, 1 Apr 2019 16:47:37 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:22 -0400 Message-Id: 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 06/12] tests: qemuxml2argv: Rename testInfo* to 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 01 Apr 2019 16:48:00 +0000 (UTC) In preparation for moving these bits to a shared place, rename them to match one of the testqemuutils.c function prefixes. Rename info->flags handling too as it will need to be moved testInfoSetPaths isn't renamed because it will stay local Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 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 a3fee41ea9..b87d2e3fb9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -294,9 +294,9 @@ typedef enum { FLAG_FIPS = 1 << 2, FLAG_REAL_CAPS = 1 << 3, FLAG_SKIP_LEGACY_CPUS = 1 << 4, -} virQemuXML2ArgvTestFlags; +} testQemuInfoFlags; -struct testInfo { +struct testQemuInfo { const char *name; char *infile; char *outfile; @@ -380,7 +380,7 @@ testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy) static int -testUpdateQEMUCaps(const struct testInfo *info, +testUpdateQEMUCaps(const struct testQemuInfo *info, virDomainObjPtr vm, virCapsPtr caps) { @@ -410,7 +410,7 @@ testUpdateQEMUCaps(const struct testInfo *info, static int -testCheckExclusiveFlags(int flags) +testQemuInfoCheckExclusiveFlags(int flags) { virCheckFlags(FLAG_EXPECT_FAILURE | FLAG_EXPECT_PARSE_ERROR | @@ -427,7 +427,7 @@ testCheckExclusiveFlags(int flags) static int testCompareXMLToArgv(const void *data) { - struct testInfo *info = (void *) data; + struct testQemuInfo *info = (void *) data; char *migrateURI = NULL; char *actualargv = NULL; unsigned int flags = info->flags; @@ -460,7 +460,7 @@ testCompareXMLToArgv(const void *data) if (virQEMUCapsGet(info->qemuCaps, QEMU_CAPS_ENABLE_FIPS)) flags |= FLAG_FIPS; - if (testCheckExclusiveFlags(info->flags) < 0) + if (testQemuInfoCheckExclusiveFlags(info->flags) < 0) goto cleanup; if (qemuTestCapsCacheInsert(driver.qemuCapsCache, info->qemuCaps) < 0) @@ -605,14 +605,14 @@ typedef enum { ARG_CAPS_ARCH, ARG_CAPS_VER, ARG_END, -} testInfoArgName; +} testQemuInfoArgName; static int -testInfoSetArgs(struct testInfo *info, - virHashTablePtr capslatest, ...) +testQemuInfoSetArgs(struct testQemuInfo *info, + virHashTablePtr capslatest, ...) { va_list argptr; - testInfoArgName argname; + testQemuInfoArgName argname; virQEMUCapsPtr qemuCaps = NULL; int gic = GIC_NONE; char *capsarch = NULL; @@ -622,7 +622,7 @@ testInfoSetArgs(struct testInfo *info, int ret = -1; va_start(argptr, capslatest); - argname = va_arg(argptr, testInfoArgName); + argname = va_arg(argptr, testQemuInfoArgName); while (argname != ARG_END) { switch (argname) { case ARG_QEMU_CAPS: @@ -684,7 +684,7 @@ testInfoSetArgs(struct testInfo *info, goto cleanup; } - argname = va_arg(argptr, testInfoArgName); + argname = va_arg(argptr, testQemuInfoArgName); } if (!!capsarch ^ !!capsver) { @@ -740,7 +740,7 @@ testInfoSetArgs(struct testInfo *info, } static void -testInfoClear(struct testInfo *info) +testQemuInfoClear(struct testQemuInfo *info) { VIR_FREE(info->infile); VIR_FREE(info->outfile); @@ -748,7 +748,7 @@ testInfoClear(struct testInfo *info) } static int -testInfoSetPaths(struct testInfo *info, const char *suffix) +testInfoSetPaths(struct testQemuInfo *info, const char *suffix) { if (virAsprintf(&info->infile, "%s/qemuxml2argvdata/%s.xml", abs_srcdir, info->name) < 0 || @@ -881,18 +881,18 @@ mymain(void) */ # define DO_TEST_INTERNAL(_name, _suffix, ...) \ do { \ - static struct testInfo info = { \ + static struct testQemuInfo info = { \ .name = _name, \ }; \ - if (testInfoSetArgs(&info, capslatest, \ - __VA_ARGS__, ARG_END) < 0) \ + if (testQemuInfoSetArgs(&info, capslatest, \ + __VA_ARGS__, ARG_END) < 0) \ return EXIT_FAILURE; \ if (testInfoSetPaths(&info, _suffix)) \ return EXIT_FAILURE; \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ testCompareXMLToArgv, &info) < 0) \ ret = -1; \ - testInfoClear(&info); \ + testQemuInfoClear(&info); \ } while (0) # define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \ From patchwork Mon Apr 1 16:47:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161547 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687808jan; Mon, 1 Apr 2019 09:47:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqxV6IDbdS/MsVHjRSFLslTTS8YXeFsunDqSCmW2rZeDeyuR2Vx32pzn4QcEH74LYHEq44TR X-Received: by 2002:a05:620a:1008:: with SMTP id z8mr42436448qkj.264.1554137273667; Mon, 01 Apr 2019 09:47:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137273; cv=none; d=google.com; s=arc-20160816; b=1F8A9eJ1REkwSI54Qpw44eiAwDluT3luP6FHiJLUL79HPChBTuC4Xi6E7K9yECgzTQ loHrRy9j8pMWhG4Y5/PLZAeoLX94epbuO3JOtp4RY1Y6swPAACqMQNcvuFOd9Xnq+CMg YTesHbyH9N5wDaH7Tu68S5aq4Qw3p6f4EodOpfJkgqmv/TpU8IgDWvrJOzgyIPMSxVUO 9rKFSgSKrdj4N3UjQIfMK+XtASU290Wske8KITZ8LstswXQXQzebrO7NsU46f9F9vnDg OvXXums8z8mK5Wyk9FFBMyiEMAwTWL3fxw8pnlwUsRi/1acq68Y1zBmq8t3KrjkY47ti bKqA== 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=G2Wq+GyBII34r4CGYWU+rrOhjK1HAw4eMP1ZBD1k98g=; b=F9ozuQGX/qEedEkpSNyAk9cCFyRK9bITGY6hrJHotrgXK0khUtkvbTWk7ONkUQ8q+n LfgaXwdR0MFpgV/tCZ1rb8FAyke3Tr+QV4ke82v1arW3dvP25kImz7QiNhRNuOO49rDm sNTDRnIG6BUheTU/IZhKNj09UYniiGpp7Gd3tQVHjWC2XeQO9jciPFka6r80ymGdkhHo Oj2LVre2JU+7jtk9c3zD4K8l1myN3SICaifaDkjqcqdpUOV7wjbpimqsqvKlcs6/NeEU tDVdhIcTErt+TcY63mY+jIRbmhuhQKkvDMKeRTExPRMOyyJaVMzJFw9446dI113ASVg+ bWzQ== 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 i44si1375152qtc.114.2019.04.01.09.47.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:53 -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 6CD5059449; Mon, 1 Apr 2019 16:47:52 +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 408855C28C; Mon, 1 Apr 2019 16:47: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 04377180338B; Mon, 1 Apr 2019 16:47:52 +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 x31Glc30026712 for ; Mon, 1 Apr 2019 12:47:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D1605C27C; Mon, 1 Apr 2019 16:47:38 +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 13E995C25A; Mon, 1 Apr 2019 16:47:37 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:23 -0400 Message-Id: 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 07/12] tests: Move testQemuInfo* to testutilsqemu 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.39]); Mon, 01 Apr 2019 16:47:52 +0000 (UTC) So it can eventually be shared with qemuxml2xml Signed-off-by: Cole Robinson --- tests/qemuxml2argvtest.c | 173 --------------------------------------- tests/testutilsqemu.c | 144 ++++++++++++++++++++++++++++++++ tests/testutilsqemu.h | 39 +++++++++ 3 files changed, 183 insertions(+), 173 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 b87d2e3fb9..a51bdb2453 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -288,25 +288,6 @@ static virNWFilterDriver fakeNWFilterDriver = { .nwfilterBindingDelete = fakeNWFilterBindingDelete, }; -typedef enum { - FLAG_EXPECT_FAILURE = 1 << 0, - FLAG_EXPECT_PARSE_ERROR = 1 << 1, - FLAG_FIPS = 1 << 2, - FLAG_REAL_CAPS = 1 << 3, - FLAG_SKIP_LEGACY_CPUS = 1 << 4, -} testQemuInfoFlags; - -struct testQemuInfo { - const char *name; - char *infile; - char *outfile; - virQEMUCapsPtr qemuCaps; - const char *migrateFrom; - int migrateFd; - unsigned int flags; - unsigned int parseFlags; -}; - static int testAddCPUModels(virQEMUCapsPtr caps, bool skipLegacy) @@ -593,160 +574,6 @@ testCompareXMLToArgv(const void *data) return ret; } -# define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata" - -typedef enum { - ARG_QEMU_CAPS, - ARG_GIC, - ARG_MIGRATE_FROM, - ARG_MIGRATE_FD, - ARG_FLAGS, - ARG_PARSEFLAGS, - ARG_CAPS_ARCH, - ARG_CAPS_VER, - ARG_END, -} testQemuInfoArgName; - -static int -testQemuInfoSetArgs(struct testQemuInfo *info, - virHashTablePtr capslatest, ...) -{ - va_list argptr; - testQemuInfoArgName argname; - virQEMUCapsPtr qemuCaps = NULL; - int gic = GIC_NONE; - char *capsarch = NULL; - char *capsver = NULL; - VIR_AUTOFREE(char *) capsfile = NULL; - int flag; - int ret = -1; - - va_start(argptr, capslatest); - argname = va_arg(argptr, testQemuInfoArgName); - while (argname != ARG_END) { - switch (argname) { - case ARG_QEMU_CAPS: - if (qemuCaps || !(qemuCaps = virQEMUCapsNew())) - goto cleanup; - - while ((flag = va_arg(argptr, int)) < QEMU_CAPS_LAST) - virQEMUCapsSet(qemuCaps, flag); - - /* Some tests are run with NONE capabilities, which is just - * another name for QEMU_CAPS_LAST. If that is the case the - * arguments look like this : - * - * ARG_QEMU_CAPS, NONE, QEMU_CAPS_LAST, ARG_END - * - * Fetch one argument more and if it is QEMU_CAPS_LAST then - * break from the switch() to force getting next argument - * in the line. If it is not QEMU_CAPS_LAST then we've - * fetched real ARG_* and we must process it. - */ - if ((flag = va_arg(argptr, int)) != QEMU_CAPS_LAST) { - argname = flag; - continue; - } - - break; - - case ARG_GIC: - gic = va_arg(argptr, int); - break; - - case ARG_MIGRATE_FROM: - info->migrateFrom = va_arg(argptr, char *); - break; - - case ARG_MIGRATE_FD: - info->migrateFd = va_arg(argptr, int); - break; - - case ARG_FLAGS: - info->flags = va_arg(argptr, int); - break; - - case ARG_PARSEFLAGS: - info->parseFlags = va_arg(argptr, int); - break; - - case ARG_CAPS_ARCH: - capsarch = va_arg(argptr, char *); - break; - - case ARG_CAPS_VER: - capsver = va_arg(argptr, char *); - break; - - case ARG_END: - default: - fprintf(stderr, "Unexpected test info argument"); - goto cleanup; - } - - argname = va_arg(argptr, testQemuInfoArgName); - } - - if (!!capsarch ^ !!capsver) { - fprintf(stderr, "ARG_CAPS_ARCH and ARG_CAPS_VER " - "must be specified together.\n"); - goto cleanup; - } - - if (qemuCaps && (capsarch || capsver)) { - fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH " - "or ARG_CAPS_VER\n"); - goto cleanup; - } - - if (!qemuCaps && capsarch && capsver) { - bool stripmachinealiases = false; - - if (STREQ(capsver, "latest")) { - if (VIR_STRDUP(capsfile, virHashLookup(capslatest, capsarch)) < 0) - goto cleanup; - stripmachinealiases = true; - } else if (virAsprintf(&capsfile, "%s/caps_%s.%s.xml", - TEST_CAPS_PATH, capsver, capsarch) < 0) { - goto cleanup; - } - - if (!(qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(capsarch), - capsfile))) { - goto cleanup; - } - - if (stripmachinealiases) - virQEMUCapsStripMachineAliases(qemuCaps); - info->flags |= FLAG_REAL_CAPS; - } - - if (!qemuCaps) { - fprintf(stderr, "No qemuCaps generated\n"); - goto cleanup; - } - VIR_STEAL_PTR(info->qemuCaps, qemuCaps); - - if (gic != GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, gic) < 0) - goto cleanup; - - ret = 0; - - cleanup: - virObjectUnref(qemuCaps); - va_end(argptr); - - return ret; -} - -static void -testQemuInfoClear(struct testQemuInfo *info) -{ - VIR_FREE(info->infile); - VIR_FREE(info->outfile); - virObjectUnref(info->qemuCaps); -} - static int testInfoSetPaths(struct testQemuInfo *info, const char *suffix) { diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index dffe473944..6286c7b3c7 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -918,3 +918,147 @@ testQemuCapsIterate(const char *dirname, return ret; } + + +#define TEST_CAPS_PATH abs_srcdir "/qemucapabilitiesdata" + +int +testQemuInfoSetArgs(struct testQemuInfo *info, + virHashTablePtr capslatest, ...) +{ + va_list argptr; + testQemuInfoArgName argname; + virQEMUCapsPtr qemuCaps = NULL; + int gic = GIC_NONE; + char *capsarch = NULL; + char *capsver = NULL; + VIR_AUTOFREE(char *) capsfile = NULL; + int flag; + int ret = -1; + + va_start(argptr, capslatest); + argname = va_arg(argptr, testQemuInfoArgName); + while (argname != ARG_END) { + switch (argname) { + case ARG_QEMU_CAPS: + if (qemuCaps || !(qemuCaps = virQEMUCapsNew())) + goto cleanup; + + while ((flag = va_arg(argptr, int)) < QEMU_CAPS_LAST) + virQEMUCapsSet(qemuCaps, flag); + + /* Some tests are run with NONE capabilities, which is just + * another name for QEMU_CAPS_LAST. If that is the case the + * arguments look like this : + * + * ARG_QEMU_CAPS, NONE, QEMU_CAPS_LAST, ARG_END + * + * Fetch one argument more and if it is QEMU_CAPS_LAST then + * break from the switch() to force getting next argument + * in the line. If it is not QEMU_CAPS_LAST then we've + * fetched real ARG_* and we must process it. + */ + if ((flag = va_arg(argptr, int)) != QEMU_CAPS_LAST) { + argname = flag; + continue; + } + + break; + + case ARG_GIC: + gic = va_arg(argptr, int); + break; + + case ARG_MIGRATE_FROM: + info->migrateFrom = va_arg(argptr, char *); + break; + + case ARG_MIGRATE_FD: + info->migrateFd = va_arg(argptr, int); + break; + + case ARG_FLAGS: + info->flags = va_arg(argptr, int); + break; + + case ARG_PARSEFLAGS: + info->parseFlags = va_arg(argptr, int); + break; + + case ARG_CAPS_ARCH: + capsarch = va_arg(argptr, char *); + break; + + case ARG_CAPS_VER: + capsver = va_arg(argptr, char *); + break; + + case ARG_END: + default: + fprintf(stderr, "Unexpected test info argument"); + goto cleanup; + } + + argname = va_arg(argptr, testQemuInfoArgName); + } + + if (!!capsarch ^ !!capsver) { + fprintf(stderr, "ARG_CAPS_ARCH and ARG_CAPS_VER " + "must be specified together.\n"); + goto cleanup; + } + + if (qemuCaps && (capsarch || capsver)) { + fprintf(stderr, "ARG_QEMU_CAPS can not be combined with ARG_CAPS_ARCH " + "or ARG_CAPS_VER\n"); + goto cleanup; + } + + if (!qemuCaps && capsarch && capsver) { + bool stripmachinealiases = false; + + if (STREQ(capsver, "latest")) { + if (VIR_STRDUP(capsfile, virHashLookup(capslatest, capsarch)) < 0) + goto cleanup; + stripmachinealiases = true; + } else if (virAsprintf(&capsfile, "%s/caps_%s.%s.xml", + TEST_CAPS_PATH, capsver, capsarch) < 0) { + goto cleanup; + } + + if (!(qemuCaps = qemuTestParseCapabilitiesArch(virArchFromString(capsarch), + capsfile))) { + goto cleanup; + } + + if (stripmachinealiases) + virQEMUCapsStripMachineAliases(qemuCaps); + info->flags |= FLAG_REAL_CAPS; + } + + if (!qemuCaps) { + fprintf(stderr, "No qemuCaps generated\n"); + goto cleanup; + } + VIR_STEAL_PTR(info->qemuCaps, qemuCaps); + + if (gic != GIC_NONE && testQemuCapsSetGIC(info->qemuCaps, gic) < 0) + goto cleanup; + + ret = 0; + + cleanup: + virObjectUnref(qemuCaps); + va_end(argptr); + + return ret; +} + + +void +testQemuInfoClear(struct testQemuInfo *info) +{ + VIR_FREE(info->infile); + VIR_FREE(info->outfile); + virObjectUnref(info->qemuCaps); +} diff --git a/tests/testutilsqemu.h b/tests/testutilsqemu.h index 183ce915f1..f6ae2a38d3 100644 --- a/tests/testutilsqemu.h +++ b/tests/testutilsqemu.h @@ -32,6 +32,41 @@ enum { GIC_BOTH, }; + +typedef enum { + ARG_QEMU_CAPS, + ARG_GIC, + ARG_MIGRATE_FROM, + ARG_MIGRATE_FD, + ARG_FLAGS, + ARG_PARSEFLAGS, + ARG_CAPS_ARCH, + ARG_CAPS_VER, + ARG_END, +} testQemuInfoArgName; + + +typedef enum { + FLAG_EXPECT_FAILURE = 1 << 0, + FLAG_EXPECT_PARSE_ERROR = 1 << 1, + FLAG_FIPS = 1 << 2, + FLAG_REAL_CAPS = 1 << 3, + FLAG_SKIP_LEGACY_CPUS = 1 << 4, +} testQemuInfoFlags; + + +struct testQemuInfo { + const char *name; + char *infile; + char *outfile; + virQEMUCapsPtr qemuCaps; + const char *migrateFrom; + int migrateFd; + unsigned int flags; + unsigned int parseFlags; +}; + + virCapsPtr testQemuCapsInit(void); virDomainXMLOptionPtr testQemuXMLConfInit(void); @@ -71,6 +106,10 @@ int testQemuCapsIterate(const char *dirname, testQemuCapsIterateCallback callback, void *opaque); +int testQemuInfoSetArgs(struct testQemuInfo *info, + virHashTablePtr capslatest, ...); +void testQemuInfoClear(struct testQemuInfo *info); + # endif #endif /* LIBVIRT_TESTUTILSQEMU_H */ 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 From patchwork Mon Apr 1 16:47:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161551 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687907jan; Mon, 1 Apr 2019 09:47:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCBrBxn+zruxLMBFSmaE3UsXISeVsDEAg45gCsLr0oK95YRLXckfuyiKKm+MlCxoSVDl4B X-Received: by 2002:ac8:3fa8:: with SMTP id d37mr53865187qtk.206.1554137279697; Mon, 01 Apr 2019 09:47:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137279; cv=none; d=google.com; s=arc-20160816; b=UWYuv3uON9oI3PDexd+EaCIzX9pOI7kTMjZkgfC9U3LKmkGW4UMV8j/EV+WPrIEwSr gUQ1y2sgn85LrEDBbLZkGk0ipTrVLM7E5K4DBzXtOxs6dO2Rsx3O+36kqDxNCl6tFDSE Iz1YFKJwnXa6NumYv1h9jPQlri1z9VBNGbCNRLxIkNSVOg5lLuz9JseHtXw1IlVwP2TB YaqiwYw5040t1gJddVQRPhKHMaMDEWR8KBXODycRanImbZda9AThtc6EhL2yos9pFvIV v23DwtpmJmp2DwcJoMYgJmsCvHyS2o/LpDqGh09eBwg8Uc/B85gFcbx+rtBrmUnNuRDP PRQQ== 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=S2gn6HpnuJfUqX/l+nPQZODM+z54R2CU4c0mP/sm9sI=; b=gq1X9HfdzkEsWrp4yb4fP7ZStTRz2PU4nqpRH6iJOcWkPrjgMpW8Fr7e6kFlueqT6R Je+Wymy7m1PjD1+RRwLyZ6e93jd9/uITeJAZPq36W4ZouGsuGQx8MygAa1KilJi6hX6Z KEgT4XtKsU1OkU1NWkE2FPtN//9J6zR6vqyTrb49PKrAVT4sRPNepy2sAqsFvuslJN3j nu1yOEuAoL9EYHIMzaZmnCSTzZcR2HyeYZcSgU4ipWFwOz5Fgytz8wYvadcYxtXUPehp uKZT9FRg4rJ4BKQHbtXuZKQXDFo715X5GlG/doFxacJ2r01M945H5EtjoAXy7ju5nOZd h5pQ== 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 d4si384281qkk.210.2019.04.01.09.47.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:47:59 -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-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2FA0D6697B; Mon, 1 Apr 2019 16:47:58 +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 0615828540; Mon, 1 Apr 2019 16:47:58 +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 B39D4181A000; Mon, 1 Apr 2019 16:47:57 +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 x31GldA5026744 for ; Mon, 1 Apr 2019 12:47:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id B33F35C27C; 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 49AE05C206; Mon, 1 Apr 2019 16:47:39 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:25 -0400 Message-Id: <277ec917f362a5185bb1603ff98aed3e9f54a138.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 09/12] tests: qemuxml2xml: Use struct 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.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 01 Apr 2019 16:47:58 +0000 (UTC) The qemuxml2xml testInfo is now just a subset of testQemuInfo, so it's a drop in replacement Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 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 538ccae8fd..ba622a3d2f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -25,18 +25,11 @@ enum { WHEN_BOTH = 3, }; -struct testInfo { - char *infile; - char *outfile; - - virQEMUCapsPtr qemuCaps; -}; - static int testXML2XMLActive(const void *opaque) { - const struct testInfo *info = opaque; + const struct testQemuInfo *info = opaque; return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, info->outfile, true, 0, @@ -47,7 +40,7 @@ testXML2XMLActive(const void *opaque) static int testXML2XMLInactive(const void *opaque) { - const struct testInfo *info = opaque; + const struct testQemuInfo *info = opaque; return testCompareDomXML2XMLFiles(driver.caps, driver.xmlopt, info->infile, info->outfile, false, 0, @@ -58,7 +51,7 @@ testXML2XMLInactive(const void *opaque) static int testCompareStatusXMLToXMLFiles(const void *opaque) { - const struct testInfo *data = opaque; + const struct testQemuInfo *data = opaque; virDomainObjPtr obj = NULL; char *actual = NULL; int ret = -1; @@ -95,18 +88,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque) } -static void -testInfoClear(struct testInfo *info) -{ - VIR_FREE(info->infile); - VIR_FREE(info->outfile); - - virObjectUnref(info->qemuCaps); -} - - static int -testInfoSetCommon(struct testInfo *info, +testInfoSetCommon(struct testQemuInfo *info, int gic) { if (!(info->qemuCaps = virQEMUCapsNew())) @@ -121,12 +104,12 @@ testInfoSetCommon(struct testInfo *info, return 0; error: - testInfoClear(info); + testQemuInfoClear(info); return -1; } static int -testInfoSetPaths(struct testInfo *info, +testInfoSetPaths(struct testQemuInfo *info, const char *name, int when) { @@ -155,7 +138,7 @@ testInfoSetPaths(struct testInfo *info, return 0; error: - testInfoClear(info); + testQemuInfoClear(info); return -1; } @@ -163,7 +146,7 @@ testInfoSetPaths(struct testInfo *info, static const char *statusPath = abs_srcdir "/qemustatusxml2xmldata/"; static int -testInfoSetStatusPaths(struct testInfo *info, +testInfoSetStatusPaths(struct testQemuInfo *info, const char *name) { if (virAsprintf(&info->infile, "%s%s-in.xml", statusPath, name) < 0 || @@ -173,7 +156,7 @@ testInfoSetStatusPaths(struct testInfo *info, return 0; error: - testInfoClear(info); + testQemuInfoClear(info); return -1; } @@ -185,7 +168,7 @@ mymain(void) { int ret = 0; char *fakerootdir; - struct testInfo info; + struct testQemuInfo info; virQEMUDriverConfigPtr cfg = NULL; if (VIR_STRDUP_QUIET(fakerootdir, FAKEROOTDIRTEMPLATE) < 0) { @@ -234,7 +217,7 @@ mymain(void) testXML2XMLActive, &info) < 0) \ ret = -1; \ } \ - testInfoClear(&info); \ + testQemuInfoClear(&info); \ } while (0) # define NONE QEMU_CAPS_LAST @@ -1232,7 +1215,7 @@ mymain(void) testCompareStatusXMLToXMLFiles, &info) < 0) \ ret = -1; \ \ - testInfoClear(&info); \ + testQemuInfoClear(&info); \ } while (0) 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); From patchwork Mon Apr 1 16:47:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161553 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp687926jan; Mon, 1 Apr 2019 09:48:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqyW3YOQpKl8+d8Rs58LjSW4YhSqcNQGH0YKhaDl3dckNXsHNdUEoPp8aQ4/s9qG8Vn4U/iH X-Received: by 2002:ac8:3554:: with SMTP id z20mr53870138qtb.150.1554137281290; Mon, 01 Apr 2019 09:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554137281; cv=none; d=google.com; s=arc-20160816; b=C64EExRIPc3pUEQvLANu+X8EMc+4d7GEDfRgZJAHjOVHQjmE2XqUbs9U9350gkHj64 7wvz7nx8Adpjvxn6IivFbgeKonX7DieWpd1rEtbzNdekspJ/hAPbMYFXVX0WyVt9+Wkh VgxBK+PG5PtJO0EuDRp98uUz4tpSDIbhasWcy3YI7pa4Q4cOdB2gRqoSM3uXEv2y0OJv DRBT5QSmHE4ZQBFEC19whBdXKsvZOMNWNU5QWZv3lmqFjSRIoInX5lwBauU1UQAcvu2p nGj/kLCu6JzSfU85OLRRcYGjpnPXgHB64MJWipln/8JXHMjzbkJaKo/FYD05Uy3XjOcm 67fA== 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=/EGCw53saGFhmG/d1hQ5qvQBsCud7dflzS4KlAvq+R0=; b=kbkUUHTq081pamVxXJ0vI+cCNL4upGTI6AFJW8cBv5AHKh3ENGe59FLE8BuFNOgb7B r0DgyOG/wuC0cFip6lD7skz0kHJb2eh91sFeVH9tH/6u3BXJy98hnWP/MhwpZ/b2mCX7 44bcHgkMnqrZ8x0fL0WU7BamSAmMoNARwqM3i+meQCNZc81xSo8+qnrB+sIYT/8eXAAY ikd3M1ifXkD2iMW1YjWLVn2MfDXUbgO1VjVmVVqJbdJyOG4Ldq8fwKyGSJ5cMD1RP8lv FuqlvnQMVxpe/H5V9H+O4xEhn3psM2WJPxObmJUTwPyorakWGKoTf5CDhylZyExM76JL cLOw== 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 94si4140724qtc.15.2019.04.01.09.48.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 09:48:01 -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-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE05B3086223; Mon, 1 Apr 2019 16:47:59 +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 95F885D71D; Mon, 1 Apr 2019 16:47:59 +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 58CEC3FA4C; Mon, 1 Apr 2019 16:47:59 +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 x31GleDu026762 for ; Mon, 1 Apr 2019 12:47:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id E2F8A5C25A; 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 7C80B5C28C; Mon, 1 Apr 2019 16:47:40 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:27 -0400 Message-Id: <77c18aaabd25aa26c4aa2c41cca0d7ee71f562b8.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 11/12] tests: qemuxml2xml: make GIC handling optional 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Mon, 01 Apr 2019 16:48:00 +0000 (UTC) Make all users of GIC_X use ARG_GIC explicitly, and drop the required gic parameter from DO_TEST_FULL Signed-off-by: Cole Robinson --- tests/qemuxml2xmltest.c | 85 ++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 30 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 e60c69872a..3b5314df78 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -175,11 +175,10 @@ mymain(void) cfg = virQEMUDriverGetConfig(&driver); -# define DO_TEST_FULL(name, when, gic, ...) \ +# define DO_TEST_FULL(name, when, ...) \ do { \ if (testQemuInfoSetArgs(&info, capslatest, \ - ARG_GIC, gic, \ - ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST, \ + __VA_ARGS__, \ ARG_END) < 0 || \ qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", name); \ @@ -211,7 +210,7 @@ mymain(void) # define NONE QEMU_CAPS_LAST # define DO_TEST(name, ...) \ - DO_TEST_FULL(name, WHEN_BOTH, GIC_NONE, __VA_ARGS__) + DO_TEST_FULL(name, WHEN_BOTH, ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) @@ -490,17 +489,22 @@ mymain(void) DO_TEST("blkdeviotune-max-length", NONE); DO_TEST("controller-usb-order", NONE); - DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, GIC_NONE, NONE); - DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE, GIC_NONE, NONE); - DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE, GIC_NONE, NONE); - DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE, GIC_NONE, NONE); + DO_TEST_FULL("seclabel-dynamic-baselabel", WHEN_INACTIVE, + ARG_QEMU_CAPS, QEMU_CAPS_LAST); + DO_TEST_FULL("seclabel-dynamic-override", WHEN_INACTIVE, + ARG_QEMU_CAPS, QEMU_CAPS_LAST, NONE); + DO_TEST_FULL("seclabel-dynamic-labelskip", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("seclabel-dynamic-relabel", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE); DO_TEST("seclabel-static", NONE); DO_TEST("seclabel-static-labelskip", NONE); DO_TEST("seclabel-none", NONE); DO_TEST("seclabel-dac-none", NONE); DO_TEST("seclabel-dynamic-none", NONE); DO_TEST("seclabel-device-multiple", NONE); - DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, GIC_NONE, NONE); + DO_TEST_FULL("seclabel-dynamic-none-relabel", WHEN_INACTIVE, + ARG_QEMU_CAPS, NONE); DO_TEST("numad-static-vcpu-no-numatune", NONE); DO_TEST("disk-scsi-lun-passthrough-sgio", @@ -1048,27 +1052,48 @@ mymain(void) QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, QEMU_CAPS_VNC); - DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-default-v2", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-default-v3", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-default-both", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, GIC_BOTH, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_NONE, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V2, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_V3, NONE); - DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, GIC_BOTH, NONE); + DO_TEST_FULL("aarch64-gic-none", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-none-v2", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-none-v3", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-none-both", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-none-tcg", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-default", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-default-v2", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-default-v3", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-default-both", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v2", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-v3", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_GIC, GIC_NONE, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_GIC, GIC_V2, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_GIC, GIC_V3, ARG_QEMU_CAPS, NONE); + DO_TEST_FULL("aarch64-gic-host", WHEN_BOTH, + ARG_GIC, GIC_BOTH, ARG_QEMU_CAPS, NONE); DO_TEST("memory-hotplug", NONE); DO_TEST("memory-hotplug-nonuma", NONE); From patchwork Mon Apr 1 16:47:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 161555 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp688007jan; Mon, 1 Apr 2019 09:48:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqyw5E6wvAHo1L+bEfkCTEEKkblYl+NZfRWh7E8FZ4iIHAM9EwGEwWBxAEE8Cq70ItS/4wWI X-Received: by 2002:ac8:14c:: with SMTP id f12mr55148355qtg.138.1554137285631; 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=tPPvOsitH7Yo2K4D2gTumT0Z+bGaf2EllLlUslta70eQ3du16K/zStEOm70UR3fLtA AhqEH4C1B2nO5I3E9WwGgqRGqQ6jkk5/5WdrQSDFumw6Iw091caI5xhSfI2s3L/HlyCi 88GefNDyQ91yntfDi+1vdLGt/wFih65szt8S9BeClJ6NezCeRZe2Cr5I8hcnYbgxMRWq 3Y7V4PTq8RLGSoUhCftzFwp0T+56Xi3hBPvB00vPHm9QDy+FzIWGbth/KVaZN6mej4/R mkJmLZ4vqHplxvuOaR+2vZbrHIpzHQ7z23AQHTCMgNf/lJWE5Qw7mAUwVDYB7dVGRI/3 zOoA== 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=riGoDNXotkBgdG/mQPwwQTmNXb/mGgklKxuY6ndrKww=; b=SWVI2LgVMQiVjk5oHu2dxWJhLpG+bFds3M891SvLcJXloYTZ4FzCYEmlscGQcPSTtg slMZGkdHa2ffD6tRX/v3Xt4fXgRJIS6VLLcA60H5MCFtHc0/mLV8V/raGNZndsYs3nto Y7qZWCc+WA2ULTspbfJi85VED4L/puxUnk27P2Jp99zdQ0zYDfmWsS9kJZ9smOAkdv5P CWP+Qzx9P6Mng/GcI6gPah5OpgE8f1UmaT6pnU+IPS6I4mFeLUnfKnIcXrtH8F6Aytp5 u0mz4VDTPk+q4h9cyndzmCsHBywTWfh2qU8XPoEGbUQ9+4pXB5RJsWqYVpIvVWaws1TO h4Uw== 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 m41si2812161qvg.206.2019.04.01.09.48.05 (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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 511209B303; Mon, 1 Apr 2019 16:48:04 +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 24C1A5DC1E; Mon, 1 Apr 2019 16:48:04 +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 D52673F5CD; 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 x31Glf9U026770 for ; Mon, 1 Apr 2019 12:47:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 908215C27C; Mon, 1 Apr 2019 16:47:41 +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 1C98D5C25A; Mon, 1 Apr 2019 16:47:41 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 1 Apr 2019 12:47:28 -0400 Message-Id: <6f9a1738d7d6d824c00c08191e9ff50a2784cdb6.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 12/12] tests: qemuxml2xml: Add DO_TEST_CAPS* 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 01 Apr 2019 16:48:04 +0000 (UTC) Add DO_TEST_CAPS* macros, lifted from qemuxml2argvtest. Use it on a few recently added xml2xml tests that use DO_TEST_CAPS in the argv test case. The firmware examples require breaking the symlink and creating our own test file. Also add a test for os-firmware-efi which seems to have been missed. One subtle difference compared to qemuxml2argv is output file naming. qemuxml2xml uses a system where if specially named files ${basename}-active.xml or ${basename}-inactive.xml exist, those are used as output, otherwise just ${basename}.xml is used. I'm not quite sure how to make this fit with the caps suffix naming scheme used in qemuxml2argv, where for example DO_CAPS_LATEST will always add a -latest suffix to basename. This code by default will store the output in ${basename}.xml with no -latest suffix. This makes it easier to convert DO_TEST calls to CAPS variants, because it won't require any test file rename/removal, but if we ever want to add more than one qemuxml2xml output for a single input, it will require special file naming to not collide. IMO that's not a big deal as it follows the existing -active pattern. But it's a divergence from qemuxml2argv behavior Signed-off-by: Cole Robinson --- tests/qemuxml2argvdata/vhost-vsock.xml | 2 +- .../aarch64-os-firmware-efi.xml | 32 +++++++- tests/qemuxml2xmloutdata/os-firmware-bios.xml | 69 +++++++++++++++- .../os-firmware-efi-secboot.xml | 69 +++++++++++++++- tests/qemuxml2xmloutdata/os-firmware-efi.xml | 69 +++++++++++++++- tests/qemuxml2xmltest.c | 81 +++++++------------ 6 files changed, 267 insertions(+), 55 deletions(-) mode change 120000 => 100644 tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml mode change 120000 => 100644 tests/qemuxml2xmloutdata/os-firmware-bios.xml mode change 120000 => 100644 tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml mode change 120000 => 100644 tests/qemuxml2xmloutdata/os-firmware-efi.xml -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/tests/qemuxml2argvdata/vhost-vsock.xml b/tests/qemuxml2argvdata/vhost-vsock.xml index bc550ace4e..f594c53f48 100644 --- a/tests/qemuxml2argvdata/vhost-vsock.xml +++ b/tests/qemuxml2argvdata/vhost-vsock.xml @@ -15,7 +15,7 @@ restart /usr/bin/qemu-system-x86_64 - +
diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml deleted file mode 120000 index beea6b2955..0000000000 --- a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/aarch64-os-firmware-efi.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml new file mode 100644 index 0000000000..529ce6f3c2 --- /dev/null +++ b/tests/qemuxml2xmloutdata/aarch64-os-firmware-efi.xml @@ -0,0 +1,31 @@ + + aarch64test + 496d7ea8-9739-544b-4ebd-ef08be936e8b + 1048576 + 1048576 + 1 + + hvm + /aarch64.kernel + /aarch64.initrd + earlyprintk console=ttyAMA0,115200n8 rw root=/dev/vda rootwait + /aarch64.dtb + + + + + + + + + cortex-a53 + + + destroy + restart + restart + + /usr/bin/qemu-system-aarch64 + + + diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.xml b/tests/qemuxml2xmloutdata/os-firmware-bios.xml deleted file mode 120000 index 3d36d5df68..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-bios.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-bios.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/os-firmware-bios.xml b/tests/qemuxml2xmloutdata/os-firmware-bios.xml new file mode 100644 index 0000000000..63886666dd --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-bios.xml @@ -0,0 +1,68 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + /var/lib/libvirt/qemu/nvram/fedora_VARS.fd + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml deleted file mode 120000 index 93e184e2d2..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-efi-secboot.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml new file mode 100644 index 0000000000..a285e06334 --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-efi-secboot.xml @@ -0,0 +1,68 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + /var/lib/libvirt/qemu/nvram/fedora_VARS.fd + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.xml b/tests/qemuxml2xmloutdata/os-firmware-efi.xml deleted file mode 120000 index 15cfad1ea0..0000000000 --- a/tests/qemuxml2xmloutdata/os-firmware-efi.xml +++ /dev/null @@ -1 +0,0 @@ -../qemuxml2argvdata/os-firmware-efi.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/os-firmware-efi.xml b/tests/qemuxml2xmloutdata/os-firmware-efi.xml new file mode 100644 index 0000000000..46a7b1b780 --- /dev/null +++ b/tests/qemuxml2xmloutdata/os-firmware-efi.xml @@ -0,0 +1,68 @@ + + fedora + 63840878-0deb-4095-97e6-fc444d9bc9fa + 8192 + 8192 + 1 + + hvm + + /var/lib/libvirt/qemu/nvram/fedora_VARS.fd + + + + + + + + + + destroy + restart + restart + + + + + + /usr/bin/qemu-system-x86_64 + +
+ + + +
+ + + +
+ + + +
+ + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 3b5314df78..6ae3cbb11f 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -91,7 +91,8 @@ testCompareStatusXMLToXMLFiles(const void *opaque) static int testInfoSetPaths(struct testQemuInfo *info, const char *name, - int when) + int when, + const char *suffix) { VIR_FREE(info->infile); VIR_FREE(info->outfile); @@ -101,9 +102,10 @@ testInfoSetPaths(struct testQemuInfo *info, goto error; if (virAsprintf(&info->outfile, - "%s/qemuxml2xmloutdata/%s-%s.xml", + "%s/qemuxml2xmloutdata/%s-%s%s.xml", abs_srcdir, name, - when == WHEN_ACTIVE ? "active" : "inactive") < 0) + when == WHEN_ACTIVE ? "active" : "inactive", + suffix) < 0) goto error; if (!virFileExists(info->outfile)) { @@ -175,7 +177,7 @@ mymain(void) cfg = virQEMUDriverGetConfig(&driver); -# define DO_TEST_FULL(name, when, ...) \ +# define DO_TEST_INTERNAL(name, suffix, when, ...) \ do { \ if (testQemuInfoSetArgs(&info, capslatest, \ __VA_ARGS__, \ @@ -186,7 +188,7 @@ mymain(void) } \ \ if (when & WHEN_INACTIVE) { \ - if (testInfoSetPaths(&info, name, WHEN_INACTIVE) < 0) { \ + if (testInfoSetPaths(&info, name, WHEN_INACTIVE, suffix) < 0) { \ VIR_TEST_DEBUG("Failed to generate inactive paths for '%s'", name); \ return -1; \ } \ @@ -196,7 +198,7 @@ mymain(void) } \ \ if (when & WHEN_ACTIVE) { \ - if (testInfoSetPaths(&info, name, WHEN_ACTIVE) < 0) { \ + if (testInfoSetPaths(&info, name, WHEN_ACTIVE, suffix) < 0) { \ VIR_TEST_DEBUG("Failed to generate active paths for '%s'", name); \ return -1; \ } \ @@ -209,9 +211,26 @@ mymain(void) # define NONE QEMU_CAPS_LAST +# define DO_TEST_FULL(name, when, ...) \ + DO_TEST_INTERNAL(name, "", when, __VA_ARGS__) + # define DO_TEST(name, ...) \ DO_TEST_FULL(name, WHEN_BOTH, ARG_QEMU_CAPS, __VA_ARGS__, QEMU_CAPS_LAST) +# define DO_TEST_CAPS_INTERNAL(name, arch, ver, ...) \ + DO_TEST_INTERNAL(name, "." arch "-" ver, WHEN_BOTH, \ + ARG_CAPS_ARCH, arch, \ + ARG_CAPS_VER, ver, \ + __VA_ARGS__) + +# define DO_TEST_CAPS_ARCH_LATEST_FULL(name, arch, ...) \ + 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) + +# define DO_TEST_CAPS_LATEST(name) \ + DO_TEST_CAPS_ARCH_LATEST(name, "x86_64") /* Unset or set all envvars here that are copied in qemudBuildCommandLine @@ -979,36 +998,14 @@ mymain(void) DO_TEST("smbios", NONE); DO_TEST("smbios-multiple-type2", NONE); - DO_TEST("os-firmware-bios", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); - DO_TEST("os-firmware-efi", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); - DO_TEST("os-firmware-efi-secboot", - QEMU_CAPS_DEVICE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_DMI_TO_PCI_BRIDGE, - QEMU_CAPS_DEVICE_IOH3420, - QEMU_CAPS_ICH9_AHCI, - QEMU_CAPS_ICH9_USB_EHCI1, - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_QXL); + DO_TEST_CAPS_LATEST("os-firmware-bios"); + DO_TEST_CAPS_LATEST("os-firmware-efi"); + DO_TEST_CAPS_LATEST("os-firmware-efi-secboot"); DO_TEST("aarch64-aavmf-virtio-mmio", QEMU_CAPS_DEVICE_VIRTIO_MMIO, QEMU_CAPS_DEVICE_VIRTIO_RNG, QEMU_CAPS_OBJECT_RNG_RANDOM); - DO_TEST("aarch64-os-firmware-efi", - QEMU_CAPS_DEVICE_VIRTIO_MMIO); + DO_TEST_CAPS_ARCH_LATEST("aarch64-os-firmware-efi", "aarch64"); DO_TEST("aarch64-virtio-pci-default", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, QEMU_CAPS_DEVICE_VIRTIO_MMIO, @@ -1256,24 +1253,8 @@ mymain(void) DO_TEST("riscv64-virt-pci", QEMU_CAPS_OBJECT_GPEX); - DO_TEST("virtio-transitional", - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, - QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - QEMU_CAPS_DEVICE_VHOST_VSOCK, - QEMU_CAPS_VIRTIO_INPUT_HOST, - QEMU_CAPS_VIRTIO_SCSI); - DO_TEST("virtio-non-transitional", - QEMU_CAPS_DEVICE_VIDEO_PRIMARY, - QEMU_CAPS_DEVICE_PCIE_PCI_BRIDGE, - QEMU_CAPS_DEVICE_PCIE_ROOT_PORT, - QEMU_CAPS_DEVICE_VIRTIO_RNG, - QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY, - QEMU_CAPS_DEVICE_VHOST_VSOCK, - QEMU_CAPS_VIRTIO_INPUT_HOST, - QEMU_CAPS_VIRTIO_SCSI); + DO_TEST_CAPS_LATEST("virtio-transitional"); + DO_TEST_CAPS_LATEST("virtio-non-transitional"); if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL) virFileDeleteTree(fakerootdir);