In case the test directory contains invalid XML (this doesn't happen upstream, but can when developing, e.g. by forgetting git conflict markers) the tests would crash as in case when 'testQemuInfoSetArgs' fails we'd still invoke the test in qemuxml2argv and qemuxml2xml tests. Add a 'break' statement to avoid invocation of the test and add a debug message. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- tests/qemuxml2argvtest.c | 4 +++- tests/qemuxml2xmltest.c | 1 + tests/testutilsqemu.c | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index b552f5deed..3f43e76842 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -943,8 +943,10 @@ mymain(void) }; \ info.qapiSchemaCache = qapiSchemaCache; \ if (testQemuInfoSetArgs(&info, capscache, capslatest, \ - __VA_ARGS__, ARG_END) < 0) \ + __VA_ARGS__, ARG_END) < 0) { \ ret = -1; \ + break; \ + } \ testInfoSetPaths(&info, _suffix); \ if (virTestRun("QEMU XML-2-ARGV " _name _suffix, \ testCompareXMLToArgv, &info) < 0) \ diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 9652d2a7ce..3b453f9746 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -157,6 +157,7 @@ mymain(void) qemuTestCapsCacheInsert(driver.qemuCapsCache, info.qemuCaps) < 0) { \ VIR_TEST_DEBUG("Failed to generate test data for '%s'", _name); \ ret = -1; \ + break; \ } \ \ if (when & WHEN_INACTIVE) { \ diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 9a0666724a..f166eaf502 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -785,8 +785,10 @@ testQemuInfoSetArgs(struct testQemuInfo *info, } if (!g_hash_table_lookup_extended(capscache, capsfile, NULL, (void **) &cachedcaps)) { - if (!(qemuCaps = qemuTestParseCapabilitiesArch(info->arch, capsfile))) + if (!(qemuCaps = qemuTestParseCapabilitiesArch(info->arch, capsfile))) { + VIR_TEST_VERBOSE("failed to parse capabilities file '%s'", capsfile); goto cleanup; + } cachedcaps = qemuCaps; -- 2.31.1