]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: skip catchall tests if kernel lacks support
authorFlorian Westphal <fw@strlen.de>
Mon, 18 Sep 2023 10:28:23 +0000 (12:28 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 18 Sep 2023 11:08:52 +0000 (13:08 +0200)
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Thomas Haller <thaller@redhat.com>
tests/shell/features/catchall_element.nft [new file with mode: 0644]
tests/shell/testcases/maps/0011vmap_0
tests/shell/testcases/maps/0017_map_variable_0
tests/shell/testcases/maps/map_catchall_double_deactivate
tests/shell/testcases/sets/0063set_catchall_0
tests/shell/testcases/sets/0064map_catchall_0

diff --git a/tests/shell/features/catchall_element.nft b/tests/shell/features/catchall_element.nft
new file mode 100644 (file)
index 0000000..1a02fd6
--- /dev/null
@@ -0,0 +1,8 @@
+# aaa31047a6d2 ("netfilter: nftables: add catch-all set element support")
+# v5.13-rc1~94^2~10^2~2
+table t {
+       map m {
+               type inet_service : inet_service
+               elements = { * : 42 }
+       }
+}
index 83704d484b28110235a6692397907a98b58db897..3e6fa78d7d4c9fc116930889eb93de7800b16466 100755 (executable)
@@ -22,4 +22,12 @@ EXPECTED="table inet filter {
 }"
 
 $NFT -f - <<< "$EXPECTED"
-$NFT 'add element inet filter portmap { 22 : jump ssh_input, * : drop }'
+
+if [ "$NFT_TEST_HAVE_catchall_element" != n ]; then
+       $NFT 'add element inet filter portmap { 22 : jump ssh_input, * : drop }'
+fi
+
+if [ "$NFT_TEST_HAVE_catchall_element" = n ]; then
+       echo "Ran partial tests due to NFT_TEST_HAVE_catchall_element=n (skipped)"
+       exit 77
+fi
index 70cea88de23812b0ae4500c4e0f42bde2eda4d9d..e01adb4c6ac944d69500211ff5f066e85ccf4062 100755 (executable)
@@ -2,9 +2,15 @@
 
 set -e
 
+if [ "$NFT_TEST_HAVE_catchall_element" != n ] ; then
+       CATCHALL="* : 3,"
+else
+       CATCHALL=","
+fi
+
 RULESET="define x = {
         1.1.1.1 : 2,
-        * : 3,
+        $CATCHALL
 }
 
 table ip x {
@@ -19,3 +25,8 @@ table ip x {
 }"
 
 $NFT -f - <<< "$RULESET"
+
+if [ "$NFT_TEST_HAVE_catchall_element" = n ] ; then
+       echo "Ran modified version of test due to NFT_TEST_HAVE_catchall_element=n (skipped)"
+       exit 77
+fi
index 62fa73ad52f8351fb5636bec3af6761045c9a001..651c08a1eb1045f4ebe269dcc8bf596a8f66dab1 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_catchall_element)
+
 $NFT "add table ip test ;
      add map ip test testmap { type ipv4_addr : verdict; };
      add chain ip test testchain;
index faca56a18dc5273afeda4b9cb7fafd92b355e51d..edd015d09b21d3e0af8e1ace02d465b6e63555cf 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_catchall_element)
+
 set -e
 
 RULESET="table ip x {
index 436851604e34555eee9cd3222d2c3b2b9b91e65d..fd289372df18d93565aeaf477112768710156da0 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_catchall_element)
+
 set -e
 
 RULESET="table ip x {