From: Michal Privoznik <mprivozn@redhat.com> This is a beginning of something bigger. The idea is that one DO_TEST_FULL() macro (and its friends) will run multiple test cases (just like qemuxmlconftest does). But in order to do that in a readable fashion, the macro should merely just expand to a function call. The function will then call virTestRunLog(), multiple times possibly. This is the first step in that direction. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- tests/networkxml2xmltest.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c index 325a43c385..552364818d 100644 --- a/tests/networkxml2xmltest.c +++ b/tests/networkxml2xmltest.c @@ -103,6 +103,19 @@ testCompareXMLToXMLHelper(const void *data) return result; } +static void +testRun(const char *name, + int *ret, + virNetworkXMLOption *xmlopt, + testCompareNetXML2XMLResult expectResult, + unsigned int flags) +{ + g_autofree char *name_xml2xml = g_strdup_printf("Network XML-2-XML %s", name); + struct testInfo info = { .name = name, .flags = flags, .expectResult = expectResult, .xmlopt = xmlopt }; + + virTestRunLog(ret, name_xml2xml, testCompareXMLToXMLHelper, &info); +} + static int mymain(void) { @@ -113,12 +126,7 @@ mymain(void) return -1; #define DO_TEST_FULL(name, flags, expectResult) \ - do { \ - const struct testInfo info = {name, flags, expectResult, xmlopt}; \ - if (virTestRun("Network XML-2-XML " name, \ - testCompareXMLToXMLHelper, &info) < 0) \ - ret = -1; \ - } while (0) + testRun(name, &ret, xmlopt, expectResult, flags) #define DO_TEST(name) \ DO_TEST_FULL(name, 0, TEST_COMPARE_NET_XML2XML_RESULT_SUCCESS) #define DO_TEST_FLAGS(name, flags) \ -- 2.52.0