1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

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: Laine Stump <laine@laine.org>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2018-11-01 11:42:56 +00:00
parent 0367524b4f
commit 081bdb4d68

View File

@ -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;