On Thu, Nov 21, 2024 at 10:24:27AM +0100, Florian Westphal wrote: > Florian Westphal <fw@xxxxxxxxx> wrote: > > > set y { > > > type ipv4_addr > > > size 256 # count 128 > > > ... > > > > > > We have to exposed the number of elements counter. I think this can be > > > exposed if set declaration provides size (or default size is used). > > > > OK, I will update libnftl then because this means it will need > > proper getter for nft sake. > > There is a problem with this, shell tests break: > > W: [DUMP FAIL] 9/430 tests/shell/testcases/sets/0057set_create_fails_0 > > cat /tmp/nft-test.latest.root/test-tests-shell-testcases-sets-0057set_create_fails_0.11/ruleset-diff > --- tests/shell/testcases/sets/dumps/0057set_create_fails_0.nft 2024-11-21 09:46:16.888431831 +0100 > +++ /tmp/nft-test.20241121-101956.182.zWvUOZ/test-tests-shell-testcases-sets-0057set_create_fails_0.11/ruleset-after 2024-11-21 10:20:00.046431831 +0100 > @@ -1,7 +1,7 @@ > table inet filter { > set test { > type ipv4_addr > - size 65535 > + size 65535 # count 1 > elements = { 1.1.1.1 } > } > > As shell tests coud run on old kernel, regen dump file won't work. > > Only options I see is to add a feature test file for this support, > and then either disabling dump validation if it failed or adding > additonal/alternative dump file. Oh right, tests! Probably tests/shell can be workaround to remove # count X before comparing output. It won't look nice, but I think tests/shell can carry on this burden. This means # count N will not be checked in old and new kernels. To validate # count N, we can still rely on tests/py and the debug output as you propose. Not great, but does this sound sensible to you? Thanks.