]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
tests/shell: skip test cases if ct expectation and/or timeout lacks support
authorFlorian Westphal <fw@strlen.de>
Mon, 18 Sep 2023 10:28:25 +0000 (12:28 +0200)
committerFlorian Westphal <fw@strlen.de>
Mon, 18 Sep 2023 11:08:55 +0000 (13:08 +0200)
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Thomas Haller <thaller@redhat.com>
tests/shell/features/ctexpect.nft [new file with mode: 0644]
tests/shell/features/cttimeout.nft [new file with mode: 0644]
tests/shell/testcases/listing/0013objects_0
tests/shell/testcases/listing/dumps/0013objects_0.nft
tests/shell/testcases/nft-f/0017ct_timeout_obj_0

diff --git a/tests/shell/features/ctexpect.nft b/tests/shell/features/ctexpect.nft
new file mode 100644 (file)
index 0000000..02c3dfd
--- /dev/null
@@ -0,0 +1,10 @@
+# 857b46027d6f ("netfilter: nft_ct: add ct expectations support")
+# v5.3-rc1~140^2~153^2~19
+table t {
+       ct expectation ctexpect {
+               protocol tcp
+               dport 5432
+               timeout 1h
+               size 12;
+       }
+}
diff --git a/tests/shell/features/cttimeout.nft b/tests/shell/features/cttimeout.nft
new file mode 100644 (file)
index 0000000..4be58cd
--- /dev/null
@@ -0,0 +1,8 @@
+# 7e0b2b57f01d ("netfilter: nft_ct: add ct timeout support")
+# v4.19-rc1~140^2~64^2~3
+table t {
+       ct timeout cttime {
+               protocol tcp;
+               policy = {established: 120 }
+       }
+}
index c81b94e20f65bdb784851df53320137647d6fee7..c78ada947a944d5aa961fa4bbdf2168ed488a4ec 100755 (executable)
@@ -1,47 +1,23 @@
 #!/bin/bash
 
-# list table with all objects and chains
-
-EXPECTED="table ip test {
-       quota https-quota {
-               25 mbytes
-       }
-
-       ct helper cthelp {
-               type \"sip\" protocol tcp
-               l3proto ip
-       }
-
-       ct timeout cttime {
-               protocol udp
-               l3proto ip
-               policy = { unreplied : 15s, replied : 12s }
-       }
-
-       ct expectation ctexpect {
-               protocol tcp
-               dport 5432
-               timeout 1h
-               size 12
-               l3proto ip
-       }
-
-       chain input {
-       }
-}"
-
 set -e
 
 $NFT add table test
 $NFT add chain test input
 $NFT add quota test https-quota 25 mbytes
 $NFT add ct helper test cthelp { type \"sip\" protocol tcp \; }
-$NFT add ct timeout test cttime { protocol udp \; policy = {replied : 12, unreplied : 15 } \; }
-$NFT add ct expectation test ctexpect { protocol tcp \; dport 5432 \; timeout 1h \; size 12 \; }
-$NFT add table test-ip
+if [ "$NFT_TEST_HAVE_cttimeout" != n ] ; then
+       $NFT add ct timeout test cttime { protocol udp \; policy = {replied : 12, unreplied : 15 } \; }
+fi
+if [ "$NFT_TEST_HAVE_ctexpect" != n ] ; then
+       $NFT add ct expectation test ctexpect { protocol tcp \; dport 5432 \; timeout 1h \; size 12 \; }
+fi
 
-GET="$($NFT list table test)"
-if [ "$EXPECTED" != "$GET" ] ; then
-       $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
-       exit 1
+if [ "$NFT_TEST_HAVE_cttimeout" = n ] ; then
+       echo "Ran partial test due to NFT_TEST_HAVE_cttimeout=n (skipped)"
+       exit 77
+fi
+if [ "$NFT_TEST_HAVE_ctexpect" = n ] ; then
+       echo "Ran partial test due to NFT_TEST_HAVE_ctexpect=n (skipped)"
+       exit 77
 fi
index 1ea610f8b8d8d9413aaf1d07d5c27be967df5a69..427db268163a49c42c409c36932af3d8aa7b5164 100644 (file)
@@ -25,5 +25,3 @@ table ip test {
        chain input {
        }
 }
-table ip test-ip {
-}
index 4f407793b23bac2af5d4943ac05d5188d6d5f39e..cfb789501beaf1d99d8631e394ce6c2eddb4ffd8 100755 (executable)
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_cttimeout)
+
 EXPECTED='table ip filter {
        ct timeout cttime{
                protocol tcp