[PATCH 11/24] nwfilterebiptablestest: Strip path from test output via virCommandSetDryRun

Peter Krempa pkrempa at redhat.com
Wed Apr 7 15:09:34 UTC 2021


Enable the internal path clearing instead of using
virTestClearCommandPath.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 tests/nwfilterebiptablestest.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/tests/nwfilterebiptablestest.c b/tests/nwfilterebiptablestest.c
index 14601031a7..a1cc7dca14 100644
--- a/tests/nwfilterebiptablestest.c
+++ b/tests/nwfilterebiptablestest.c
@@ -105,13 +105,12 @@ testNWFilterEBIPTablesAllTeardown(const void *opaque G_GNUC_UNUSED)
     int ret = -1;
     VIR_COMMAND_DRY_RUN_TOKEN;

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

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

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

-    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 } };
     VIR_COMMAND_DRY_RUN_TOKEN;

-    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)
     };
     VIR_COMMAND_DRY_RUN_TOKEN;

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

-    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);
-- 
2.30.2




More information about the libvir-list mailing list