提交 bac096ff 编写于 作者: J Jonathon Jongsma 提交者: Laine Stump

tests: ensure failure if input file doesn't exist

When using the DO_TEST_PARSE_ERROR() macro, a failure to parse the input
file is considered a successful test. However, if the input file is
totally missing, that should be distinguished from a parsing error and
not be treated as a test success.

The function virDomainDefParseFile() simply returns NULL for any parse
failure, including a missing file. So we need to explicitly check
whether the file exists first, and fail the test if it is missing.
Signed-off-by: NJonathon Jongsma <jjongsma@redhat.com>
上级 6c560b2d
......@@ -608,6 +608,12 @@ testCompareXMLToArgv(const void *data)
if (!(vm = virDomainObjNew(driver.xmlopt)))
goto cleanup;
if (!virFileExists(info->infile)) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"Input file '%s' not found", info->infile);
goto cleanup;
}
parseFlags |= VIR_DOMAIN_DEF_PARSE_INACTIVE;
if (!(vm->def = virDomainDefParseFile(info->infile,
driver.xmlopt,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册