From cf32c7d8c066606bacc0fc41b8c24cad2e5d011b Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Tue, 6 Apr 2021 11:21:21 +0200 Subject: [PATCH] nwfilterebiptablestest: Strip path from test output via virCommandSetDryRun MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable the internal path clearing instead of using virTestClearCommandPath. Signed-off-by: Peter Krempa Reviewed-by: Ján Tomko Reviewed-by: Pavel Hrdina --- tests/nwfilterebiptablestest.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/tests/nwfilterebiptablestest.c b/tests/nwfilterebiptablestest.c index c20b2bed42..5f504cbe64 100644 --- a/tests/nwfilterebiptablestest.c +++ b/tests/nwfilterebiptablestest.c @@ -105,13 +105,12 @@ testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED) int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.allTeardown("vnet0") < 0) goto cleanup; actual = virBufferContentAndReset(&buf); - virTestClearCommandPath(actual); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); @@ -172,13 +171,12 @@ testNWFilterEBIPTablesTearOldRules(const void *opaque G_GNUC_UNUSED) int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.tearOldRules("vnet0") < 0) goto cleanup; actual = virBufferContentAndReset(&buf); - virTestClearCommandPath(actual); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); @@ -217,13 +215,12 @@ testNWFilterEBIPTablesRemoveBasicRules(const void *opaque G_GNUC_UNUSED) int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.removeBasicRules("vnet0") < 0) goto cleanup; actual = virBufferContentAndReset(&buf); - virTestClearCommandPath(actual); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); @@ -247,13 +244,12 @@ testNWFilterEBIPTablesTearNewRules(const void *opaque G_GNUC_UNUSED) int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.tearNewRules("vnet0") < 0) goto cleanup; actual = virBufferContentAndReset(&buf); - virTestClearCommandPath(actual); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); @@ -315,13 +311,12 @@ testNWFilterEBIPTablesApplyBasicRules(const void *opaque G_GNUC_UNUSED) virMacAddr mac = { .addr = { 0x10, 0x20, 0x30, 0x40, 0x50, 0x60 } }; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.applyBasicRules("vnet0", &mac) < 0) goto cleanup; actual = virBufferContentAndReset(&buf); - virTestClearCommandPath(actual); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); @@ -401,13 +396,12 @@ testNWFilterEBIPTablesApplyDHCPOnlyRules(const void *opaque G_GNUC_UNUSED) }; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.applyDHCPOnlyRules("vnet0", &mac, &val, false) < 0) goto cleanup; actual = virBufferContentAndReset(&buf); - virTestClearCommandPath(actual); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual); @@ -470,13 +464,12 @@ testNWFilterEBIPTablesApplyDropAllRules(const void *opaque G_GNUC_UNUSED) int ret = -1; g_autoptr(virCommandDryRunToken) dryRunToken = virCommandDryRunTokenNew(); - virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL); + virCommandSetDryRun(dryRunToken, &buf, false, true, NULL, NULL); if (ebiptables_driver.applyDropAllRules("vnet0") < 0) goto cleanup; actual = virBufferContentAndReset(&buf); - virTestClearCommandPath(actual); if (STRNEQ_NULLABLE(actual, expected)) { virTestDifference(stderr, expected, actual);