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