10 #include "virstring.h"
12 #define VIR_FROM_THIS VIR_FROM_NONE
14 static virCapsPtr caps
;
15 static virDomainXMLOptionPtr xmlopt
;
21 testCompareDomXML2XMLResult expectResult
;
25 testCompareXMLToXMLHelper(const void *data
)
27 const struct testInfo
*info
= data
;
32 if (virAsprintf(&xml_in
, "%s/genericxml2xmlindata/%s.xml",
33 abs_srcdir
, info
->name
) < 0 ||
34 virAsprintf(&xml_out
, "%s/genericxml2xmloutdata/%s.xml",
35 abs_srcdir
, info
->name
) < 0)
38 ret
= testCompareDomXML2XMLFiles(caps
, xmlopt
, xml_in
,
39 info
->different
? xml_out
: xml_in
,
40 !info
->inactive_only
, 0,
54 if (!(caps
= virTestGenericCapsInit()))
57 if (!(xmlopt
= virTestGenericDomainXMLConfInit()))
60 #define DO_TEST_FULL(name, is_different, inactive, expectResult) \
62 const struct testInfo info = {name, is_different, inactive, \
64 if (virTestRun("GENERIC XML-2-XML " name, \
65 testCompareXMLToXMLHelper, &info) < 0) \
69 #define DO_TEST(name) \
70 DO_TEST_FULL(name, 0, false, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS)
72 #define DO_TEST_DIFFERENT(name) \
73 DO_TEST_FULL(name, 1, false, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS)
75 DO_TEST_DIFFERENT("disk-virtio");
77 DO_TEST_DIFFERENT("graphics-vnc-minimal");
78 DO_TEST_DIFFERENT("graphics-vnc-manual-port");
79 DO_TEST_DIFFERENT("graphics-vnc-socket");
80 DO_TEST_DIFFERENT("graphics-vnc-socket-listen");
81 DO_TEST_DIFFERENT("graphics-listen-back-compat");
82 DO_TEST_FULL("graphics-listen-back-compat-mismatch", 0, false,
83 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
84 DO_TEST_DIFFERENT("graphics-vnc-listen-attr-only");
85 DO_TEST_DIFFERENT("graphics-vnc-listen-element-minimal");
86 DO_TEST_DIFFERENT("graphics-vnc-listen-element-with-address");
87 DO_TEST_DIFFERENT("graphics-vnc-socket-attr-listen-address");
88 DO_TEST_DIFFERENT("graphics-vnc-socket-attr-listen-socket");
89 DO_TEST_FULL("graphics-vnc-socket-attr-listen-socket-mismatch", 0, false,
90 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
91 DO_TEST("graphics-vnc-autoport-no");
93 DO_TEST_FULL("name-slash-fail", 0, false,
94 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
98 DO_TEST("vcpus-individual");
99 DO_TEST("disk-network-http");
101 DO_TEST("cpu-cache-emulate");
102 DO_TEST("cpu-cache-passthrough");
103 DO_TEST("cpu-cache-disable");
105 DO_TEST_DIFFERENT("chardev-tcp");
106 DO_TEST_FULL("chardev-tcp-missing-host", 0, false,
107 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
108 DO_TEST_FULL("chardev-tcp-missing-service", 0, false,
109 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
110 DO_TEST_FULL("chardev-tcp-multiple-source", 0, false,
111 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
112 DO_TEST_DIFFERENT("chardev-udp");
113 DO_TEST_FULL("chardev-udp-missing-connect-service", 0, false,
114 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
115 DO_TEST_FULL("chardev-udp-multiple-source", 0, false,
116 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
117 DO_TEST_DIFFERENT("chardev-unix");
118 DO_TEST_FULL("chardev-unix-smartcard-missing-path", 0, false,
119 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
120 DO_TEST_FULL("chardev-unix-redirdev-missing-path", 0, false,
121 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
122 DO_TEST_FULL("chardev-unix-rng-missing-path", 0, false,
123 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
124 DO_TEST_DIFFERENT("chardev-reconnect");
125 DO_TEST_FULL("chardev-reconnect-missing-timeout", 0, false,
126 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
127 DO_TEST_FULL("chardev-reconnect-invalid-mode", 0, false,
128 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
130 DO_TEST("cachetune");
131 DO_TEST("cachetune-small");
132 DO_TEST("cachetune-cdp");
133 DO_TEST_DIFFERENT("cachetune-extra-tunes");
134 DO_TEST_FULL("cachetune-colliding-allocs", false, true,
135 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
136 DO_TEST_FULL("cachetune-colliding-tunes", false, true,
137 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
138 DO_TEST_FULL("cachetune-colliding-types", false, true,
139 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
140 DO_TEST_FULL("cachetune-colliding-monitor", false, true,
141 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
142 DO_TEST("memorytune");
143 DO_TEST_FULL("memorytune-colliding-allocs", false, true,
144 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
145 DO_TEST_FULL("memorytune-colliding-cachetune", false, true,
146 TEST_COMPARE_DOM_XML2XML_RESULT_FAIL_PARSE
);
150 DO_TEST("launch-security-sev");
152 DO_TEST_DIFFERENT("cputune");
154 virObjectUnref(caps
);
155 virObjectUnref(xmlopt
);
157 return ret
== 0 ? EXIT_SUCCESS
: EXIT_FAILURE
;
160 VIR_TEST_MAIN(mymain
)