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

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

 



On Tue, Sep 05, 2023 at 03:44:06PM +0200, Florian Westphal wrote:
> Phil Sutter <phil@xxxxxx> 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?
> 
> Can do that, but if [ false ] evaluates to true...

Sure, because that's a short-cut for '[ -n false ]'. In what context is
that problematic?



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

  Powered by Linux