summaryrefslogtreecommitdiffstats
path: root/tests/shell/testcases/rule_management/0011reset_0
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2025-04-08 16:21:32 +0200
committerFlorian Westphal <fw@strlen.de>2025-06-22 21:40:40 +0200
commit7b21b7e387e30de4c4147c82247655cca608d2fd (patch)
tree37d4390cfe185733c8215f6e905248ced9508678 /tests/shell/testcases/rule_management/0011reset_0
parent8ff87c8fd483eb3fdab5839cccaf100b593fe92e (diff)
tests: shell: add feature check for count output change
New kernels with latest nft release will print the number of set elements allocated on the kernel side. This causes shell test dump validation to fail in several places. We can't just update the affected dump files because the test cases are also supposed to pass on current -stable releases. Add a feature check for this. Dump failure can then use sed to postprocess the stored dump file and can then call diff a second time. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'tests/shell/testcases/rule_management/0011reset_0')
-rwxr-xr-xtests/shell/testcases/rule_management/0011reset_030
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/shell/testcases/rule_management/0011reset_0 b/tests/shell/testcases/rule_management/0011reset_0
index 2004b17d..5e65ced9 100755
--- a/tests/shell/testcases/rule_management/0011reset_0
+++ b/tests/shell/testcases/rule_management/0011reset_0
@@ -4,6 +4,12 @@
set -e
+if [ $NFT_TEST_HAVE_setcount = y ]; then
+ size="size 65535 # count 1"
+else
+ size="size 65535"
+fi
+
echo "loading ruleset with anonymous set"
$NFT -f - <<EOF
table t {
@@ -60,10 +66,10 @@ EOF
echo "resetting specific rule"
handle=$($NFT -a list chain t c | sed -n 's/.*accept # handle \([0-9]*\)$/\1/p')
$NFT reset rule t c handle $handle
-EXPECT='table ip t {
+EXPECT="table ip t {
set s {
type ipv4_addr
- size 65535
+ $size
flags dynamic
counter
elements = { 1.1.1.1 counter packets 1 bytes 11 }
@@ -90,7 +96,7 @@ table ip t2 {
counter packets 7 bytes 17 accept
counter packets 8 bytes 18 drop
}
-}'
+}"
$DIFF -u <(echo "$EXPECT") <($NFT list ruleset)
echo "resetting specific chain"
@@ -103,10 +109,10 @@ EXPECT='table ip t {
$DIFF -u <(echo "$EXPECT") <($NFT reset rules chain t c2)
echo "resetting specific table"
-EXPECT='table ip t {
+EXPECT="table ip t {
set s {
type ipv4_addr
- size 65535
+ $size
flags dynamic
counter
elements = { 1.1.1.1 counter packets 1 bytes 11 }
@@ -121,14 +127,14 @@ EXPECT='table ip t {
counter packets 0 bytes 0 accept
counter packets 0 bytes 0 drop
}
-}'
+}"
$DIFF -u <(echo "$EXPECT") <($NFT reset rules table t)
echo "resetting specific family"
-EXPECT='table ip t {
+EXPECT="table ip t {
set s {
type ipv4_addr
- size 65535
+ $size
flags dynamic
counter
elements = { 1.1.1.1 counter packets 1 bytes 11 }
@@ -149,14 +155,14 @@ table ip t2 {
counter packets 7 bytes 17 accept
counter packets 8 bytes 18 drop
}
-}'
+}"
$DIFF -u <(echo "$EXPECT") <($NFT reset rules ip)
echo "resetting whole ruleset"
-EXPECT='table ip t {
+EXPECT="table ip t {
set s {
type ipv4_addr
- size 65535
+ $size
flags dynamic
counter
elements = { 1.1.1.1 counter packets 1 bytes 11 }
@@ -183,5 +189,5 @@ table ip t2 {
counter packets 0 bytes 0 accept
counter packets 0 bytes 0 drop
}
-}'
+}"
$DIFF -u <(echo "$EXPECT") <($NFT reset rules)