From patchwork Thu Apr 21 17:50:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 66403 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp287696qge; Thu, 21 Apr 2016 10:53:49 -0700 (PDT) X-Received: by 10.55.192.65 with SMTP id o62mr1172540qki.54.1461261229021; Thu, 21 Apr 2016 10:53:49 -0700 (PDT) Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com. [209.132.183.24]) by mx.google.com with ESMTPS id d19si1010649qkg.147.2016.04.21.10.53.47 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 21 Apr 2016 10:53:49 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.24 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 mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3LHpD2R028956; Thu, 21 Apr 2016 13:51:13 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3LHoRVr019335 for ; Thu, 21 Apr 2016 13:50:27 -0400 Received: from colepc.redhat.com (ovpn-113-44.phx2.redhat.com [10.3.113.44]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3LHoOTM009902; Thu, 21 Apr 2016 13:50:27 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Thu, 21 Apr 2016 13:50:19 -0400 Message-Id: <7fb0b265c540601ac1d7e5c39ac92f60e548290f.1461260748.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] tests: remove 'reconnect' and 'statstest' 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 These old tests expect to run against a real xen connection via xend running on the host. Our intentions for the test suite are that it doesn't require interacting with any specific host resources, so these don't really belong here. --- tests/Makefile.am | 12 +--- tests/reconnect.c | 71 ------------------ tests/statstest.c | 210 ------------------------------------------------------ 3 files changed, 2 insertions(+), 291 deletions(-) delete mode 100644 tests/reconnect.c delete mode 100644 tests/statstest.c -- 2.7.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/tests/Makefile.am b/tests/Makefile.am index a803e84..8cf53bf 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -243,7 +243,7 @@ ssh_LDADD = $(COVERAGE_LDFLAGS) if WITH_XEN test_programs += xml2sexprtest sexpr2xmltest \ - xmconfigtest xencapstest statstest reconnect + xmconfigtest xencapstest endif WITH_XEN if WITH_LIBXL @@ -504,17 +504,9 @@ xencapstest_SOURCES = \ xencapstest.c testutils.h testutils.c xencapstest_LDADD = $(xen_LDADDS) -reconnect_SOURCES = \ - reconnect.c testutils.h testutils.c -reconnect_LDADD = $(LDADDS) - -statstest_SOURCES = \ - statstest.c testutils.h testutils.c -statstest_LDADD = $(xen_LDADDS) - else ! WITH_XEN EXTRA_DIST += xml2sexprtest.c sexpr2xmltest.c xmconfigtest.c \ - xencapstest.c reconnect.c \ + xencapstest.c \ testutilsxen.c testutilsxen.h endif ! WITH_XEN diff --git a/tests/reconnect.c b/tests/reconnect.c deleted file mode 100644 index f0779ad..0000000 --- a/tests/reconnect.c +++ /dev/null @@ -1,71 +0,0 @@ -#include - -#include -#include -#include - -#include "internal.h" -#include "testutils.h" -#include "vircommand.h" - -static int -mymain(void) -{ - int id = 0; - bool ro = false; - virConnectPtr conn; - virDomainPtr dom; - virCommandPtr cmd; - struct utsname ut; - - /* Skip test if xend is not running. Calling xend on a non-xen - kernel causes some versions of xend to issue a crash report, so - we first probe uname results. */ - uname(&ut); - if (strstr(ut.release, "xen") == NULL) - return EXIT_AM_SKIP; - cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL); - if (virCommandRun(cmd, NULL) < 0) { - virCommandFree(cmd); - return EXIT_AM_SKIP; - } - virCommandFree(cmd); - - virtTestQuiesceLibvirtErrors(true); - - conn = virConnectOpen(NULL); - if (conn == NULL) { - ro = true; - conn = virConnectOpenReadOnly(NULL); - } - if (conn == NULL) { - fprintf(stderr, "First virConnectOpen() failed\n"); - return EXIT_FAILURE; - } - dom = virDomainLookupByID(conn, id); - if (dom == NULL) { - fprintf(stderr, "First lookup for domain %d failed\n", id); - return EXIT_FAILURE; - } - virDomainFree(dom); - virConnectClose(conn); - if (ro) - conn = virConnectOpenReadOnly(NULL); - else - conn = virConnectOpen(NULL); - if (conn == NULL) { - fprintf(stderr, "Second virConnectOpen() failed\n"); - return EXIT_FAILURE; - } - dom = virDomainLookupByID(conn, id); - if (dom == NULL) { - fprintf(stderr, "Second lookup for domain %d failed\n", id); - return EXIT_FAILURE; - } - virDomainFree(dom); - virConnectClose(conn); - - return EXIT_SUCCESS; -} - -VIRT_TEST_MAIN(mymain) diff --git a/tests/statstest.c b/tests/statstest.c deleted file mode 100644 index 46e5560..0000000 --- a/tests/statstest.c +++ /dev/null @@ -1,210 +0,0 @@ -#include - -#include -#include -#include -#include - -#include "virstats.h" -#include "internal.h" -#include "xen/block_stats.h" -#include "testutils.h" -#include "vircommand.h" - -static int testDevice(const char *path, int expect) -{ - int actual = xenLinuxDomainDeviceID(1, path); - - if (actual == expect) { - return 0; - } else { - VIR_TEST_DEBUG("Expect %-6d Actual %-6d\n", expect, actual); - return -1; - } -} - -struct testInfo -{ - const char *dev; - int num; -}; - -static int testDeviceHelper(const void *data) -{ - const struct testInfo *info = data; - return testDevice(info->dev, info->num); -} - -static int -mymain(void) -{ - int ret = 0; - virCommandPtr cmd; - struct utsname ut; - - /* Skip test if xend is not running. Calling xend on a non-xen - kernel causes some versions of xend to issue a crash report, so - we first probe uname results. */ - uname(&ut); - if (strstr(ut.release, "xen") == NULL) - return EXIT_AM_SKIP; - cmd = virCommandNewArgList("/usr/sbin/xend", "status", NULL); - if (virCommandRun(cmd, NULL) < 0) { - virCommandFree(cmd); - return EXIT_AM_SKIP; - } - virCommandFree(cmd); - - /* Some of our tests deliberately test failure cases, so - * register a handler to stop error messages cluttering - * up display - */ - virtTestQuiesceLibvirtErrors(false); - -#define DO_TEST(dev, num) \ - do { \ - struct testInfo info = { dev, num }; \ - if (virtTestRun("Device " dev " -> " # num, \ - testDeviceHelper, &info) < 0) \ - ret = -1; \ - } while (0) - - /******************************** - * Xen paravirt disks - ********************************/ - - DO_TEST("xvd", -1); - - /* first valid disk */ - DO_TEST("xvda", 51712); - DO_TEST("xvda1", 51713); - DO_TEST("xvda15", 51727); - /* Last non-extended disk */ - DO_TEST("xvdp", 51952); - DO_TEST("xvdp1", 51953); - DO_TEST("xvdp15", 51967); - - /* First extended disk */ - DO_TEST("xvdq", 268439552); - DO_TEST("xvdq1", 268439553); - DO_TEST("xvdq15", 268439567); - /* Last extended disk */ - DO_TEST("xvdiz", 268501760); - DO_TEST("xvdiz1", 268501761); - DO_TEST("xvdiz15", 268501775); - - /* Disk letter too large */ - DO_TEST("xvdja", -1); - - /* missing disk letter */ - DO_TEST("xvd1", -1); - /* partition too large */ - DO_TEST("xvda16", -1); - /* partition too small */ - DO_TEST("xvda0", -1); - /* leading zeros */ - DO_TEST("xvda01", -1); - /* leading + */ - DO_TEST("xvda+1", -1); - /* leading - */ - DO_TEST("xvda-1", -1); - - /******************************** - * IDE disks - ********************************/ - - DO_TEST("hd", -1); - - /* first numbered disk */ - DO_TEST("hda", 768); - DO_TEST("hda1", 769); - DO_TEST("hda63", 831); - /* second numbered disk */ - DO_TEST("hdb", 832); - DO_TEST("hdb1", 833); - DO_TEST("hdb63", 895); - /* third numbered disk */ - DO_TEST("hdc", 5632); - DO_TEST("hdc1", 5633); - DO_TEST("hdc63", 5695); - /* fourth numbered disk */ - DO_TEST("hdd", 5696); - DO_TEST("hdd1", 5697); - DO_TEST("hdd63", 5759); - /* last valid disk */ - DO_TEST("hdt", 23360); - DO_TEST("hdt1", 23361); - DO_TEST("hdt63", 23423); - - /* Disk letter to large */ - DO_TEST("hdu", -1); - /* missing disk letter */ - DO_TEST("hd1", -1); - /* partition too large */ - DO_TEST("hda64", -1); - /* partition too small */ - DO_TEST("hda0", -1); - - - - /******************************** - * SCSI disks - ********************************/ - - DO_TEST("sd", -1); - - /* first valid disk */ - DO_TEST("sda", 2048); - DO_TEST("sda1", 2049); - DO_TEST("sda15", 2063); - /* last valid disk of first SCSI major number */ - DO_TEST("sdp", 2288); - DO_TEST("sdp1", 2289); - DO_TEST("sdp15", 2303); - /* first valid disk of second SCSI major number */ - DO_TEST("sdq", 16640); - DO_TEST("sdq1", 16641); - DO_TEST("sdq15", 16655); - /* last valid single letter disk */ - DO_TEST("sdz", 16784); - DO_TEST("sdz1", 16785); - DO_TEST("sdz15", 16799); - /* first valid dual letter disk */ - DO_TEST("sdaa", 16800); - DO_TEST("sdaa1", 16801); - DO_TEST("sdaa15", 16815); - /* second valid dual letter disk */ - DO_TEST("sdab", 16816); - DO_TEST("sdab1", 16817); - DO_TEST("sdab15", 16831); - /* first letter of second sequence of dual letter disk */ - DO_TEST("sdba", 17216); - DO_TEST("sdba1", 17217); - DO_TEST("sdba15", 17231); - /* last valid dual letter disk */ - DO_TEST("sdiv", 34800); - DO_TEST("sdiv1", 34801); - DO_TEST("sdiv15", 34815); - - /* Disk letter too large */ - DO_TEST("sdix", -1); - /* missing disk letter */ - DO_TEST("sd1", -1); - /* partition too large */ - DO_TEST("sda16", -1); - /* partition too small */ - DO_TEST("sda0", -1); - - - /* Path stripping */ - DO_TEST("/dev", -1); - DO_TEST("/dev/", -1); - DO_TEST("/dev/xvd", -1); - DO_TEST("/dev/xvda", 51712); - DO_TEST("/dev/xvda1", 51713); - DO_TEST("/dev/xvda15", 51727); - - return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; -} - -VIRT_TEST_MAIN(mymain)