From 081bdb4d68405aa3c6aa940f27e2464b5f339d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Thu, 1 Nov 2018 11:42:56 +0000 Subject: [PATCH] tests: fix dry run handling in network firewall test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é --- tests/networkxml2firewalltest.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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; -- GitLab