Re: [PATCH nft 1/5] tests: add feature probing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux