All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: thaller@redhat.com, fw@strlen.de
Subject: [PATCH nft 08/12] tests: shell: skip if kernel does not support bitshift
Date: Thu,  9 Nov 2023 17:23:00 +0100	[thread overview]
Message-ID: <20231109162304.119506-9-pablo@netfilter.org> (raw)
In-Reply-To: <20231109162304.119506-1-pablo@netfilter.org>

A few tests are missing bitshift checks that has been added to
885845468408 ("tests/shell: skip bitshift tests if kernel lacks
support").

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 .../shell/testcases/maps/vmap_mark_bitwise_0  |  2 +
 tests/shell/testcases/sets/typeof_sets_0      | 86 +++++++++----------
 2 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/tests/shell/testcases/maps/vmap_mark_bitwise_0 b/tests/shell/testcases/maps/vmap_mark_bitwise_0
index 0d933553e6b8..2f305b27bc33 100755
--- a/tests/shell/testcases/maps/vmap_mark_bitwise_0
+++ b/tests/shell/testcases/maps/vmap_mark_bitwise_0
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+# NFT_TEST_REQUIRES(NFT_TEST_HAVE_bitshift)
+
 set -e
 
 RULESET="table ip x {
diff --git a/tests/shell/testcases/sets/typeof_sets_0 b/tests/shell/testcases/sets/typeof_sets_0
index 35c572c1e537..92555a1f923e 100755
--- a/tests/shell/testcases/sets/typeof_sets_0
+++ b/tests/shell/testcases/sets/typeof_sets_0
@@ -17,22 +17,53 @@ INPUT_OSF_SET="
 		elements = { \"Linux\" }
 	}
 "
+
+INPUT_FRAG_SET="
+	set s4 {
+		typeof frag frag-off
+		elements = { 1, 1024 }
+	}
+"
+
+INPUT_VERSION_SET="
+	set s8 {
+		typeof ip version
+		elements = { 4, 6 }
+	}
+"
+
 INPUT_OSF_CHAIN="
 	chain c1 {
 		osf name @s1 accept
 	}
 "
 
+INPUT_FRAG_CHAIN="
+	chain c4 {
+		frag frag-off @s4 accept
+	}
+"
+
 INPUT_SCTP_CHAIN="
 	chain c7 {
 		sctp chunk init num-inbound-streams @s7 accept
 	}
 "
+INPUT_VERSION_CHAIN="
+	chain c8 {
+		ip version @s8 accept
+	}
+"
 
 if [ "$NFT_TEST_HAVE_sctp_chunks" = n ] ; then
 	INPUT_SCTP_CHAIN=
 fi
 
+if [ "$NFT_TEST_HAVE_bitshift" = n ] ; then
+	INPUT_FRAG_CHAIN=
+	INPUT_VERSION_CHAIN=
+fi
+
 if [ "$NFT_TEST_HAVE_osf" = n ] ; then
 	if [ "$((RANDOM % 2))" -eq 1 ] ; then
 		# Regardless of $NFT_TEST_HAVE_osf, we can define the set.
@@ -51,12 +82,7 @@ INPUT="table inet t {$INPUT_OSF_SET
 	set s3 {
 		typeof meta ibrpvid
 		elements = { 2, 3, 103 }
-	}
-
-	set s4 {
-		typeof frag frag-off
-		elements = { 1, 1024 }
-	}
+	}$INPUT_FRAG_SET
 
 	set s5 {
 		typeof ip option ra value
@@ -71,12 +97,7 @@ INPUT="table inet t {$INPUT_OSF_SET
 	set s7 {
 		typeof sctp chunk init num-inbound-streams
 		elements = { 1, 4 }
-	}
-
-	set s8 {
-		typeof ip version
-		elements = { 4, 6 }
-	}
+	}$INPUT_VERSION_SET
 
 	set s9 {
 		typeof ip hdrlength
@@ -96,11 +117,7 @@ $INPUT_OSF_CHAIN
 	chain c2 {
 		ether type vlan vlan id @s2 accept
 	}
-
-	chain c4 {
-		frag frag-off @s4 accept
-	}
-
+$INPUT_FRAG_CHAIN
 	chain c5 {
 		ip option ra value @s5 accept
 	}
@@ -109,10 +126,7 @@ $INPUT_OSF_CHAIN
 		tcp option maxseg size @s6 accept
 	}
 $INPUT_SCTP_CHAIN
-	chain c8 {
-		ip version @s8 accept
-	}
-
+$INPUT_VERSION_CHAIN
 	chain c9 {
 		ip hdrlength @s9 accept
 	}
@@ -136,12 +150,7 @@ EXPECTED="table inet t {$INPUT_OSF_SET
 		typeof meta ibrpvid
 		elements = { 2, 3, 103 }
 	}
-
-	set s4 {
-		typeof frag frag-off
-		elements = { 1, 1024 }
-	}
-
+$INPUT_FRAG_SET
 	set s5 {
 		typeof ip option ra value
 		elements = { 1, 1024 }
@@ -156,12 +165,7 @@ EXPECTED="table inet t {$INPUT_OSF_SET
 		typeof sctp chunk init num-inbound-streams
 		elements = { 1, 4 }
 	}
-
-	set s8 {
-		typeof ip version
-		elements = { 4, 6 }
-	}
-
+$INPUT_VERSION_SET
 	set s9 {
 		typeof ip hdrlength
 		elements = { 0, 1, 2, 3, 4,
@@ -181,11 +185,7 @@ $INPUT_OSF_CHAIN
 	chain c2 {
 		vlan id @s2 accept
 	}
-
-	chain c4 {
-		frag frag-off @s4 accept
-	}
-
+$INPUT_FRAG_CHAIN
 	chain c5 {
 		ip option ra value @s5 accept
 	}
@@ -193,11 +193,7 @@ $INPUT_OSF_CHAIN
 	chain c6 {
 		tcp option maxseg size @s6 accept
 	}
-$INPUT_SCTP_CHAIN
-	chain c8 {
-		ip version @s8 accept
-	}
-
+$INPUT_SCTP_CHAIN$INPUT_VERSION_CHAIN
 	chain c9 {
 		ip hdrlength @s9 accept
 	}
@@ -216,6 +212,10 @@ $NFT -f - <<< "$INPUT" || die $'nft command failed to process input:\n'">$INPUT<
 
 $DIFF -u <($NFT list ruleset) - <<<"$EXPECTED" || die $'diff failed between ruleset and expected data.\nExpected:\n'">$EXPECTED<"
 
+if [ "$NFT_TEST_HAVE_bitshift" = n ] ; then
+	echo "Partial test due to NFT_TEST_HAVE_bitshift=n. Skip"
+	exit 77
+fi
 if [ "$NFT_TEST_HAVE_osf" = n ] ; then
 	echo "Partial test due to NFT_TEST_HAVE_osf=n. Skip"
 	exit 77
-- 
2.30.2


  parent reply	other threads:[~2023-11-09 16:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-09 16:22 [PATCH nft 00/12] update tests/shell for 5.4 kernels Pablo Neira Ayuso
2023-11-09 16:22 ` [PATCH nft 01/12] tests: shell: export DIFF to use it from feature scripts Pablo Neira Ayuso
2023-11-09 17:49   ` Thomas Haller
2023-11-09 19:14     ` Pablo Neira Ayuso
2023-11-09 20:35       ` Thomas Haller
2023-11-09 23:21         ` Florian Westphal
2023-11-09 23:25       ` Florian Westphal
2023-11-09 16:22 ` [PATCH nft 02/12] tests: shell: skip pipapo tests if kernel lacks support Pablo Neira Ayuso
2023-11-09 23:25   ` Florian Westphal
2023-11-09 16:22 ` [PATCH nft 03/12] tests: shell: skip prerouting reject " Pablo Neira Ayuso
2023-11-09 23:26   ` Florian Westphal
2023-11-09 16:22 ` [PATCH nft 04/12] tests: shell: skip stateful expression in sets " Pablo Neira Ayuso
2023-11-09 23:27   ` Florian Westphal
2023-11-09 16:22 ` [PATCH nft 05/12] tests: shell: skip NAT netmap " Pablo Neira Ayuso
2023-11-09 16:22 ` [PATCH nft 06/12] tests: shell: skip comment " Pablo Neira Ayuso
2023-11-09 16:22 ` [PATCH nft 07/12] tests: shell: skip multidevice chain " Pablo Neira Ayuso
2023-11-09 16:23 ` Pablo Neira Ayuso [this message]
2023-11-09 16:23 ` [PATCH nft 09/12] tests: shell: split set NAT interval test Pablo Neira Ayuso
2023-11-09 16:23 ` [PATCH nft 10/12] tests: shell: split map test Pablo Neira Ayuso
2023-11-09 16:23 ` [PATCH nft 11/12] tests: shell: split single element in anonymous set Pablo Neira Ayuso
2023-11-09 16:23 ` [PATCH nft 12/12] tests: shell: split merge nat optimization in two tests Pablo Neira Ayuso
2023-11-09 23:29 ` [PATCH nft 00/12] update tests/shell for 5.4 kernels Florian Westphal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231109162304.119506-9-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=thaller@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.