* [nft PATCH 1/3] tests: shell: testcase for adding many set elements
@ 2016-11-16 12:53 Arturo Borrero Gonzalez
2016-11-16 12:53 ` [nft PATCH 2/3] tests: shell: testcase for deleting " Arturo Borrero Gonzalez
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Arturo Borrero Gonzalez @ 2016-11-16 12:53 UTC (permalink / raw)
To: netfilter-devel
From: Arturo Borrero Gonzalez <arturo@debian.org>
This testcase adds many elements in a set.
We add 65.356 elements.
Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
---
tests/shell/testcases/sets/0011add_many_elements_0 | 32 ++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100755 tests/shell/testcases/sets/0011add_many_elements_0
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 0000000..ba23f90
--- /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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [nft PATCH 2/3] tests: shell: testcase for deleting many set elements
2016-11-16 12:53 [nft PATCH 1/3] tests: shell: testcase for adding many set elements Arturo Borrero Gonzalez
@ 2016-11-16 12:53 ` Arturo Borrero Gonzalez
2016-11-16 12:53 ` [nft PATCH 3/3] tests: shell: another " Arturo Borrero Gonzalez
2016-11-24 12:02 ` [nft PATCH 1/3] tests: shell: testcase for adding " Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Arturo Borrero Gonzalez @ 2016-11-16 12:53 UTC (permalink / raw)
To: netfilter-devel
From: Arturo Borrero Gonzalez <arturo@debian.org>
This testcase adds and deletes many elements in a set.
We add and delete 65.536 elements in a same batch of netlink messages,
(single nft -f run).
Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
---
.../testcases/sets/0012add_delete_many_elements_0 | 46 ++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100755 tests/shell/testcases/sets/0012add_delete_many_elements_0
diff --git a/tests/shell/testcases/sets/0012add_delete_many_elements_0 b/tests/shell/testcases/sets/0012add_delete_many_elements_0
new file mode 100755
index 0000000..7a5f8c6
--- /dev/null
+++ b/tests/shell/testcases/sets/0012add_delete_many_elements_0
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+# test adding and deleting 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)
+delete element x y $(generate)" > $tmpfile
+
+set -e
+$NFT -f $tmpfile
+
+EXPECTED="table ip x {
+ set y {
+ type ipv4_addr
+ }
+}"
+GET=$($NFT list ruleset)
+if [ "$EXPECTED" != "$GET" ] ; then
+ DIFF="$(which diff)"
+ [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
+ exit 1
+fi
+
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [nft PATCH 3/3] tests: shell: another testcase for deleting many set elements
2016-11-16 12:53 [nft PATCH 1/3] tests: shell: testcase for adding many set elements Arturo Borrero Gonzalez
2016-11-16 12:53 ` [nft PATCH 2/3] tests: shell: testcase for deleting " Arturo Borrero Gonzalez
@ 2016-11-16 12:53 ` Arturo Borrero Gonzalez
2016-11-24 12:02 ` [nft PATCH 1/3] tests: shell: testcase for adding " Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Arturo Borrero Gonzalez @ 2016-11-16 12:53 UTC (permalink / raw)
To: netfilter-devel
From: Arturo Borrero Gonzalez <arturo@debian.org>
This testcase adds and deletes many elements in a set.
We add and delete 65.536 elements in two different nft -f runs.
Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
---
.../testcases/sets/0013add_delete_many_elements_0 | 48 ++++++++++++++++++++
1 file changed, 48 insertions(+)
create mode 100755 tests/shell/testcases/sets/0013add_delete_many_elements_0
diff --git a/tests/shell/testcases/sets/0013add_delete_many_elements_0 b/tests/shell/testcases/sets/0013add_delete_many_elements_0
new file mode 100755
index 0000000..265a554
--- /dev/null
+++ b/tests/shell/testcases/sets/0013add_delete_many_elements_0
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# test adding and deleting many sets elements in two nft -f runs.
+
+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 "}"
+}
+
+set -e
+
+echo "add table x
+add set x y { type ipv4_addr; }
+add element x y $(generate)" > $tmpfile
+$NFT -f $tmpfile
+echo "delete element x y $(generate)" > $tmpfile
+$NFT -f $tmpfile
+
+
+EXPECTED="table ip x {
+ set y {
+ type ipv4_addr
+ }
+}"
+GET=$($NFT list ruleset)
+if [ "$EXPECTED" != "$GET" ] ; then
+ DIFF="$(which diff)"
+ [ -x $DIFF ] && $DIFF -u <(echo "$EXPECTED") <(echo "$GET")
+ exit 1
+fi
+
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [nft PATCH 1/3] tests: shell: testcase for adding many set elements
2016-11-16 12:53 [nft PATCH 1/3] tests: shell: testcase for adding many set elements Arturo Borrero Gonzalez
2016-11-16 12:53 ` [nft PATCH 2/3] tests: shell: testcase for deleting " Arturo Borrero Gonzalez
2016-11-16 12:53 ` [nft PATCH 3/3] tests: shell: another " Arturo Borrero Gonzalez
@ 2016-11-24 12:02 ` Pablo Neira Ayuso
2 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2016-11-24 12:02 UTC (permalink / raw)
To: Arturo Borrero Gonzalez; +Cc: netfilter-devel
On Wed, Nov 16, 2016 at 01:53:15PM +0100, Arturo Borrero Gonzalez wrote:
> From: Arturo Borrero Gonzalez <arturo@debian.org>
>
> This testcase adds many elements in a set.
> We add 65.356 elements.
Series from 1/3 to 3/3 applied, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-24 12:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-16 12:53 [nft PATCH 1/3] tests: shell: testcase for adding many set elements Arturo Borrero Gonzalez
2016-11-16 12:53 ` [nft PATCH 2/3] tests: shell: testcase for deleting " Arturo Borrero Gonzalez
2016-11-16 12:53 ` [nft PATCH 3/3] tests: shell: another " Arturo Borrero Gonzalez
2016-11-24 12:02 ` [nft PATCH 1/3] tests: shell: testcase for adding " Pablo Neira Ayuso
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.