Blame SOURCES/0079-chore-tests-functions-change-list-macros-to-only-exp.patch

c8bceb
From c7ba9d153c381c244bf5ac0abfa4043f187486b8 Mon Sep 17 00:00:00 2001
c8bceb
From: Eric Garver <eric@garver.life>
c8bceb
Date: Thu, 30 May 2019 17:12:48 -0400
c8bceb
Subject: [PATCH 79/79] chore: tests/functions: change list macros to only
c8bceb
 expand for backend
c8bceb
c8bceb
The macros now check for FIREWALL_BACKEND before attempting to list the
c8bceb
rules. This means we don't need to guard them inside the actual test
c8bceb
cases.
c8bceb
c8bceb
Also introduces _ALWAYS variants that always expand regardless of the
c8bceb
current backend under test.
c8bceb
c8bceb
(cherry picked from commit cb43b6cd99d952ae31614a7c46b2df13b670fea3)
c8bceb
(cherry picked from commit 7054a3d092978e165980a4c8d4e1407f01d88bd7)
c8bceb
---
c8bceb
 src/tests/functions.at | 32 ++++++++++++++++++++++++++++----
c8bceb
 1 file changed, 28 insertions(+), 4 deletions(-)
c8bceb
c8bceb
diff --git a/src/tests/functions.at b/src/tests/functions.at
c8bceb
index b6831f61d806..571f780a007c 100644
c8bceb
--- a/src/tests/functions.at
c8bceb
+++ b/src/tests/functions.at
c8bceb
@@ -237,13 +237,19 @@ m4_define([EBTABLES_LIST_RULES], [
c8bceb
     m4_undefine([EBTABLES_LIST_RULES_NORMALIZE])
c8bceb
 ])
c8bceb
 
c8bceb
-m4_define([IPTABLES_LIST_RULES], [
c8bceb
+m4_define([IPTABLES_LIST_RULES_ALWAYS], [
c8bceb
     m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
c8bceb
         NS_CHECK([IPTABLES -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
c8bceb
     ])
c8bceb
 ])
c8bceb
 
c8bceb
-m4_define([IP6TABLES_LIST_RULES], [
c8bceb
+m4_define([IPTABLES_LIST_RULES], [
c8bceb
+    m4_if(iptables, FIREWALL_BACKEND, [
c8bceb
+        IPTABLES_LIST_RULES_ALWAYS([$1], [$2], [$3], [$4], [$5], [$6], [$7])
c8bceb
+    ])
c8bceb
+])
c8bceb
+
c8bceb
+m4_define([IP6TABLES_LIST_RULES_ALWAYS], [
c8bceb
     m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
c8bceb
     m4_if(yes, HOST_SUPPORTS_IP6TABLES, [
c8bceb
         NS_CHECK([IP6TABLES -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
c8bceb
@@ -251,7 +257,13 @@ m4_define([IP6TABLES_LIST_RULES], [
c8bceb
     ])
c8bceb
 ])
c8bceb
 
c8bceb
-m4_define([NFT_LIST_RULES], [
c8bceb
+m4_define([IP6TABLES_LIST_RULES], [
c8bceb
+    m4_if(iptables, FIREWALL_BACKEND, [
c8bceb
+        IP6TABLES_LIST_RULES_ALWAYS([$1], [$2], [$3], [$4], [$5], [$6], [$7])
c8bceb
+    ])
c8bceb
+])
c8bceb
+
c8bceb
+m4_define([NFT_LIST_RULES_ALWAYS], [
c8bceb
     dnl nftables commit 6dd848339444 change list output to show "meta mark"
c8bceb
     dnl instead of just "mark".
c8bceb
     m4_define([NFT_LIST_RULES_NORMALIZE], [dnl
c8bceb
@@ -267,6 +279,12 @@ m4_define([NFT_LIST_RULES], [
c8bceb
     m4_undefine([NFT_LIST_RULES_NORMALIZE])
c8bceb
 ])
c8bceb
 
c8bceb
+m4_define([NFT_LIST_RULES], [
c8bceb
+    m4_if(nftables, FIREWALL_BACKEND, [
c8bceb
+        NFT_LIST_RULES_ALWAYS([$1], [$2], [$3], [$4], [$5], [$6], [$7])
c8bceb
+    ])
c8bceb
+])
c8bceb
+
c8bceb
 m4_define([IPSET_LIST_SET], [
c8bceb
     m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
c8bceb
         NS_CHECK([ipset list $1 | TRIM_WHITESPACE |dnl
c8bceb
@@ -276,12 +294,18 @@ m4_define([IPSET_LIST_SET], [
c8bceb
     ])
c8bceb
 ])
c8bceb
 
c8bceb
-m4_define([NFT_LIST_SET], [
c8bceb
+m4_define([NFT_LIST_SET_ALWAYS], [
c8bceb
     m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
c8bceb
         NS_CHECK([nft NFT_NUMERIC_ARGS list set inet firewalld $1 | TRIM_WHITESPACE], [$2], [m4_strip([$3])], [m4_strip([$4])], [$5], [$6])
c8bceb
     ])
c8bceb
 ])
c8bceb
 
c8bceb
+m4_define([NFT_LIST_SET], [
c8bceb
+    m4_if(nftables, FIREWALL_BACKEND, [
c8bceb
+        NFT_LIST_SET_ALWAYS([$1], [$2], [$3], [$4], [$5], [$6])
c8bceb
+    ])
c8bceb
+])
c8bceb
+
c8bceb
 m4_define([DBUS_CHECK], [
c8bceb
     NS_CHECK([dbus-send --system --print-reply --dest=org.fedoraproject.FirewallD1 dnl
c8bceb
               /org/fedoraproject/FirewallD1/$1 org.fedoraproject.FirewallD1.$2 $3],
c8bceb
-- 
c8bceb
2.20.1
c8bceb