From: Daniel P. Berrangé Date: Thu, 1 Nov 2018 11:42:56 +0000 (+0000) Subject: tests: fix dry run handling in network firewall test X-Git-Tag: v5.0.0-rc1~140 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=081bdb4d68405aa3c6aa940f27e2464b5f339d65;p=thirdparty%2Flibvirt.git 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 Signed-off-by: Daniel P. Berrangé --- diff --git a/tests/networkxml2firewalltest.c b/tests/networkxml2firewalltest.c index 505ff0c740..5e3d8906c5 100644 --- a/tests/networkxml2firewalltest.c +++ b/tests/networkxml2firewalltest.c @@ -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;