2007-11-30 22:51:54 +00:00
|
|
|
|
2008-01-29 18:15:54 +00:00
|
|
|
#include <config.h>
|
2007-11-26 12:03:34 +00:00
|
|
|
|
2006-08-24 15:05:19 +00:00
|
|
|
#include <stdio.h>
|
2007-11-30 22:51:54 +00:00
|
|
|
#include <stdlib.h>
|
Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c,
qemud/remote.c, src/internal.h, src/openvz_conf.c,
src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c,
src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c,
src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c,
tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c,
tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c,
tests/xmconfigtest.c, tests/xml2sexprtest.c:
Change #include <> to #include "" for local includes.
Removed many includes from src/internal.h and put them in
the C files which actually use them.
Removed <ansidecl.h> - unused.
Added a comment around __func__.
Removed a clashing redefinition of VERSION symbol.
All limits (PATH_MAX etc) now done in src/internal.h, so we
don't need to include those headers in other files.
2007-12-05 13:56:22 +00:00
|
|
|
#include <string.h>
|
2007-04-11 16:06:30 +00:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <fcntl.h>
|
2008-04-26 14:22:02 +00:00
|
|
|
#include <unistd.h>
|
2007-04-11 16:06:30 +00:00
|
|
|
|
Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c,
qemud/remote.c, src/internal.h, src/openvz_conf.c,
src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c,
src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c,
src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c,
tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c,
tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c,
tests/xmconfigtest.c, tests/xml2sexprtest.c:
Change #include <> to #include "" for local includes.
Removed many includes from src/internal.h and put them in
the C files which actually use them.
Removed <ansidecl.h> - unused.
Added a comment around __func__.
Removed a clashing redefinition of VERSION symbol.
All limits (PATH_MAX etc) now done in src/internal.h, so we
don't need to include those headers in other files.
2007-12-05 13:56:22 +00:00
|
|
|
#include "internal.h"
|
Move xen driver code into src/xen/ directory
* src/Makefile.am, src/proxy_internal.c, src/proxy_internal.h
src/sexpr.c, src/sexpr.h, src/xen_unified.c, src/xen_unified.h,
src/xen_internal.c, src/xen_internal.h, src/xen_inotify.c,
src/xen_inotify.h, src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h, src/xs_internal.c,
src/xs_internal.h: Move to src/xen/ directory
* proxy/Makefile.am, proxy/libvirt_proxy.c, src/Makefile.am,
src/libvirt.c, tests/sexpr2xmltest.c, tests/statstest.c,
tests/xencapstest.c, tests/xmconfigtest.c, tests/xml2sexprtest.c:
Adapt to changed xen location
* src/stats_linux.h, src/stats_linux.c: Remove xen specific block
stats APIs
* src/qemu_driver.c, src/uml_driver.c: Add missing sys/un.h include
uncovered after change to stats_linux.h
* src/xen/block_stats.h, src/xen/block_stats.c: Add xen specific
block stats APIs
2009-09-15 15:38:33 +00:00
|
|
|
#include "xen/xend_internal.h"
|
2006-08-24 15:05:19 +00:00
|
|
|
#include "testutils.h"
|
2008-07-25 13:17:27 +00:00
|
|
|
#include "testutilsxen.h"
|
2006-08-24 15:05:19 +00:00
|
|
|
|
|
|
|
static char *progname;
|
2008-04-26 14:22:02 +00:00
|
|
|
static char *abs_srcdir;
|
2008-07-25 13:17:27 +00:00
|
|
|
static virCapsPtr caps;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
|
|
|
#define MAX_FILE 4096
|
|
|
|
|
2008-04-26 14:22:02 +00:00
|
|
|
static int testCompareFiles(const char *xml, const char *sexpr,
|
2008-07-25 13:17:27 +00:00
|
|
|
int xendConfigVersion) {
|
2006-08-24 15:05:19 +00:00
|
|
|
char xmlData[MAX_FILE];
|
|
|
|
char sexprData[MAX_FILE];
|
|
|
|
char *gotsexpr = NULL;
|
|
|
|
char *xmlPtr = &(xmlData[0]);
|
|
|
|
char *sexprPtr = &(sexprData[0]);
|
2006-10-06 15:32:48 +00:00
|
|
|
int ret = -1;
|
2008-07-25 13:17:27 +00:00
|
|
|
virDomainDefPtr def = NULL;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
|
|
|
if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0)
|
2008-07-25 13:17:27 +00:00
|
|
|
goto fail;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
|
|
|
if (virtTestLoadFile(sexpr, &sexprPtr, MAX_FILE) < 0)
|
2008-07-25 13:17:27 +00:00
|
|
|
goto fail;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2010-02-09 18:58:01 +00:00
|
|
|
if (!(def = virDomainDefParseString(caps, xmlData,
|
2009-01-08 19:52:15 +00:00
|
|
|
VIR_DOMAIN_XML_INACTIVE)))
|
2008-07-25 13:17:27 +00:00
|
|
|
goto fail;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2008-07-25 13:17:27 +00:00
|
|
|
if (!(gotsexpr = xenDaemonFormatSxpr(NULL, def, xendConfigVersion)))
|
2007-04-11 16:06:30 +00:00
|
|
|
goto fail;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2008-07-25 13:17:27 +00:00
|
|
|
if (STRNEQ(sexprData, gotsexpr)) {
|
|
|
|
virtTestDifference(stderr, sexprData, gotsexpr);
|
2007-04-11 16:06:30 +00:00
|
|
|
goto fail;
|
|
|
|
}
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2006-10-06 15:32:48 +00:00
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
fail:
|
2008-07-25 13:17:27 +00:00
|
|
|
virDomainDefFree(def);
|
2006-10-06 15:32:48 +00:00
|
|
|
free(gotsexpr);
|
|
|
|
|
|
|
|
return ret;
|
2006-08-24 15:05:19 +00:00
|
|
|
}
|
|
|
|
|
2008-04-26 14:22:02 +00:00
|
|
|
struct testInfo {
|
|
|
|
const char *input;
|
|
|
|
const char *output;
|
|
|
|
const char *name;
|
|
|
|
int version;
|
|
|
|
};
|
2007-06-07 13:50:18 +00:00
|
|
|
|
2008-04-26 14:22:02 +00:00
|
|
|
static int testCompareHelper(const void *data) {
|
|
|
|
const struct testInfo *info = data;
|
|
|
|
char xml[PATH_MAX];
|
|
|
|
char args[PATH_MAX];
|
|
|
|
snprintf(xml, PATH_MAX, "%s/xml2sexprdata/xml2sexpr-%s.xml",
|
|
|
|
abs_srcdir, info->input);
|
|
|
|
snprintf(args, PATH_MAX, "%s/xml2sexprdata/xml2sexpr-%s.sexpr",
|
|
|
|
abs_srcdir, info->output);
|
2008-07-25 13:17:27 +00:00
|
|
|
return testCompareFiles(xml, args, info->version);
|
2006-10-09 14:32:07 +00:00
|
|
|
}
|
|
|
|
|
2007-07-18 21:08:22 +00:00
|
|
|
|
2008-05-29 15:31:49 +00:00
|
|
|
static int
|
|
|
|
mymain(int argc, char **argv)
|
2006-08-24 15:05:19 +00:00
|
|
|
{
|
|
|
|
int ret = 0;
|
2008-04-26 14:22:02 +00:00
|
|
|
char cwd[PATH_MAX];
|
2006-10-09 14:32:07 +00:00
|
|
|
|
2006-08-24 15:05:19 +00:00
|
|
|
progname = argv[0];
|
2006-10-09 14:32:07 +00:00
|
|
|
|
2008-04-26 14:22:02 +00:00
|
|
|
abs_srcdir = getenv("abs_srcdir");
|
|
|
|
if (!abs_srcdir)
|
|
|
|
abs_srcdir = getcwd(cwd, sizeof(cwd));
|
2007-11-14 10:35:58 +00:00
|
|
|
|
2006-08-24 15:05:19 +00:00
|
|
|
if (argc > 1) {
|
2008-04-10 16:54:54 +00:00
|
|
|
fprintf(stderr, "Usage: %s\n", progname);
|
2008-05-29 15:31:49 +00:00
|
|
|
return(EXIT_FAILURE);
|
2006-08-24 15:05:19 +00:00
|
|
|
}
|
2006-10-09 14:32:07 +00:00
|
|
|
|
2008-04-26 14:22:02 +00:00
|
|
|
#define DO_TEST(in, out, name, version) \
|
|
|
|
do { \
|
|
|
|
struct testInfo info = { in, out, name, version }; \
|
2009-04-01 10:31:01 +00:00
|
|
|
virResetLastError(); \
|
2008-04-26 14:22:02 +00:00
|
|
|
if (virtTestRun("Xen XML-2-SEXPR " in " -> " out, \
|
|
|
|
1, testCompareHelper, &info) < 0) \
|
|
|
|
ret = -1; \
|
|
|
|
} while (0)
|
|
|
|
|
2008-07-25 13:17:27 +00:00
|
|
|
if (!(caps = testXenCapsInit()))
|
|
|
|
return(EXIT_FAILURE);
|
|
|
|
|
2008-04-26 14:22:02 +00:00
|
|
|
DO_TEST("pv", "pv", "pvtest", 1);
|
|
|
|
DO_TEST("fv", "fv", "fvtest", 1);
|
|
|
|
DO_TEST("pv", "pv", "pvtest", 2);
|
|
|
|
DO_TEST("fv", "fv-v2", "fvtest", 2);
|
|
|
|
DO_TEST("fv-vncunused", "fv-vncunused", "fvtest", 2);
|
2010-08-23 13:43:51 +00:00
|
|
|
#ifdef WITH_RHEL5_API
|
|
|
|
/* RHEL-5 Xen doesn't support the old style vnc configuration */
|
|
|
|
DO_TEST("pv-vfb-orig", "pv-vfb-new", "pvtest", 2);
|
|
|
|
#else
|
2008-04-26 14:22:02 +00:00
|
|
|
DO_TEST("pv-vfb-orig", "pv-vfb-orig", "pvtest", 2);
|
2010-08-23 13:43:51 +00:00
|
|
|
#endif
|
2008-04-26 14:22:02 +00:00
|
|
|
DO_TEST("pv-vfb-new", "pv-vfb-new", "pvtest", 3);
|
2008-09-09 13:53:58 +00:00
|
|
|
DO_TEST("pv-vfb-new-auto", "pv-vfb-new-auto", "pvtest", 3);
|
2008-04-26 14:22:02 +00:00
|
|
|
DO_TEST("pv-bootloader", "pv-bootloader", "pvtest", 1);
|
2010-10-05 14:18:52 +00:00
|
|
|
DO_TEST("pv-vcpus", "pv-vcpus", "pvtest", 1);
|
2008-04-26 14:22:02 +00:00
|
|
|
|
|
|
|
DO_TEST("disk-file", "disk-file", "pvtest", 2);
|
|
|
|
DO_TEST("disk-block", "disk-block", "pvtest", 2);
|
|
|
|
DO_TEST("disk-block-shareable", "disk-block-shareable", "pvtest", 2);
|
|
|
|
DO_TEST("disk-drv-loop", "disk-drv-loop", "pvtest", 2);
|
|
|
|
DO_TEST("disk-drv-blkback", "disk-drv-blkback", "pvtest", 2);
|
|
|
|
DO_TEST("disk-drv-blktap", "disk-drv-blktap", "pvtest", 2);
|
|
|
|
DO_TEST("disk-drv-blktap-raw", "disk-drv-blktap-raw", "pvtest", 2);
|
|
|
|
DO_TEST("disk-drv-blktap-qcow", "disk-drv-blktap-qcow", "pvtest", 2);
|
2010-08-24 21:49:00 +00:00
|
|
|
DO_TEST("disk-drv-blktap2", "disk-drv-blktap2", "pvtest", 2);
|
|
|
|
DO_TEST("disk-drv-blktap2-raw", "disk-drv-blktap2-raw", "pvtest", 2);
|
2008-04-26 14:22:02 +00:00
|
|
|
|
|
|
|
DO_TEST("curmem", "curmem", "rhel5", 2);
|
|
|
|
DO_TEST("net-routed", "net-routed", "pvtest", 2);
|
|
|
|
DO_TEST("net-bridged", "net-bridged", "pvtest", 2);
|
2008-04-30 12:30:55 +00:00
|
|
|
DO_TEST("net-e1000", "net-e1000", "pvtest", 2);
|
2009-01-23 01:48:47 +00:00
|
|
|
DO_TEST("bridge-ipaddr", "bridge-ipaddr", "pvtest", 2);
|
2008-04-26 14:22:02 +00:00
|
|
|
DO_TEST("no-source-cdrom", "no-source-cdrom", "test", 2);
|
2009-04-01 10:36:52 +00:00
|
|
|
DO_TEST("pv-localtime", "pv-localtime", "pvtest", 1);
|
2009-04-03 12:38:52 +00:00
|
|
|
DO_TEST("pci-devs", "pci-devs", "pvtest", 2);
|
2008-04-26 14:22:02 +00:00
|
|
|
|
|
|
|
DO_TEST("fv-utc", "fv-utc", "fvtest", 1);
|
|
|
|
DO_TEST("fv-localtime", "fv-localtime", "fvtest", 1);
|
|
|
|
DO_TEST("fv-usbmouse", "fv-usbmouse", "fvtest", 1);
|
|
|
|
DO_TEST("fv-usbmouse", "fv-usbmouse", "fvtest", 1);
|
|
|
|
DO_TEST("fv-kernel", "fv-kernel", "fvtest", 1);
|
|
|
|
|
|
|
|
DO_TEST("fv-serial-null", "fv-serial-null", "fvtest", 1);
|
|
|
|
DO_TEST("fv-serial-file", "fv-serial-file", "fvtest", 1);
|
|
|
|
DO_TEST("fv-serial-stdio", "fv-serial-stdio", "fvtest", 1);
|
|
|
|
DO_TEST("fv-serial-pty", "fv-serial-pty", "fvtest", 1);
|
|
|
|
DO_TEST("fv-serial-pipe", "fv-serial-pipe", "fvtest", 1);
|
|
|
|
DO_TEST("fv-serial-tcp", "fv-serial-tcp", "fvtest", 1);
|
|
|
|
DO_TEST("fv-serial-udp", "fv-serial-udp", "fvtest", 1);
|
|
|
|
DO_TEST("fv-serial-tcp-telnet", "fv-serial-tcp-telnet", "fvtest", 1);
|
|
|
|
DO_TEST("fv-serial-unix", "fv-serial-unix", "fvtest", 1);
|
|
|
|
DO_TEST("fv-parallel-tcp", "fv-parallel-tcp", "fvtest", 1);
|
2008-02-05 16:21:25 +00:00
|
|
|
|
2008-05-07 14:04:40 +00:00
|
|
|
DO_TEST("fv-sound", "fv-sound", "fvtest", 1);
|
|
|
|
|
2009-12-04 16:01:34 +00:00
|
|
|
DO_TEST("fv-net-ioemu", "fv-net-ioemu", "fvtest", 1);
|
|
|
|
DO_TEST("fv-net-netfront", "fv-net-netfront", "fvtest", 1);
|
|
|
|
|
2010-08-23 13:00:22 +00:00
|
|
|
DO_TEST("boot-grub", "boot-grub", "fvtest", 1);
|
|
|
|
|
2008-07-25 13:17:27 +00:00
|
|
|
virCapabilitiesFree(caps);
|
|
|
|
|
2008-05-29 15:31:49 +00:00
|
|
|
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
|
2006-08-24 15:05:19 +00:00
|
|
|
}
|
2007-11-30 22:51:54 +00:00
|
|
|
|
2008-05-29 15:31:49 +00:00
|
|
|
VIRT_TEST_MAIN(mymain)
|