From patchwork Fri Apr 8 17:49:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 65422 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp206246lbl; Fri, 8 Apr 2016 10:52:22 -0700 (PDT) X-Received: by 10.140.97.227 with SMTP id m90mr13005904qge.60.1460137942065; Fri, 08 Apr 2016 10:52:22 -0700 (PDT) Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com. [209.132.183.39]) by mx.google.com with ESMTPS id w82si10717486qka.3.2016.04.08.10.52.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Apr 2016 10:52:22 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u38HnWnd058865; Fri, 8 Apr 2016 13:49:32 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u38Hn6va013487 for ; Fri, 8 Apr 2016 13:49:06 -0400 Received: from colepc.redhat.com (ovpn-113-53.phx2.redhat.com [10.3.113.53]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u38Hn3Gi017562; Fri, 8 Apr 2016 13:49:05 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Fri, 8 Apr 2016 13:49:00 -0400 Message-Id: <154ca3ee512b467765f1b3119bea94695f11ad02.1460137366.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] test: genericxml2xml: test graphics listen= compat 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: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com * Add a test for listen=XXX and collision error * Add an explicit test for listen=XXX duplicated to We implicitly test it elsewhere but I figure it's better to be explicit, and this test case can be extended in the future for additional listen back compat if/when we support syntax --- The latter test case I added to try and exercise the potential crash that Jan pointed out here: https://www.redhat.com/archives/libvir-list/2016-April/msg00241.html That patch was fixed before committing but I was still curious... the test case doesn't tickle the crash? STREQ_NULLABLE seems to avoid it somehow for address=NULL, yet if I try to printf address->address it understandably crashes. Oh well :) ...eneric-graphics-listen-back-compat-mismatch.xml | 30 ++++++++++++++++++++++ .../generic-graphics-listen-back-compat.xml | 28 ++++++++++++++++++++ .../generic-graphics-listen-back-compat.xml | 30 ++++++++++++++++++++++ tests/genericxml2xmltest.c | 16 ++++++++---- 4 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 tests/genericxml2xmlindata/generic-graphics-listen-back-compat-mismatch.xml create mode 100644 tests/genericxml2xmlindata/generic-graphics-listen-back-compat.xml create mode 100644 tests/genericxml2xmloutdata/generic-graphics-listen-back-compat.xml -- 2.5.5 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/tests/genericxml2xmlindata/generic-graphics-listen-back-compat-mismatch.xml b/tests/genericxml2xmlindata/generic-graphics-listen-back-compat-mismatch.xml new file mode 100644 index 0000000..eee3fed --- /dev/null +++ b/tests/genericxml2xmlindata/generic-graphics-listen-back-compat-mismatch.xml @@ -0,0 +1,30 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + + + + + + + + + diff --git a/tests/genericxml2xmlindata/generic-graphics-listen-back-compat.xml b/tests/genericxml2xmlindata/generic-graphics-listen-back-compat.xml new file mode 100644 index 0000000..c60fb6e --- /dev/null +++ b/tests/genericxml2xmlindata/generic-graphics-listen-back-compat.xml @@ -0,0 +1,28 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + + + + + + + diff --git a/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat.xml b/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat.xml new file mode 100644 index 0000000..aa00d34 --- /dev/null +++ b/tests/genericxml2xmloutdata/generic-graphics-listen-back-compat.xml @@ -0,0 +1,30 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + + + + + + + + + + diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index 7d504db..05563fb 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -21,6 +21,7 @@ struct testInfo { const char *name; int different; bool inactive_only; + testCompareDomXML2XMLResult expectResult; }; static int @@ -40,7 +41,7 @@ testCompareXMLToXMLHelper(const void *data) ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in, info->different ? xml_out : xml_in, !info->inactive_only, NULL, NULL, 0, - TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS); + info->expectResult); cleanup: VIR_FREE(xml_in); VIR_FREE(xml_out); @@ -59,22 +60,27 @@ mymain(void) if (!(xmlopt = virTestGenericDomainXMLConfInit())) return EXIT_FAILURE; -#define DO_TEST_FULL(name, is_different, inactive) \ +#define DO_TEST_FULL(name, is_different, inactive, expectResult) \ do { \ - const struct testInfo info = {name, is_different, inactive}; \ + const struct testInfo info = {name, is_different, inactive, \ + expectResult}; \ if (virtTestRun("GENERIC XML-2-XML " name, \ testCompareXMLToXMLHelper, &info) < 0) \ ret = -1; \ } while (0) #define DO_TEST(name) \ - DO_TEST_FULL(name, 0, false) + DO_TEST_FULL(name, 0, false, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) #define DO_TEST_DIFFERENT(name) \ - DO_TEST_FULL(name, 1, false) + DO_TEST_FULL(name, 1, false, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS) DO_TEST_DIFFERENT("disk-virtio"); + DO_TEST_DIFFERENT("graphics-listen-back-compat"); + DO_TEST_FULL("graphics-listen-back-compat-mismatch", 0, false, + TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE); + virObjectUnref(caps); virObjectUnref(xmlopt);