[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V3 5/5] libxl: Add a test suite for libxl option generator



On Wed, Sep 03, 2014 at 09:07:39PM -0600, Jim Fehlig wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> The libxl library allows a libxl_domain_config object to be
> serialized to a JSON string. Use this to allow testing of
> the XML -> libxl_domain_config conversion process
> 
> Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
> Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx>
> ---
>  configure.ac                           |   2 +
>  tests/Makefile.am                      |  25 +++-
>  tests/libxlxml2jsondata/basic-hvm.json | 217 ++++++++++++++++++++++++++++
>  tests/libxlxml2jsondata/basic-hvm.xml  |  36 +++++
>  tests/libxlxml2jsondata/basic-pv.json  | 163 +++++++++++++++++++++
>  tests/libxlxml2jsondata/basic-pv.xml   |  28 ++++
>  tests/libxlxml2jsontest.c              | 251 
> +++++++++++++++++++++++++++++++++
>  tests/virmocklibxl.c                   |  87 ++++++++++++
>  8 files changed, 808 insertions(+), 1 deletion(-)

> diff --git a/tests/libxlxml2jsontest.c b/tests/libxlxml2jsontest.c
> new file mode 100644
> index 0000000..6ae654a
> --- /dev/null
> +++ b/tests/libxlxml2jsontest.c


> +#if defined LIBXL_HAVE_BUILDINFO_HVM_VENDOR_DEVICE
> +/*
> +* Currently no paths ignored on Xen 4.4
> +*/
> +static const char **ignore_paths = NULL;
> +#elif defined LIBXL_HAVE_DOMAIN_NODEAFFINITY
> +/*
> +* These paths must be ignored if running on Xen 4.3
> +*/
> +static const char *ignore_paths[] = {
> +    "/c_info/pvh",
> +    "/c_info/driver_domain",
> +    "/b_info/device_model_version",
> +    "/b_info/event_channels",
> +    "/b_info/u/kernel",
> +    "/b_info/u/cmdline",
> +    "/b_info/u/ramdisk",
> +    "/b_info/u/bios",
> +    "/b_info/u/timer_mode",
> +    "/b_info/u/vga/kind",
> +    "/b_info/u/spice/vdagent",
> +    "/b_info/u/spice/clipboard_sharing",
> +    "/b_info/u/spice/usbredirection",
> +    "/b_info/u/usbversion",
> +    "/b_info/u/vendor_device",
> +    "/on_watchdog",
> +    NULL
> +};
> +#else
> +/*
> + * These paths must be ignored if running on Xen 4.2
> + */
> +static const char *ignore_paths[] = {
> +    "/c_info/pvh",
> +    "/c_info/driver_domain",
> +    "/b_info/nodemap",
> +    "/b_info/exec_ssidref",
> +    "/b_info/iomem",
> +    "/b_info/claim_mode",
> +    "/b_info/device_model_version",
> +    "/b_info/event_channels",
> +    "/b_info/u/usbdevice_list",
> +    "/b_info/u/kernel",
> +    "/b_info/u/cmdline",
> +    "/b_info/u/ramdisk",
> +    "/b_info/u/bios",
> +    "/b_info/u/timer_mode",
> +    "/b_info/u/vga/kind",
> +    "/b_info/u/spice/vdagent",
> +    "/b_info/u/spice/clipboard_sharing",
> +    "/b_info/u/spice/usbredirection",
> +    "/b_info/u/usbversion",
> +    "/b_info/u/vendor_device",
> +    "/disks/backend_domname",
> +    "/nics/backend_domname",
> +    "/nics/gatewaydev",
> +    "/vfbs/backend_domname",
> +    "/vkbs/backend_domname",
> +    "/vtpms",
> +    "/on_watchdog",
> +    NULL
> +};
> +#endif

As more & more versions of Xen are released I think we might
end up with quite alot of duplication between these lists.
Could we structure it a little differently to avoid this
perhaps in this way:


   #if defined LIBXL_HAVE_BUILDINFO_HVM_VENDOR_DEVICE
   # define LIBXL_VERSION 4004
   #elif define LIBXL_HAVE_DOMAIN_NODEAFFINITY
   # define LIBXL_VERSION 4003
   #else
   # define LIBXL_VERSION 4002
   #endif

   static const char *ignore_paths[] = {
   #if LIBXL_VERSION < 4004
       "/c_info/pvh",
       "/c_info/driver_domain",
       "/b_info/device_model_version",
       "/b_info/event_channels",
       "/b_info/u/kernel",
       "/b_info/u/cmdline",
       "/b_info/u/ramdisk",
       "/b_info/u/bios",
       "/b_info/u/timer_mode",
       "/b_info/u/vga/kind",
       "/b_info/u/spice/vdagent",
       "/b_info/u/spice/clipboard_sharing",
       "/b_info/u/spice/usbredirection",
       "/b_info/u/usbversion",
       "/b_info/u/vendor_device",
       "/on_watchdog",
   #endif
   #if LIBXL_VERSION < 4003
       "/b_info/nodemap",
       "/b_info/exec_ssidref",
       "/b_info/iomem",
       "/b_info/claim_mode",
       "/b_info/u/usbdevice_list",
       "/disks/backend_domname",
       "/nics/backend_domname",
       "/nics/gatewaydev",
       "/vfbs/backend_domname",
       "/vkbs/backend_domname",
       "/vtpms",
   #endif
       NULL
   };



Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.