mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
tests: add a test for persistent LXC XML parsing
Check if we correctly parse the persistent config even with the VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS flag.
This commit is contained in:
parent
5f265fa0db
commit
2d40e2da7b
@ -26,6 +26,7 @@ struct testInfo {
|
|||||||
const char *name;
|
const char *name;
|
||||||
int different;
|
int different;
|
||||||
bool inactive_only;
|
bool inactive_only;
|
||||||
|
unsigned int parse_flags;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -45,7 +46,7 @@ testCompareXMLToXMLHelper(const void *data)
|
|||||||
ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in,
|
ret = testCompareDomXML2XMLFiles(caps, xmlopt, xml_in,
|
||||||
info->different ? xml_out : xml_in,
|
info->different ? xml_out : xml_in,
|
||||||
!info->inactive_only,
|
!info->inactive_only,
|
||||||
NULL, NULL, 0);
|
NULL, NULL, info->parse_flags);
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FREE(xml_in);
|
VIR_FREE(xml_in);
|
||||||
VIR_FREE(xml_out);
|
VIR_FREE(xml_out);
|
||||||
@ -64,19 +65,20 @@ mymain(void)
|
|||||||
if (!(xmlopt = lxcDomainXMLConfInit()))
|
if (!(xmlopt = lxcDomainXMLConfInit()))
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
||||||
# define DO_TEST_FULL(name, is_different, inactive) \
|
# define DO_TEST_FULL(name, is_different, inactive, parse_flags) \
|
||||||
do { \
|
do { \
|
||||||
const struct testInfo info = {name, is_different, inactive}; \
|
const struct testInfo info = {name, is_different, inactive, \
|
||||||
|
parse_flags}; \
|
||||||
if (virtTestRun("LXC XML-2-XML " name, \
|
if (virtTestRun("LXC XML-2-XML " name, \
|
||||||
testCompareXMLToXMLHelper, &info) < 0) \
|
testCompareXMLToXMLHelper, &info) < 0) \
|
||||||
ret = -1; \
|
ret = -1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
# define DO_TEST(name) \
|
# define DO_TEST(name) \
|
||||||
DO_TEST_FULL(name, 0, false)
|
DO_TEST_FULL(name, 0, false, 0)
|
||||||
|
|
||||||
# define DO_TEST_DIFFERENT(name) \
|
# define DO_TEST_DIFFERENT(name) \
|
||||||
DO_TEST_FULL(name, 1, false)
|
DO_TEST_FULL(name, 1, false, 0)
|
||||||
|
|
||||||
/* Unset or set all envvars here that are copied in lxcdBuildCommandLine
|
/* Unset or set all envvars here that are copied in lxcdBuildCommandLine
|
||||||
* using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
|
* using ADD_ENV_COPY, otherwise these tests may fail due to unexpected
|
||||||
@ -91,6 +93,8 @@ mymain(void)
|
|||||||
DO_TEST("idmap");
|
DO_TEST("idmap");
|
||||||
DO_TEST("capabilities");
|
DO_TEST("capabilities");
|
||||||
DO_TEST("sharenet");
|
DO_TEST("sharenet");
|
||||||
|
DO_TEST_FULL("filesystem-root", 0, false,
|
||||||
|
VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS);
|
||||||
|
|
||||||
virObjectUnref(caps);
|
virObjectUnref(caps);
|
||||||
virObjectUnref(xmlopt);
|
virObjectUnref(xmlopt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user