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>
|
|
|
|
#include <string.h>
|
2008-04-26 14:22:02 +00:00
|
|
|
#include <unistd.h>
|
2006-08-24 15:05:19 +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"
|
2012-12-13 18:13:21 +00:00
|
|
|
#include "virxml.h"
|
2009-01-22 18:19:20 +00:00
|
|
|
#include "datatypes.h"
|
2014-08-14 18:43:32 +00:00
|
|
|
#include "xenconfig/xen_sxpr.h"
|
2006-08-24 15:05:19 +00:00
|
|
|
#include "testutils.h"
|
2009-01-22 18:19:20 +00:00
|
|
|
#include "testutilsxen.h"
|
2013-04-03 10:36:23 +00:00
|
|
|
#include "virstring.h"
|
2016-12-27 23:19:43 +00:00
|
|
|
#include "libxl/libxl_conf.h"
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2013-06-07 15:10:28 +00:00
|
|
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
|
|
|
|
2009-01-22 18:19:20 +00:00
|
|
|
static virCapsPtr caps;
|
2015-11-28 04:33:55 +00:00
|
|
|
static virDomainXMLOptionPtr xmlopt;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2011-04-24 22:25:10 +00:00
|
|
|
static int
|
2015-12-10 04:15:07 +00:00
|
|
|
testCompareFiles(const char *xml, const char *sexpr)
|
2011-04-24 22:25:10 +00:00
|
|
|
{
|
|
|
|
char *sexprData = NULL;
|
2006-08-24 15:05:19 +00:00
|
|
|
char *gotxml = NULL;
|
2006-10-06 15:32:48 +00:00
|
|
|
int ret = -1;
|
2008-07-25 10:49:33 +00:00
|
|
|
virDomainDefPtr def = NULL;
|
2007-11-14 10:35:58 +00:00
|
|
|
|
2016-05-26 15:01:52 +00:00
|
|
|
if (virTestLoadFile(sexpr, &sexprData) < 0)
|
2008-07-25 10:49:33 +00:00
|
|
|
goto fail;
|
|
|
|
|
2015-12-15 02:31:39 +00:00
|
|
|
if (!(def = xenParseSxprString(sexprData,
|
2016-12-27 23:19:43 +00:00
|
|
|
NULL, -1, caps, xmlopt)))
|
2008-04-26 14:22:02 +00:00
|
|
|
goto fail;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2017-05-19 13:07:15 +00:00
|
|
|
if (!virDomainDefCheckABIStability(def, def, xmlopt)) {
|
2014-01-10 17:18:03 +00:00
|
|
|
fprintf(stderr, "ABI stability check failed on %s", xml);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2016-02-03 21:40:35 +00:00
|
|
|
if (!(gotxml = virDomainDefFormat(def, caps, 0)))
|
2008-07-25 10:49:33 +00:00
|
|
|
goto fail;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2016-05-26 15:01:53 +00:00
|
|
|
if (virTestCompareToFile(gotxml, xml) < 0)
|
2008-04-26 14:22:02 +00:00
|
|
|
goto fail;
|
2006-08-24 15:05:19 +00:00
|
|
|
|
2006-10-06 15:32:48 +00:00
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
fail:
|
2012-02-02 23:16:43 +00:00
|
|
|
VIR_FREE(sexprData);
|
|
|
|
VIR_FREE(gotxml);
|
2008-07-25 10:49:33 +00:00
|
|
|
virDomainDefFree(def);
|
2006-10-06 15:32:48 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
};
|
2007-07-18 21:08:22 +00:00
|
|
|
|
2011-04-24 22:25:10 +00:00
|
|
|
static int
|
|
|
|
testCompareHelper(const void *data)
|
|
|
|
{
|
|
|
|
int result = -1;
|
2008-04-26 14:22:02 +00:00
|
|
|
const struct testInfo *info = data;
|
2011-04-24 22:25:10 +00:00
|
|
|
char *xml = NULL;
|
|
|
|
char *args = NULL;
|
|
|
|
|
|
|
|
if (virAsprintf(&xml, "%s/sexpr2xmldata/sexpr2xml-%s.xml",
|
|
|
|
abs_srcdir, info->input) < 0 ||
|
|
|
|
virAsprintf(&args, "%s/sexpr2xmldata/sexpr2xml-%s.sexpr",
|
|
|
|
abs_srcdir, info->output) < 0) {
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
2015-12-10 04:15:07 +00:00
|
|
|
result = testCompareFiles(xml, args);
|
2008-02-05 16:21:25 +00:00
|
|
|
|
2014-03-25 06:53:44 +00:00
|
|
|
cleanup:
|
2012-02-02 23:16:43 +00:00
|
|
|
VIR_FREE(xml);
|
|
|
|
VIR_FREE(args);
|
2011-04-24 22:25:10 +00:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2007-07-16 21:30:30 +00:00
|
|
|
|
2008-05-29 15:31:49 +00:00
|
|
|
static int
|
2011-04-29 16:21:20 +00:00
|
|
|
mymain(void)
|
2006-08-24 15:05:19 +00:00
|
|
|
{
|
|
|
|
int ret = 0;
|
2007-11-14 10:35:58 +00:00
|
|
|
|
2016-12-27 23:19:43 +00:00
|
|
|
if (!(caps = testXLInitCaps()))
|
2012-03-22 11:33:35 +00:00
|
|
|
return EXIT_FAILURE;
|
2009-01-22 18:19:20 +00:00
|
|
|
|
2016-12-27 23:19:43 +00:00
|
|
|
if (!(xmlopt = libxlCreateXMLConf()))
|
2015-11-28 04:33:55 +00:00
|
|
|
return EXIT_FAILURE;
|
|
|
|
|
2017-11-03 12:09:47 +00:00
|
|
|
#define DO_TEST(in, out) \
|
|
|
|
do { \
|
|
|
|
struct testInfo info = { in, out }; \
|
|
|
|
virResetLastError(); \
|
|
|
|
if (virTestRun("Xen SEXPR-2-XML " in " -> " out, \
|
|
|
|
testCompareHelper, &info) < 0) \
|
|
|
|
ret = -1; \
|
2008-04-26 14:22:02 +00:00
|
|
|
} while (0)
|
|
|
|
|
2015-12-10 04:15:07 +00:00
|
|
|
DO_TEST("pv", "pv");
|
|
|
|
DO_TEST("fv", "fv");
|
|
|
|
DO_TEST("pv", "pv");
|
|
|
|
DO_TEST("fv-v2", "fv-v2");
|
|
|
|
DO_TEST("pv-vfb-new", "pv-vfb-new");
|
|
|
|
DO_TEST("pv-vfb-new-vncdisplay", "pv-vfb-new-vncdisplay");
|
|
|
|
DO_TEST("pv-vfb-type-crash", "pv-vfb-type-crash");
|
|
|
|
DO_TEST("fv-autoport", "fv-autoport");
|
|
|
|
DO_TEST("pv-bootloader", "pv-bootloader");
|
|
|
|
DO_TEST("pv-bootloader-cmdline", "pv-bootloader-cmdline");
|
|
|
|
DO_TEST("pv-vcpus", "pv-vcpus");
|
|
|
|
|
|
|
|
DO_TEST("disk-file", "disk-file");
|
|
|
|
DO_TEST("disk-block", "disk-block");
|
|
|
|
DO_TEST("disk-block-shareable", "disk-block-shareable");
|
|
|
|
DO_TEST("disk-drv-blktap-raw", "disk-drv-blktap-raw");
|
|
|
|
DO_TEST("disk-drv-blktap-qcow", "disk-drv-blktap-qcow");
|
|
|
|
DO_TEST("disk-drv-blktap2-raw", "disk-drv-blktap2-raw");
|
|
|
|
|
|
|
|
DO_TEST("curmem", "curmem");
|
|
|
|
DO_TEST("net-routed", "net-routed");
|
|
|
|
DO_TEST("net-bridged", "net-bridged");
|
|
|
|
DO_TEST("net-e1000", "net-e1000");
|
|
|
|
DO_TEST("bridge-ipaddr", "bridge-ipaddr");
|
|
|
|
DO_TEST("no-source-cdrom", "no-source-cdrom");
|
|
|
|
DO_TEST("pv-localtime", "pv-localtime");
|
|
|
|
DO_TEST("pci-devs", "pci-devs");
|
|
|
|
|
|
|
|
DO_TEST("fv-utc", "fv-utc");
|
|
|
|
DO_TEST("fv-localtime", "fv-localtime");
|
|
|
|
DO_TEST("fv-usbmouse", "fv-usbmouse");
|
|
|
|
DO_TEST("fv-usbtablet", "fv-usbtablet");
|
|
|
|
DO_TEST("fv-kernel", "fv-kernel");
|
|
|
|
DO_TEST("fv-force-hpet", "fv-force-hpet");
|
|
|
|
DO_TEST("fv-force-nohpet", "fv-force-nohpet");
|
|
|
|
|
|
|
|
DO_TEST("fv-serial-null", "fv-serial-null");
|
|
|
|
DO_TEST("fv-serial-file", "fv-serial-file");
|
|
|
|
DO_TEST("fv-serial-dev-2-ports", "fv-serial-dev-2-ports");
|
|
|
|
DO_TEST("fv-serial-dev-2nd-port", "fv-serial-dev-2nd-port");
|
|
|
|
DO_TEST("fv-serial-stdio", "fv-serial-stdio");
|
|
|
|
DO_TEST("fv-serial-pty", "fv-serial-pty");
|
|
|
|
DO_TEST("fv-serial-pipe", "fv-serial-pipe");
|
|
|
|
DO_TEST("fv-serial-tcp", "fv-serial-tcp");
|
|
|
|
DO_TEST("fv-serial-udp", "fv-serial-udp");
|
|
|
|
DO_TEST("fv-serial-tcp-telnet", "fv-serial-tcp-telnet");
|
|
|
|
DO_TEST("fv-serial-unix", "fv-serial-unix");
|
|
|
|
DO_TEST("fv-parallel-tcp", "fv-parallel-tcp");
|
|
|
|
|
|
|
|
DO_TEST("fv-sound", "fv-sound");
|
|
|
|
DO_TEST("fv-sound-all", "fv-sound-all");
|
|
|
|
|
|
|
|
DO_TEST("fv-net-netfront", "fv-net-netfront");
|
|
|
|
|
|
|
|
DO_TEST("fv-empty-kernel", "fv-empty-kernel");
|
|
|
|
|
|
|
|
DO_TEST("boot-grub", "boot-grub");
|
2010-08-23 13:00:22 +00:00
|
|
|
|
2016-01-05 00:46:31 +00:00
|
|
|
DO_TEST("vif-rate", "vif-rate");
|
|
|
|
|
2013-02-01 12:26:18 +00:00
|
|
|
virObjectUnref(caps);
|
2015-11-28 04:33:55 +00:00
|
|
|
virObjectUnref(xmlopt);
|
2009-04-01 10:31:01 +00:00
|
|
|
|
2014-03-17 09:38:38 +00:00
|
|
|
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
2006-08-24 15:05:19 +00:00
|
|
|
}
|
2008-05-29 15:31:49 +00:00
|
|
|
|
2017-03-29 14:45:42 +00:00
|
|
|
VIR_TEST_MAIN(mymain)
|