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