diff options
author | Arturo Borrero Gonzalez <arturo@debian.org> | 2016-11-16 13:53:15 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2016-11-24 13:01:16 +0100 |
commit | a65f2647903c3ba1c27e893c2cafc1c078ca958e (patch) | |
tree | 3c5ec64db9b3eba7b07d8be03dcb579c5d0b06a9 /tests/shell | |
parent | a7d9df42a8d1b7189d1c7ae23bb513c4b518cf16 (diff) |
tests: shell: testcase for adding many set elements
This testcase adds many elements in a set.
We add 65.356 elements.
Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/shell')
-rwxr-xr-x | tests/shell/testcases/sets/0011add_many_elements_0 | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/shell/testcases/sets/0011add_many_elements_0 b/tests/shell/testcases/sets/0011add_many_elements_0 new file mode 100755 index 00000000..ba23f90f --- /dev/null +++ b/tests/shell/testcases/sets/0011add_many_elements_0 @@ -0,0 +1,32 @@ +#!/bin/bash + +# test adding many sets elements + +HOWMANY=255 + +tmpfile=$(mktemp) +if [ ! -w $tmpfile ] ; then + echo "Failed to create tmp file" >&2 + exit 0 +fi + +trap "rm -rf $tmpfile" EXIT # cleanup if aborted + +generate() { + echo -n "{" + for ((i=1; i<=HOWMANY; i++)) ; do + for ((j=1; j<=HOWMANY; j++)) ; do + echo -n "10.0.${i}.${j}" + [ "$i" == "$HOWMANY" ] && [ "$j" == "$HOWMANY" ] && break + echo -n ", " + done + done + echo -n "}" +} + +echo "add table x +add set x y { type ipv4_addr; } +add element x y $(generate)" > $tmpfile + +set -e +$NFT -f $tmpfile |