2 * virnwfilterbindingxml2xmltest.c: network filter binding XML testing
4 * Copyright (C) 2018 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <http://www.gnu.org/licenses/>.
26 #include <sys/types.h>
30 #include "testutils.h"
32 #include "virnwfilterbindingdef.h"
33 #include "testutilsqemu.h"
34 #include "virstring.h"
36 #define VIR_FROM_THIS VIR_FROM_NONE
39 testCompareXMLToXMLFiles(const char *xml
)
43 virNWFilterBindingDefPtr dev
= NULL
;
47 if (!(dev
= virNWFilterBindingDefParseFile(xml
)))
50 if (!(actual
= virNWFilterBindingDefFormat(dev
)))
53 if (virTestCompareToFile(actual
, xml
) < 0)
60 virNWFilterBindingDefFree(dev
);
64 typedef struct test_parms
{
69 testCompareXMLToXMLHelper(const void *data
)
72 const test_parms
*tp
= data
;
75 if (virAsprintf(&xml
, "%s/virnwfilterbindingxml2xmldata/%s.xml",
76 abs_srcdir
, tp
->name
) < 0) {
80 result
= testCompareXMLToXMLFiles(xml
);
93 #define DO_TEST(NAME) \
98 if (virTestRun("NWFilter XML-2-XML " NAME, \
99 testCompareXMLToXMLHelper, (&tp)) < 0) \
104 DO_TEST("filter-vars");
106 return ret
== 0 ? EXIT_SUCCESS
: EXIT_FAILURE
;
109 VIR_TEST_MAIN(mymain
)