提交 081bdb4d 编写于 作者: D Daniel P. Berrangé

tests: fix dry run handling in network firewall test

The networkxml2firewalltest sets virCommand to dry run mode but doesn't
provide a callback to fill in stdout/stderr. As a result when the
firewall code queries rules it gets a NULL output and so never triggers
the callback to process output.

This trivial change just returns an empty string for the command output
in order to ensure the callback gets triggered. It has no effect right
now, but in future patches this will trigger greater test coverage.
Reviewed-by: NLaine Stump <laine@laine.org>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 0367524b
......@@ -44,6 +44,20 @@ static const char *abs_top_srcdir;
# error "test case not ported to this platform"
# endif
static void
testCommandDryRun(const char *const*args ATTRIBUTE_UNUSED,
const char *const*env ATTRIBUTE_UNUSED,
const char *input ATTRIBUTE_UNUSED,
char **output,
char **error,
int *status,
void *opaque ATTRIBUTE_UNUSED)
{
*status = 0;
ignore_value(VIR_STRDUP_QUIET(*output, ""));
ignore_value(VIR_STRDUP_QUIET(*error, ""));
}
static int testCompareXMLToArgvFiles(const char *xml,
const char *cmdline)
{
......@@ -53,7 +67,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
virNetworkDefPtr def = NULL;
int ret = -1;
virCommandSetDryRun(&buf, NULL, NULL);
virCommandSetDryRun(&buf, testCommandDryRun, NULL);
if (!(def = virNetworkDefParseFile(xml)))
goto cleanup;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册