From 28c8d45fcb0cd6190623e11de664b4577f0ce032 Mon Sep 17 00:00:00 2001
From: Eric Garver <e@erig.me>
Date: Wed, 5 Dec 2018 09:32:10 -0500
Subject: [PATCH 12/23] tests/functions: for list macros skip if testing
firewall-offline-cmd
Otherwise all the tests have to wrap the list macros in something like
m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
...
])
so lets just do that inside the macros themselves.
(cherry picked from commit 544404c428ea6a117a7d21f10a46d1640804d357)
---
src/tests/functions.at | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/tests/functions.at b/src/tests/functions.at
index 7cb8ea1a01e4..d8757c5708e9 100644
--- a/src/tests/functions.at
+++ b/src/tests/functions.at
@@ -222,30 +222,42 @@ m4_define([NS_CHECK], [
])
m4_define([EBTABLES_LIST_RULES], [
- NS_CHECK([ebtables --concurrent -t $1 -L $2 | TRIM_WHITESPACE | grep -v "^Bridge"], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+ m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
+ NS_CHECK([ebtables --concurrent -t $1 -L $2 | TRIM_WHITESPACE | grep -v "^Bridge"], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+ ])
])
m4_define([IPTABLES_LIST_RULES], [
- NS_CHECK([iptables -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+ m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
+ NS_CHECK([iptables -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+ ])
])
m4_define([IP6TABLES_LIST_RULES], [
- NS_CHECK([ip6tables -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+ m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
+ NS_CHECK([ip6tables -w -n -t $1 -L $2 | TRIM_WHITESPACE | tail -n +3], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+ ])
])
m4_define([NFT_LIST_RULES], [
- NS_CHECK([nft -nn list chain $1 firewalld $2 | TRIM_WHITESPACE], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+ m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
+ NS_CHECK([nft -nn list chain $1 firewalld $2 | TRIM_WHITESPACE], [$3], [m4_strip([$4])], [m4_strip([$5])], [$6], [$7])
+ ])
])
m4_define([IPSET_LIST_SET], [
- NS_CHECK([ipset list $1 | TRIM_WHITESPACE |dnl
- grep -v "^\(Revision\|Header\|Size\|References\|Number\)" |dnl
- awk 'NR <= 3; NR > 3 {print | "sort"}'],
- [$2], [m4_strip([$3])], [m4_strip([$4])], [$5], [$6])
+ m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
+ NS_CHECK([ipset list $1 | TRIM_WHITESPACE |dnl
+ grep -v "^\(Revision\|Header\|Size\|References\|Number\)" |dnl
+ awk 'NR <= 3; NR > 3 {print | "sort"}'],
+ [$2], [m4_strip([$3])], [m4_strip([$4])], [$5], [$6])
+ ])
])
m4_define([NFT_LIST_SET], [
- NS_CHECK([nft -nn list set inet firewalld $1 | TRIM_WHITESPACE], [$2], [m4_strip([$3])], [m4_strip([$4])], [$5], [$6])
+ m4_ifdef([TESTING_FIREWALL_OFFLINE_CMD], [], [
+ NS_CHECK([nft -nn list set inet firewalld $1 | TRIM_WHITESPACE], [$2], [m4_strip([$3])], [m4_strip([$4])], [$5], [$6])
+ ])
])
m4_define([DBUS_CHECK], [
--
2.20.1