netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Haller <thaller@redhat.com>
To: Phil Sutter <phil@nwl.cc>, Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft 1/5] tests: add feature probing
Date: Wed, 06 Sep 2023 07:17:27 +0200	[thread overview]
Message-ID: <551da7716e5e3a59f85db9e0b78e9eec55c33bbe.camel@redhat.com> (raw)
In-Reply-To: <ZPcmZ4nqfG43SuM9@orbyte.nwl.cc>

On Tue, 2023-09-05 at 15:00 +0200, Phil Sutter wrote:
> On Mon, Sep 04, 2023 at 11:06:30AM +0200, Florian Westphal wrote:
> > Running selftests on older kernels makes some of them fail very
> > early
> > because some tests use features that are not available on older
> > kernels, e.g. -stable releases.
> > 
> > Known examples:
> > - inner header matching
> > - anonymous chains
> > - elem delete from packet path
> > 
> > Also, some test cases might fail because a feature isn't
> > compiled in, such as netdev chains for example.
> > 
> > This adds a feature-probing to the shell tests.
> > 
> > Simply drop a 'nft -f' compatible file with a .nft suffix into
> > tests/shell/features.
> > 
> > run-tests.sh will load it via --check and will add
> > 
> > NFT_TESTS_HAVE_${filename}=$?
> 
> Maybe make this:
> 
> > truefalse=(true false)
> > NFT_TESTS_HAVE_${filename}=${truefalse[$?]}
> 
> [...]
> 
> > [ $NFT_HAVE_chain_binding -eq 1 ] && test_chain_binding
> 
> So this becomes:
> 
> > $NFT_HAVE_chain_binding && test_chain_binding
> 
> Use of true/false appears to work in dash, so might be POSIX sh
> compatible?
> 
> Cheers, Phil
> 


That's possible. But I would not do such non-obvious magic.

The existing variables like VERBOSE,VALGRIND,DUMPGEN use "y" for true
and everything else is false. I'd stick with that form.

The form would be (exactly):

if [ "$NFT_TESTS_HAVE_chain_binding" = y ] ; then


Btw, as a matter of principle, I think that all variables in the patch
set should be quoted.


Thomas


  parent reply	other threads:[~2023-09-06  5:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-04  9:06 [PATCH nft 0/5] tests: shell: add and use feature probing Florian Westphal
2023-09-04  9:06 ` [PATCH nft 1/5] tests: add " Florian Westphal
2023-09-05 13:00   ` Phil Sutter
2023-09-05 13:44     ` Florian Westphal
2023-09-05 14:01       ` Phil Sutter
2023-09-05 14:09         ` Florian Westphal
2023-09-05 20:28           ` Phil Sutter
2023-09-06  5:17     ` Thomas Haller [this message]
2023-09-06 14:36   ` Thomas Haller
2023-09-04  9:06 ` [PATCH nft 2/5] tests: shell: let netdev_chain_0 test indicate SKIP if kernel requires netdev device Florian Westphal
2023-09-05 13:03   ` Phil Sutter
2023-09-06 13:42   ` Thomas Haller
2023-09-04  9:06 ` [PATCH nft 3/5] tests: shell: typeof_integer/raw: prefer @nh for payload matching Florian Westphal
2023-09-04  9:06 ` [PATCH nft 4/5] tests: shell: add and use feature probe for map query like a set Florian Westphal
2023-09-06 14:39   ` Thomas Haller
2023-09-04  9:06 ` [PATCH nft 5/5] tests: shell skip inner matching tests if unsupported 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=551da7716e5e3a59f85db9e0b78e9eec55c33bbe.camel@redhat.com \
    --to=thaller@redhat.com \
    --cc=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /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).