mirror of https://gitee.com/openkylin/libvirt.git
tests: Adjust libxlxml2domconfigtest to work with Xen < 4.10
Commit f253dc90f5
introduced a test regression in environments with
Xen < 4.10. The logic in libxl_conf.c correctly maps ACPI and APIC
from virDomainObj to libxl_domain_conf based on
LIBXL_HAVE_BUILDINFO_APIC, but the tests did not account for the
different libxl_domain_conf JSON representations.
One approach to fixing the test regression is to duplicate JSON test
data files, having one set for Xen <= 4.9 and another for Xen 4.10
and greater. To avoid duplicate data files, this patch takes the
approach of modifying the libxl_domain_conf object based on
LIBXL_HAVE_BUILDINFO_APIC, before retrieving the JSON representation.
It allows using the same test data files for all supported versions
of Xen by adjusting the intermediate form of libxl_domain_conf object
as needed.
Signed-off-by: Jim Fehlig <jfehlig@suse.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
4a927468fb
commit
fcdc387410
|
@ -97,6 +97,20 @@ testCompareXMLToDomConfig(const char *xmlfile,
|
|||
"Failed to create libxl_domain_config from JSON doc");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* In order to have common test files between Xen 4.9 and newer Xen versions,
|
||||
* tweak the expected libxl_domain_config object before getting a json
|
||||
* representation.
|
||||
*/
|
||||
# ifndef LIBXL_HAVE_BUILDINFO_APIC
|
||||
if (expectconfig.c_info.type == LIBXL_DOMAIN_TYPE_HVM) {
|
||||
libxl_defbool_unset(&expectconfig.b_info.acpi);
|
||||
libxl_defbool_set(&expectconfig.b_info.u.hvm.apic, true);
|
||||
libxl_defbool_set(&expectconfig.b_info.u.hvm.acpi, true);
|
||||
}
|
||||
# endif
|
||||
|
||||
if (!(expectjson = libxl_domain_config_to_json(cfg->ctx, &expectconfig))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
"Failed to retrieve JSON doc for libxl_domain_config");
|
||||
|
|
Loading…
Reference in New Issue