[PATCH] test: fix nwfilter tests following changes in virfirewall.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some of the nwfilter tests are now failing since --concurrent shows
up in the ebtables command. To avoid this, implement a few functions
that allow to set the booleans indicating how the locking is to be
done to false, overriding the probing.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>
---
 src/libvirt_private.syms         |  3 +++
 src/util/virfirewall.c           | 18 ++++++++++++++++++
 src/util/virfirewall.h           |  4 ++++
 tests/nwfilterebiptablestest.c   |  5 +++++
 tests/nwfilterxml2firewalltest.c |  4 ++++
 5 files changed, 34 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 2647d36..376826a 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1353,7 +1353,10 @@ virFindFileInPath;
 virFirewallAddRule;
 virFirewallAddRuleFull;
 virFirewallApply;
+virFirewallEbtablesNotUseLock;
 virFirewallFree;
+virFirewallIp6tablesNotUseLock;
+virFirewallIptablesNotUseLock;
 virFirewallNew;
 virFirewallRemoveRule;
 virFirewallRuleAddArg;
diff --git a/src/util/virfirewall.c b/src/util/virfirewall.c
index 8496062..5df2a5f 100644
--- a/src/util/virfirewall.c
+++ b/src/util/virfirewall.c
@@ -108,6 +108,24 @@ static bool iptablesUseLock;
 static bool ip6tablesUseLock;
 static bool ebtablesUseLock;
 
+void
+virFirewallIptablesNotUseLock(void)
+{
+    iptablesUseLock = false;
+}
+
+void
+virFirewallIp6tablesNotUseLock(void)
+{
+    ip6tablesUseLock = false;
+}
+
+void
+virFirewallEbtablesNotUseLock(void)
+{
+    ebtablesUseLock = false;
+}
+
 static void
 virFirewallCheckUpdateLock(bool *lockflag,
                            const char *const*args)
diff --git a/src/util/virfirewall.h b/src/util/virfirewall.h
index 1129219..aa72a76 100644
--- a/src/util/virfirewall.h
+++ b/src/util/virfirewall.h
@@ -106,4 +106,8 @@ void virFirewallStartRollback(virFirewallPtr firewall,
 
 int virFirewallApply(virFirewallPtr firewall);
 
+void virFirewallIptablesNotUseLock(void);
+void virFirewallIp6tablesNotUseLock(void);
+void virFirewallEbtablesNotUseLock(void);
+
 #endif /* __VIR_FIREWALL_H__ */
diff --git a/tests/nwfilterebiptablestest.c b/tests/nwfilterebiptablestest.c
index e04bc21..e18a6c7 100644
--- a/tests/nwfilterebiptablestest.c
+++ b/tests/nwfilterebiptablestest.c
@@ -24,6 +24,7 @@
 #include "testutils.h"
 #include "nwfilter/nwfilter_ebiptables_driver.h"
 #include "virbuffer.h"
+#include "virfirewall.h"
 
 #define __VIR_FIREWALL_PRIV_H_ALLOW__
 #include "virfirewallpriv.h"
@@ -527,6 +528,10 @@ mymain(void)
         goto cleanup;
     }
 
+    virFirewallEbtablesNotUseLock();
+    virFirewallIptablesNotUseLock();
+    virFirewallIp6tablesNotUseLock();
+
     if (virtTestRun("ebiptablesAllTeardown",
                     testNWFilterEBIPTablesAllTeardown,
                     NULL) < 0)
diff --git a/tests/nwfilterxml2firewalltest.c b/tests/nwfilterxml2firewalltest.c
index 01527f4..f6ef0e0 100644
--- a/tests/nwfilterxml2firewalltest.c
+++ b/tests/nwfilterxml2firewalltest.c
@@ -479,6 +479,10 @@ mymain(void)
         goto cleanup;
     }
 
+    virFirewallEbtablesNotUseLock();
+    virFirewallIptablesNotUseLock();
+    virFirewallIp6tablesNotUseLock();
+
     DO_TEST("ah");
     DO_TEST("ah-ipv6");
     DO_TEST("all");
-- 
1.9.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]