mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Prevent test failures with ebtables/iptables/ip6tables are missing
When running tests in a restricted container (as opposed to a full OS install), we can't assume ebtables/iptbles/ip6tables are going to be installed. We must check this and mark the tests as skipped. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
@@ -445,6 +445,14 @@ testCompareXMLToIPTablesHelper(const void *data)
|
||||
return result;
|
||||
}
|
||||
|
||||
static bool
|
||||
hasNetfilterTools(void)
|
||||
{
|
||||
return virFileIsExecutable(IPTABLES_PATH) &&
|
||||
virFileIsExecutable(IP6TABLES_PATH) &&
|
||||
virFileIsExecutable(EBTABLES_PATH);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
mymain(void)
|
||||
@@ -468,6 +476,10 @@ mymain(void)
|
||||
virFirewallSetLockOverride(true);
|
||||
|
||||
if (virFirewallSetBackend(VIR_FIREWALL_BACKEND_DIRECT) < 0) {
|
||||
if (!hasNetfilterTools()) {
|
||||
fprintf(stderr, "iptables/ip6tables/ebtables tools not present");
|
||||
return EXIT_AM_SKIP;
|
||||
}
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user