diff options
author | Florian Westphal <fw@strlen.de> | 2023-09-18 12:28:23 +0200 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-09-18 13:08:52 +0200 |
commit | b512f79edbf476fe6b551cb6c7d007d81dd9f154 (patch) | |
tree | e6a6922d35d0e85b967ff82659baff014d0f253d | |
parent | dc913f03d6cf8b1cb8b7a1364351792152a2faca (diff) |
tests/shell: skip catchall tests if kernel lacks support
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Thomas Haller <thaller@redhat.com>
-rw-r--r-- | tests/shell/features/catchall_element.nft | 8 | ||||
-rwxr-xr-x | tests/shell/testcases/maps/0011vmap_0 | 10 | ||||
-rwxr-xr-x | tests/shell/testcases/maps/0017_map_variable_0 | 13 | ||||
-rwxr-xr-x | tests/shell/testcases/maps/map_catchall_double_deactivate | 2 | ||||
-rwxr-xr-x | tests/shell/testcases/sets/0063set_catchall_0 | 2 | ||||
-rwxr-xr-x | tests/shell/testcases/sets/0064map_catchall_0 | 2 |
6 files changed, 35 insertions, 2 deletions
diff --git a/tests/shell/features/catchall_element.nft b/tests/shell/features/catchall_element.nft new file mode 100644 index 00000000..1a02fd61 --- /dev/null +++ b/tests/shell/features/catchall_element.nft @@ -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 } + } +} diff --git a/tests/shell/testcases/maps/0011vmap_0 b/tests/shell/testcases/maps/0011vmap_0 index 83704d48..3e6fa78d 100755 --- a/tests/shell/testcases/maps/0011vmap_0 +++ b/tests/shell/testcases/maps/0011vmap_0 @@ -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 diff --git a/tests/shell/testcases/maps/0017_map_variable_0 b/tests/shell/testcases/maps/0017_map_variable_0 index 70cea88d..e01adb4c 100755 --- a/tests/shell/testcases/maps/0017_map_variable_0 +++ b/tests/shell/testcases/maps/0017_map_variable_0 @@ -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 diff --git a/tests/shell/testcases/maps/map_catchall_double_deactivate b/tests/shell/testcases/maps/map_catchall_double_deactivate index 62fa73ad..651c08a1 100755 --- a/tests/shell/testcases/maps/map_catchall_double_deactivate +++ b/tests/shell/testcases/maps/map_catchall_double_deactivate @@ -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; diff --git a/tests/shell/testcases/sets/0063set_catchall_0 b/tests/shell/testcases/sets/0063set_catchall_0 index faca56a1..edd015d0 100755 --- a/tests/shell/testcases/sets/0063set_catchall_0 +++ b/tests/shell/testcases/sets/0063set_catchall_0 @@ -1,5 +1,7 @@ #!/bin/bash +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_catchall_element) + set -e RULESET="table ip x { diff --git a/tests/shell/testcases/sets/0064map_catchall_0 b/tests/shell/testcases/sets/0064map_catchall_0 index 43685160..fd289372 100755 --- a/tests/shell/testcases/sets/0064map_catchall_0 +++ b/tests/shell/testcases/sets/0064map_catchall_0 @@ -1,5 +1,7 @@ #!/bin/bash +# NFT_TEST_REQUIRES(NFT_TEST_HAVE_catchall_element) + set -e RULESET="table ip x { |