diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-01-15 20:17:50 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-01-24 19:41:07 +0100 |
commit | 6fca08c6340b0dfed1f1c0f426d86f69446c0732 (patch) | |
tree | 4324725ff00ad52f272e05108aa38442698ec52f /tests | |
parent | 1694df2de79f39c5037f82601e02226022b2e38f (diff) |
tests: shell: extend runtime set element automerge to cover partial deletions
Perform partial deletions of an existing interval and check that the
set remains in consistent state.
Before the follow kernel fixes:
netfilter: nft_set_rbtree: skip elements in transaction from garbage collection
netfilter: nft_set_rbtree: Switch to node list walk for overlap detection
without these patches, this test fails with bogus overlap reports.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/shell/testcases/sets/automerge_0 | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/tests/shell/testcases/sets/automerge_0 b/tests/shell/testcases/sets/automerge_0 index c9fb6095..7530b3db 100755 --- a/tests/shell/testcases/sets/automerge_0 +++ b/tests/shell/testcases/sets/automerge_0 @@ -38,6 +38,11 @@ i=0 cat $tmpfile3 | while read line && [ $i -lt 10 ] do $NFT add element inet x y { $line } + if [ $? -ne 0 ] + then + echo "failed to add $line" + exit 1 + fi i=$((i+1)) done @@ -51,12 +56,56 @@ do echo "failed to add $from-$to" exit 1 fi - $NFT get element inet x y { $from-$to } + + $NFT get element inet x y { $from-$to } 1>/dev/null if [ $? -ne 0 ] then echo "failed to get $from-$to" exit 1 fi + + # partial removals in the previous random range + from2=$(($from+10)) + to2=$(($to-10)) + $NFT delete element inet x y { $from, $to, $from2-$to2 } + if [ $? -ne 0 ] + then + echo "failed to delete $from, $to, $from2-$to2" + exit 1 + fi + + # check deletions are correct + from=$(($from+1)) + $NFT get element inet x y { $from } 1>/dev/null + if [ $? -ne 0 ] + then + echo "failed to get $from" + exit 1 + fi + + to=$(($to-1)) + $NFT get element inet x y { $to } 1>/dev/null + if [ $? -ne 0 ] + then + echo "failed to get $to" + exit 1 + fi + + from2=$(($from2-1)) + $NFT get element inet x y { $from2 } 1>/dev/null + if [ $? -ne 0 ] + then + echo "failed to get $from2" + exit 1 + fi + to2=$(($to2+1)) + + $NFT get element inet x y { $to2 } 1>/dev/null + if [ $? -ne 0 ] + then + echo "failed to get $to2" + exit 1 + fi done rm -f $tmpfile |