Skip to contentSkip to conversation

tests: shell: Sanitize nft-only/0009-needless-bitwise_0

PATCH In review Phil Sutter 1 participant 2 messages Jul 19, 2023 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: shell: Sanitize nft-only/0009-needless-bitwise_0

Some versions of awk (gawk-4.2.1-4.el8 in particular) also print the non-debug ruleset listing's empty lines, causing the diff to fail. Catch this by exiting upon seeing the first table heading. For the sake of comparing bytecode, the actual ruleset listing is not interesting, anyway.

Fixes 0f7ea0390b336 ("tests/shell: Fix nft-only/0009-needless-bitwise_0")
---
 iptables/tests/shell/testcases/nft-only/0009-needless-bitwise_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
iptables/tests/shell/testcases/nft-only/0009-needless-bitwise_0 +1 -1
index 41588a10863ec..34802cc26aad4 100755
@@ -340,7 +340,7 @@ bridge filter OUTPUT 10 9
 # - lines with bytecode (starting with '  [')
 # - empty lines (so printed diff is not a complete mess)
 filter() {
-	awk '/^(  \[|$)/{print}'
+	awk '/^table /{exit} /^(  \[|$)/{print}'
 }
 
 diff -u -Z <(filter <<< "$EXPECT") <(nft --debug=netlink list ruleset | filter)
Signature · 1 line
2.40.0
author reviewer
#1 lore raw
Quoted 8 lines · Phil Sutter

Some versions of awk (gawk-4.2.1-4.el8 in particular) also print the non-debug ruleset listing's empty lines, causing the diff to fail. Catch this by exiting upon seeing the first table heading. For the sake of comparing bytecode, the actual ruleset listing is not interesting, anyway.

Fixes 0f7ea0390b336 ("tests/shell: Fix nft-only/0009-needless-bitwise_0")

Patch applied.