netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Haller <thaller@redhat.com>
To: NetFilter <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH nft 2/3] tests/shell: skip "sets/reset_command_0" on unsupported reset command
Date: Mon, 18 Sep 2023 11:30:12 +0200	[thread overview]
Message-ID: <3a95f0f8b9275828af700ae4bb284df7ff494854.camel@redhat.com> (raw)
In-Reply-To: <20230915155614.1325657-3-thaller@redhat.com>

This patch (#2 of 3) should be dropped. Don't apply.

It will be solved differently by a patch from Florian.


Thomas


On Fri, 2023-09-15 at 17:54 +0200, Thomas Haller wrote:
> The NFT_MSG_GETSETELEM_RESET command was only added to kernel
> v6.4-rc3-764-g079cd633219d. Also, it doesn't work on Fedora 38
> (6.4.14-200.fc38.x86_64), although that would appear to have the
> feature. On CentOS-Stream-9 (5.14.0-354.el9.x86_64) the test passes.
> 
> Note that this is not implemented via a re-usable feature detection.
> Instead, we just in the middle of the test notice that it appears not
> to
> work, and abort (skip).
> 
> [1]
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=079cd633219d7298d087cd115c17682264244c18
> 
> Signed-off-by: Thomas Haller <thaller@redhat.com>
> ---
>  tests/shell/testcases/sets/reset_command_0 | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/tests/shell/testcases/sets/reset_command_0
> b/tests/shell/testcases/sets/reset_command_0
> index ad2e16a7d274..a0f5ca017b0f 100755
> --- a/tests/shell/testcases/sets/reset_command_0
> +++ b/tests/shell/testcases/sets/reset_command_0
> @@ -2,7 +2,7 @@
>  
>  set -e
>  
> -trap '[[ $? -eq 0 ]] || echo FAIL' EXIT
> +trap 'rc="$?"; [ "$rc" -ne 0 -a "$rc" -ne 77 ] && echo FAIL' EXIT
>  
>  RULESET="table t {
>         set s {
> @@ -36,11 +36,21 @@ expires_minutes() {
>         sed -n 's/.*expires \([0-9]*\)m.*/\1/p'
>  }
>  
> -echo -n "get set elem matches reset set elem: "
>  elem='element t s { 1.0.0.1 . udp . 53 }'
> -[[ $($NFT "get $elem ; reset $elem" | \
> -       grep 'elements = ' | drop_seconds | uniq | wc -l) == 1 ]]
> -echo OK
> +
> +rc=0
> +OUT="$( $NFT "get $elem ; reset $elem" )" || rc=$?
> +if [ "$rc" -ne 0 ] ; then
> +       echo "Command \`nft \"get $elem ; reset $elem\"\` failed.
> Assume reset is not supported. SKIP"
> +       exit 77
> +fi
> +
> +[ "$(printf '%s\n' "$OUT" | \
> +      grep 'elements = ' | \
> +      drop_seconds | \
> +      uniq | \
> +      wc -l)" = 1 ] || die "Unexpected output getting elements:
> \`nft \"get $elem ; reset $elem\"\`"$'\nOutput\n>'"$OUT"'<'
> +echo "get set elem matches reset set elem: OK"
>  
>  echo -n "counters and expiry are reset: "
>  NEW=$($NFT "get $elem")


  reply	other threads:[~2023-09-18  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15 15:53 [PATCH nft 0/3] shell/tests: cleanups and skip tests on Fedora 38 Thomas Haller
2023-09-15 15:54 ` [PATCH nft 1/3] tests/shell: cleanup creating dummy interfaces in tests Thomas Haller
2023-09-15 15:54 ` [PATCH nft 2/3] tests/shell: skip "sets/reset_command_0" on unsupported reset command Thomas Haller
2023-09-18  9:30   ` Thomas Haller [this message]
2023-09-15 15:54 ` [PATCH nft 3/3] tests/shell: suggest 4Mb /proc/sys/net/core/{wmem_max,rmem_max} for rootless Thomas Haller

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=3a95f0f8b9275828af700ae4bb284df7ff494854.camel@redhat.com \
    --to=thaller@redhat.com \
    --cc=netfilter-devel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).