summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Fehlig <jfehlig@suse.com>2015-01-09 15:29:07 -0700
committerJim Fehlig <jfehlig@suse.com>2015-01-12 10:15:09 -0700
commitcb4befc7483eafecdacf9bc5ea5f36e2f4d5d63d (patch)
treeba507def2ed495eb15feb67fff59eb5e8ced3f58
parent4d77c136f8285ea6e7de4c92be2a2bb9b6f6596a (diff)
downloadlibvirt-cb4befc7483eafecdacf9bc5ea5f36e2f4d5d63d.tar.gz
Revert "tests: Tests for the xen-xl parser"
This reverts commit 6b818d3b09f4e74ac2ea1d4020896be1e6871867. Signed-off-by: Jim Fehlig <jfehlig@suse.com>
-rw-r--r--tests/Makefile.am9
-rw-r--r--tests/testutilsxen.c50
-rw-r--r--tests/testutilsxen.h9
-rw-r--r--tests/xlconfigdata/test-new-disk.cfg26
-rw-r--r--tests/xlconfigdata/test-new-disk.xml51
-rw-r--r--tests/xlconfigdata/test-spice.cfg32
-rw-r--r--tests/xlconfigdata/test-spice.xml45
-rw-r--r--tests/xlconfigtest.c224
8 files changed, 2 insertions, 444 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index af85335b70..e9418ea74e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -138,7 +138,6 @@ EXTRA_DIST = \
vmx2xmldata \
xencapsdata \
xmconfigdata \
- xlconfigdata \
xml2sexprdata \
xml2vmxdata \
vmwareverdata \
@@ -226,8 +225,7 @@ ssh_LDADD = $(COVERAGE_LDFLAGS)
if WITH_XEN
test_programs += xml2sexprtest sexpr2xmltest \
- xmconfigtest xencapstest statstest reconnect \
- xlconfigtest
+ xmconfigtest xencapstest statstest reconnect
endif WITH_XEN
if WITH_QEMU
test_programs += qemuxml2argvtest qemuxml2xmltest qemuxmlnstest \
@@ -479,11 +477,6 @@ sexpr2xmltest_SOURCES = \
testutils.c testutils.h
sexpr2xmltest_LDADD = $(xen_LDADDS)
-xlconfigtest_SOURCES = \
- xlconfigtest.c testutilsxen.c testutilsxen.h \
- testutils.c testutils.h
-xlconfigtest_LDADD =$(xen_LDADDS)
-
xmconfigtest_SOURCES = \
xmconfigtest.c testutilsxen.c testutilsxen.h \
testutils.c testutils.h
diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c
index df1d1243b2..a50a8a2af7 100644
--- a/tests/testutilsxen.c
+++ b/tests/testutilsxen.c
@@ -69,53 +69,3 @@ virCapsPtr testXenCapsInit(void)
virObjectUnref(caps);
return NULL;
}
-
-
-virCapsPtr
-testXLInitCaps(void)
-{
- virCapsPtr caps;
- virCapsGuestPtr guest;
- virCapsGuestMachinePtr *machines;
- int nmachines;
- static const char *const x86_machines[] = {
- "xenfv"
- };
- static const char *const xen_machines[] = {
- "xenpv"
- };
-
- if ((caps = virCapabilitiesNew(virArchFromHost(),
- false, false)) == NULL)
- return NULL;
- nmachines = ARRAY_CARDINALITY(x86_machines);
- if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
- goto cleanup;
- if ((guest = virCapabilitiesAddGuest(caps, "hvm", VIR_ARCH_X86_64,
- "/usr/lib/xen/bin/qemu-dm", NULL,
- nmachines, machines)) == NULL)
- goto cleanup;
- machines = NULL;
- if (virCapabilitiesAddGuestDomain(guest, "xen", NULL,
- NULL, 0, NULL) == NULL)
- goto cleanup;
- nmachines = ARRAY_CARDINALITY(xen_machines);
- if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
- goto cleanup;
-
- if ((guest = virCapabilitiesAddGuest(caps, "xen", VIR_ARCH_X86_64,
- "/usr/lib/xen/bin/qemu-dm", NULL,
- nmachines, machines)) == NULL)
- goto cleanup;
- machines = NULL;
-
- if (virCapabilitiesAddGuestDomain(guest, "xen", NULL,
- NULL, 0, NULL) == NULL)
- goto cleanup;
- return caps;
-
- cleanup:
- virCapabilitiesFreeMachines(machines, nmachines);
- virObjectUnref(caps);
- return NULL;
-}
diff --git a/tests/testutilsxen.h b/tests/testutilsxen.h
index c78350d2d6..54155e5e76 100644
--- a/tests/testutilsxen.h
+++ b/tests/testutilsxen.h
@@ -1,10 +1,3 @@
-#ifndef _TESTUTILSXEN_H_
-# define _TESTUTILSXEN_H_
-
-# include "capabilities.h"
+#include "capabilities.h"
virCapsPtr testXenCapsInit(void);
-
-virCapsPtr testXLInitCaps(void);
-
-#endif /* _TESTUTILSXEN_H_ */
diff --git a/tests/xlconfigdata/test-new-disk.cfg b/tests/xlconfigdata/test-new-disk.cfg
deleted file mode 100644
index afc0a462d9..0000000000
--- a/tests/xlconfigdata/test-new-disk.cfg
+++ /dev/null
@@ -1,26 +0,0 @@
-name = "XenGuest2"
-uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
-maxmem = 579
-memory = 394
-vcpus = 1
-builder = "hvm"
-kernel = "/usr/lib/xen/boot/hvmloader"
-boot = "d"
-pae = 1
-acpi = 1
-apic = 1
-hap = 0
-viridian = 0
-localtime = 0
-on_poweroff = "destroy"
-on_reboot = "restart"
-on_crash = "restart"
-device_model = "/usr/lib/xen/bin/qemu-dm"
-sdl = 0
-vnc = 1
-vncunused = 1
-vnclisten = "127.0.0.1"
-vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000,type=ioemu" ]
-parallel = "none"
-serial = "none"
-disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,", "/var/lib/libvirt/images/XenGuest2-home,qcow2,hdb,w,", "/root/boot.iso,raw,hdc,r,devtype=cdrom" ]
diff --git a/tests/xlconfigdata/test-new-disk.xml b/tests/xlconfigdata/test-new-disk.xml
deleted file mode 100644
index 1c96a62e54..0000000000
--- a/tests/xlconfigdata/test-new-disk.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<domain type='xen'>
- <name>XenGuest2</name>
- <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>592896</memory>
- <currentMemory unit='KiB'>403456</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='xenfv'>hvm</type>
- <loader type='rom'>/usr/lib/xen/boot/hvmloader</loader>
- <boot dev='cdrom'/>
- </os>
- <features>
- <acpi/>
- <apic/>
- <pae/>
- </features>
- <clock offset='utc' adjustment='reset'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>restart</on_crash>
- <devices>
- <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
- <disk type='block' device='disk'>
- <driver name='phy' type='raw'/>
- <source dev='/dev/HostVG/XenGuest2'/>
- <target dev='hda' bus='ide'/>
- </disk>
- <disk type='file' device='disk'>
- <driver name='qemu' type='qcow2'/>
- <source file='/var/lib/libvirt/images/XenGuest2-home'/>
- <target dev='hdb' bus='ide'/>
- </disk>
- <disk type='file' device='cdrom'>
- <driver name='qemu' type='raw'/>
- <source file='/root/boot.iso'/>
- <target dev='hdc' bus='ide'/>
- <readonly/>
- </disk>
- <interface type='bridge'>
- <mac address='00:16:3e:66:92:9c'/>
- <source bridge='xenbr1'/>
- <script path='vif-bridge'/>
- <model type='e1000'/>
- </interface>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
- <listen type='address' address='127.0.0.1'/>
- </graphics>
- </devices>
-</domain>
diff --git a/tests/xlconfigdata/test-spice.cfg b/tests/xlconfigdata/test-spice.cfg
deleted file mode 100644
index f7aa55c125..0000000000
--- a/tests/xlconfigdata/test-spice.cfg
+++ /dev/null
@@ -1,32 +0,0 @@
-name = "XenGuest2"
-uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
-maxmem = 579
-memory = 394
-vcpus = 1
-builder = "hvm"
-kernel = "/usr/lib/xen/boot/hvmloader"
-boot = "d"
-pae = 1
-acpi = 1
-apic = 1
-hap = 0
-viridian = 0
-rtc_timeoffset = 0
-localtime = 1
-on_poweroff = "destroy"
-on_reboot = "restart"
-on_crash = "restart"
-device_model = "/usr/lib/xen/bin/qemu-dm"
-vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ]
-parallel = "none"
-serial = "none"
-disk = [ "/dev/HostVG/XenGuest2,raw,hda,w,", "/root/boot.iso,raw,hdc,w," ]
-sdl = 0
-vnc = 0
-spice = 1
-spicehost = "127.0.0.1"
-spiceport = 590
-spicetls_port = 500
-spicedisable_ticketing = 1
-spicepasswd = "thebeast"
-spiceagent_mouse = 0
diff --git a/tests/xlconfigdata/test-spice.xml b/tests/xlconfigdata/test-spice.xml
deleted file mode 100644
index 1e3f78d1ca..0000000000
--- a/tests/xlconfigdata/test-spice.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<domain type='xen'>
- <name>XenGuest2</name>
- <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
- <memory unit='KiB'>592896</memory>
- <currentMemory unit='KiB'>403456</currentMemory>
- <vcpu placement='static'>1</vcpu>
- <os>
- <type arch='x86_64' machine='xenfv'>hvm</type>
- <loader>/usr/lib/xen/boot/hvmloader</loader>
- <boot dev='cdrom'/>
- </os>
- <features>
- <acpi/>
- <apic/>
- <pae/>
- </features>
- <clock offset='variable' adjustment='0' basis='localtime'/>
- <on_poweroff>destroy</on_poweroff>
- <on_reboot>restart</on_reboot>
- <on_crash>restart</on_crash>
- <devices>
- <emulator>/usr/lib/xen/bin/qemu-dm</emulator>
- <disk type='block' device='disk'>
- <driver name='phy' type='raw'/>
- <source dev='/dev/HostVG/XenGuest2'/>
- <target dev='hda' bus='ide'/>
- </disk>
- <disk type='block' device='disk'>
- <driver name='phy' type='raw'/>
- <source dev='/root/boot.iso'/>
- <target dev='hdc' bus='ide'/>
- </disk>
- <interface type='bridge'>
- <mac address='00:16:3e:66:92:9c'/>
- <source bridge='xenbr1'/>
- <script path='vif-bridge'/>
- <model type='e1000'/>
- </interface>
- <input type='mouse' bus='ps2'/>
- <input type='keyboard' bus='ps2'/>
- <graphics type='spice' port='590' tlsPort='500' autoport='no' listen='127.0.0.1' passwd='thebeast'>
- <listen type='address' address='127.0.0.1'/>
- </graphics>
- </devices>
-</domain>
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
deleted file mode 100644
index b966c15ae0..0000000000
--- a/tests/xlconfigtest.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * xlconfigtest.c: Test backend for xl_internal config file handling
- *
- * Copyright (C) 2007, 2010-2011, 2014 Red Hat, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see
- * <http://www.gnu.org/licenses/>.
- *
- * Author: Daniel P. Berrange <berrange@redhat.com>
- * Author: Kiarie Kahurani <davidkiarie4@gmail.com>
- *
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
-#include "internal.h"
-#include "datatypes.h"
-#include "xenconfig/xen_xl.h"
-#include "viralloc.h"
-#include "virstring.h"
-#include "testutils.h"
-#include "testutilsxen.h"
-#include "xen/xen_driver.h"
-
-#define VIR_FROM_THIS VIR_FROM_NONE
-
-static virCapsPtr caps;
-static virDomainXMLOptionPtr xmlopt;
-/*
- * parses the xml, creates a domain def and compare with equivalent xm config
- */
-static int
-testCompareParseXML(const char *xmcfg, const char *xml, int xendConfigVersion)
-{
- char *xmlData = NULL;
- char *xmcfgData = NULL;
- char *gotxmcfgData = NULL;
- virConfPtr conf = NULL;
- virConnectPtr conn = NULL;
- int wrote = 4096;
- int ret = -1;
- virDomainDefPtr def = NULL;
-
- if (VIR_ALLOC_N(gotxmcfgData, wrote) < 0)
- goto fail;
-
- conn = virGetConnect();
- if (!conn) goto fail;
-
- if (virtTestLoadFile(xml, &xmlData) < 0)
- goto fail;
-
- if (virtTestLoadFile(xmcfg, &xmcfgData) < 0)
- goto fail;
-
- if (!(def = virDomainDefParseString(xmlData, caps, xmlopt,
- 1 << VIR_DOMAIN_VIRT_XEN,
- VIR_DOMAIN_XML_INACTIVE)))
- goto fail;
-
- if (!virDomainDefCheckABIStability(def, def)) {
- fprintf(stderr, "ABI stability check failed on %s", xml);
- goto fail;
- }
-
- if (!(conf = xenFormatXL(def, conn, xendConfigVersion)))
- goto fail;
-
- if (virConfWriteMem(gotxmcfgData, &wrote, conf) < 0)
- goto fail;
- gotxmcfgData[wrote] = '\0';
-
- if (STRNEQ(xmcfgData, gotxmcfgData)) {
- virtTestDifference(stderr, xmcfgData, gotxmcfgData);
- goto fail;
- }
-
- ret = 0;
-
- fail:
- VIR_FREE(xmlData);
- VIR_FREE(xmcfgData);
- VIR_FREE(gotxmcfgData);
- if (conf)
- virConfFree(conf);
- virDomainDefFree(def);
- virObjectUnref(conn);
-
- return ret;
-}
-/*
- * parses the xl config, develops domain def and compares with equivalent xm config
- */
-static int
-testCompareFormatXML(const char *xmcfg, const char *xml, int xendConfigVersion)
-{
- char *xmlData = NULL;
- char *xmcfgData = NULL;
- char *gotxml = NULL;
- virConfPtr conf = NULL;
- int ret = -1;
- virConnectPtr conn;
- virDomainDefPtr def = NULL;
-
- conn = virGetConnect();
- if (!conn) goto fail;
-
- if (virtTestLoadFile(xml, &xmlData) < 0)
- goto fail;
-
- if (virtTestLoadFile(xmcfg, &xmcfgData) < 0)
- goto fail;
-
- if (!(conf = virConfReadMem(xmcfgData, strlen(xmcfgData), 0)))
- goto fail;
-
- if (!(def = xenParseXL(conf, caps, xendConfigVersion)))
- goto fail;
-
- if (!(gotxml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE |
- VIR_DOMAIN_XML_SECURE)))
- goto fail;
-
- if (STRNEQ(xmlData, gotxml)) {
- virtTestDifference(stderr, xmlData, gotxml);
- goto fail;
- }
-
- ret = 0;
-
- fail:
- if (conf)
- virConfFree(conf);
- VIR_FREE(xmlData);
- VIR_FREE(xmcfgData);
- VIR_FREE(gotxml);
- virDomainDefFree(def);
- virObjectUnref(conn);
-
- return ret;
-}
-
-
-struct testInfo {
- const char *name;
- int version;
- int mode;
-};
-
-static int
-testCompareHelper(const void *data)
-{
- int result = -1;
- const struct testInfo *info = data;
- char *xml = NULL;
- char *cfg = NULL;
-
- if (virAsprintf(&xml, "%s/xlconfigdata/test-%s.xml",
- abs_srcdir, info->name) < 0 ||
- virAsprintf(&cfg, "%s/xlconfigdata/test-%s.cfg",
- abs_srcdir, info->name) < 0)
- goto cleanup;
-
- if (info->mode == 0)
- result = testCompareParseXML(cfg, xml, info->version);
- else
- result = testCompareFormatXML(cfg, xml, info->version);
-
- cleanup:
- VIR_FREE(xml);
- VIR_FREE(cfg);
-
- return result;
-}
-
-
-static int
-mymain(void)
-{
- int ret = 0;
-
- if (!(caps = testXLInitCaps()))
- return EXIT_FAILURE;
-
- if (!(xmlopt = xenDomainXMLConfInit()))
- return EXIT_FAILURE;
-
-#define DO_TEST(name, version) \
- do { \
- struct testInfo info0 = { name, version, 0 }; \
- struct testInfo info1 = { name, version, 1 }; \
- if (virtTestRun("Xen XM-2-XML Parse " name, \
- testCompareHelper, &info0) < 0) \
- ret = -1; \
- if (virtTestRun("Xen XM-2-XML Format " name, \
- testCompareHelper, &info1) < 0) \
- ret = -1; \
- } while (0)
-
- DO_TEST("new-disk", 3);
-// DO_TEST("spice", 3);
-
- virObjectUnref(caps);
- virObjectUnref(xmlopt);
-
- return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
-}
-
-VIRT_TEST_MAIN(mymain)