11 #include "virthread.h"
12 #include "nwfilter_params.h"
13 #include "nwfilter_conf.h"
14 #include "testutilsqemu.h"
15 #include "virstring.h"
17 #define VIR_FROM_THIS VIR_FROM_NONE
20 testCompareXMLToXMLFiles(const char *inxml
, const char *outxml
,
25 virNWFilterDefPtr dev
= NULL
;
29 if (!(dev
= virNWFilterDefParseFile(inxml
))) {
37 if (!(actual
= virNWFilterDefFormat(dev
)))
40 if (virTestCompareToFile(actual
, outxml
) < 0)
48 virNWFilterDefFree(dev
);
52 typedef struct test_parms
{
58 testCompareXMLToXMLHelper(const void *data
)
61 const test_parms
*tp
= data
;
65 if (virAsprintf(&inxml
, "%s/nwfilterxml2xmlin/%s.xml",
66 abs_srcdir
, tp
->name
) < 0 ||
67 virAsprintf(&outxml
, "%s/nwfilterxml2xmlout/%s.xml",
68 abs_srcdir
, tp
->name
) < 0) {
72 result
= testCompareXMLToXMLFiles(inxml
, outxml
, tp
->expect_warning
);
86 #define DO_TEST(NAME, EXPECT_WARN) \
90 .expect_warning = EXPECT_WARN, \
92 if (virTestRun("NWFilter XML-2-XML " NAME, \
93 testCompareXMLToXMLHelper, (&tp)) < 0) \
97 DO_TEST("mac-test", true);
98 DO_TEST("vlan-test", true);
99 DO_TEST("stp-test", false);
100 DO_TEST("arp-test", true);
101 DO_TEST("rarp-test", true);
102 DO_TEST("ip-test", true);
103 DO_TEST("ipv6-test", true);
105 DO_TEST("tcp-test", true);
106 DO_TEST("udp-test", true);
107 DO_TEST("icmp-test", true);
108 DO_TEST("igmp-test", false);
109 DO_TEST("sctp-test", true);
110 DO_TEST("udplite-test", false);
111 DO_TEST("esp-test", false);
112 DO_TEST("ah-test", false);
113 DO_TEST("all-test", false);
115 DO_TEST("tcp-ipv6-test", true);
116 DO_TEST("udp-ipv6-test", true);
117 DO_TEST("icmpv6-test", true);
118 DO_TEST("sctp-ipv6-test", true);
119 DO_TEST("udplite-ipv6-test", true);
120 DO_TEST("esp-ipv6-test", true);
121 DO_TEST("ah-ipv6-test", true);
122 DO_TEST("all-ipv6-test", true);
124 DO_TEST("ref-test", false);
125 DO_TEST("ref-rule-test", false);
126 DO_TEST("ipt-no-macspoof-test", false);
127 DO_TEST("icmp-direction-test", false);
128 DO_TEST("icmp-direction2-test", false);
129 DO_TEST("icmp-direction3-test", false);
131 DO_TEST("conntrack-test", false);
133 DO_TEST("hex-data-test", true);
135 DO_TEST("comment-test", true);
137 DO_TEST("example-1", false);
138 DO_TEST("example-2", false);
140 DO_TEST("chain_prefixtest1", true); /* derived from arp-test */
142 DO_TEST("attr-value-test", false);
143 DO_TEST("iter-test1", false);
144 DO_TEST("iter-test2", false);
145 DO_TEST("iter-test3", false);
147 DO_TEST("ipset-test", false);
149 return ret
== 0 ? EXIT_SUCCESS
: EXIT_FAILURE
;
152 VIR_TEST_MAIN(mymain
)