diff mbox series

[nft,07/14] tests/shell: skip inet ingress tests if kernel lacks support

Message ID 20230918102947.2125883-8-thaller@redhat.com
State Accepted, archived
Headers show
Series tests/shell: fix tests to skip on lacking feature support | expand

Commit Message

Thomas Haller Sept. 18, 2023, 10:28 a.m. UTC
From: Florian Westphal <fw@strlen.de>

Split the bridge autoremove test to a new file.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Thomas Haller <thaller@redhat.com>
---
 tests/shell/features/inet_ingress.nft                    | 7 +++++++
 tests/shell/testcases/chains/0043chain_ingress_0         | 9 ++-------
 .../testcases/chains/dumps/netdev_chain_autoremove.nft   | 0
 tests/shell/testcases/chains/netdev_chain_autoremove     | 9 +++++++++
 4 files changed, 18 insertions(+), 7 deletions(-)
 create mode 100644 tests/shell/features/inet_ingress.nft
 create mode 100644 tests/shell/testcases/chains/dumps/netdev_chain_autoremove.nft
 create mode 100755 tests/shell/testcases/chains/netdev_chain_autoremove
diff mbox series

Patch

diff --git a/tests/shell/features/inet_ingress.nft b/tests/shell/features/inet_ingress.nft
new file mode 100644
index 000000000000..944a5c77d27b
--- /dev/null
+++ b/tests/shell/features/inet_ingress.nft
@@ -0,0 +1,7 @@ 
+# d3519cb89f6d ("netfilter: nf_tables: add inet ingress support")
+# v5.10-rc1~107^2~17^2~1
+table inet t {
+        chain c {
+                type filter hook ingress device "lo" priority filter; policy accept;
+        }
+}
diff --git a/tests/shell/testcases/chains/0043chain_ingress_0 b/tests/shell/testcases/chains/0043chain_ingress_0
index bff464687a6f..a6973b99e514 100755
--- a/tests/shell/testcases/chains/0043chain_ingress_0
+++ b/tests/shell/testcases/chains/0043chain_ingress_0
@@ -1,7 +1,8 @@ 
 #!/bin/bash
 
-set -e
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_inet_ingress)
 
+set -e
 RULESET="table inet filter {
 	chain ingress {
 		type filter hook ingress device \"lo\" priority filter; policy accept;
@@ -14,11 +15,5 @@  RULESET="table inet filter {
 	}
 }"
 
-# Test auto-removal of chain hook on netns removal
-unshare -n bash -c "ip link add br0 type bridge; \
- $NFT add table netdev test; \
- $NFT add chain netdev test ingress { type filter hook ingress device \"br0\" priority 0\; policy drop\; } ; \
-" || exit 1
-
 $NFT -f - <<< "$RULESET" && exit 0
 exit 1
diff --git a/tests/shell/testcases/chains/dumps/netdev_chain_autoremove.nft b/tests/shell/testcases/chains/dumps/netdev_chain_autoremove.nft
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/tests/shell/testcases/chains/netdev_chain_autoremove b/tests/shell/testcases/chains/netdev_chain_autoremove
new file mode 100755
index 000000000000..21f3ad2966cb
--- /dev/null
+++ b/tests/shell/testcases/chains/netdev_chain_autoremove
@@ -0,0 +1,9 @@ 
+#!/bin/bash
+
+set -e
+
+# Test auto-removal of chain hook on netns removal
+unshare -n bash -e -c "ip link add br0 type bridge; \
+ $NFT add table netdev test; \
+ $NFT add chain netdev test ingress { type filter hook ingress device \"br0\" priority 0\; policy drop\; } ; \
+"