On Wed, Mar 25, 2015 at 10:13:44 +0100, Martin Kletzander wrote:
On Tue, Mar 24, 2015 at 03:03:22PM +0100, Peter Krempa wrote:
>To allow adding more tests, refactor the XML-2-XML test so that the
>files are not reloaded always and clarify the control flow.
>
>Result of this changes is that the active and inactive portions of the
>XML are tested in separate steps rather than one test step.
>---
> tests/qemuxml2xmltest.c | 214 +++++++++++++++++++++++++++++++-----------------
> 1 file changed, 140 insertions(+), 74 deletions(-)
>
>diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
>index 0f16d5e..627edca 100644
>--- a/tests/qemuxml2xmltest.c
>+++ b/tests/qemuxml2xmltest.c
>@@ -22,11 +22,30 @@
>
> static virQEMUDriver driver;
>
>+enum {
>+ WHEN_INACTIVE = 1,
>+ WHEN_ACTIVE = 2,
>+ WHEN_EITHER = 3,
Pre-existing, but reading the code, I guess this "either" means
"both", doesn't it?
I changed this to _BOTH
>@@ -148,12 +201,25 @@ mymain(void)
> if (!(driver.xmlopt = virQEMUDriverCreateXMLConf(&driver)))
> return EXIT_FAILURE;
>
>-# define DO_TEST_FULL(name, is_different, when) \
>- do { \
>- const struct testInfo info = {name, is_different, when}; \
>- if (virtTestRun("QEMU XML-2-XML " name, \
>- testCompareXMLToXMLHelper, &info) < 0) \
>- ret = -1; \
>+# define DO_TEST_FULL(name, is_different, when) \
>+ do { \
>+ if (testInfoSet(&info, name, is_different, when) < 0) {
\
>+ fprintf(stderr, "Failed to generate test data for
'%s'", name); \
>+ return -1; \
>+ } \
>+ \
>+ if (info.outInactiveName) { \
>+ if (virtTestRun("QEMU XML-2-XML-inactive " name,
\
>+ testXML2XMLInactive, &info) < 0)
\
>+ ret = -1; \
>+ } \
>+ \
>+ if (info.outActiveName) { \
>+ if (virtTestRun("QEMU XML-2-XML-active " name,
\
>+ testXML2XMLActive, &info) < 0)
\
>+ ret = -1; \
>+ } \
>+ testInfoFree(&info);
\
s/ // (indentation's off)
And fixed this problem.
And pushed this patch and 1/4. I'll repost the rest as I've done pretty
serious changes to 2/4.