* [PATCH nft v2] tests: shell: Add tests for chain rename.
@ 2017-10-05 8:06 Varsha Rao
2017-10-05 8:06 ` [PATCH nft] tests: files: Remove old " Varsha Rao
2017-10-06 12:41 ` [PATCH nft v2] tests: shell: Add " Pablo Neira Ayuso
0 siblings, 2 replies; 4+ messages in thread
From: Varsha Rao @ 2017-10-05 8:06 UTC (permalink / raw)
To: Pablo Neira Ayuso, netfilter-devel; +Cc: Varsha Rao
This patch adds test cases for renaming chain with existing and non
existing chains.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
Changes in v1:
- Added test for non existing chains.
Changes in v2:
- Added tests for both existing and non existing chains.
- Edited the comment.
- Modified commit message.
tests/shell/testcases/chains/0013rename_0 | 8 ++++++++
tests/shell/testcases/chains/0014rename_1 | 14 ++++++++++++++
2 files changed, 22 insertions(+)
create mode 100755 tests/shell/testcases/chains/0013rename_0
create mode 100755 tests/shell/testcases/chains/0014rename_1
diff --git a/tests/shell/testcases/chains/0013rename_0 b/tests/shell/testcases/chains/0013rename_0
new file mode 100755
index 0000000..b9fe11a
--- /dev/null
+++ b/tests/shell/testcases/chains/0013rename_0
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table t
+$NFT add chain t c1
+# kernel should not return EEXIST
+$NFT rename chain t c1 c2
diff --git a/tests/shell/testcases/chains/0014rename_1 b/tests/shell/testcases/chains/0014rename_1
new file mode 100755
index 0000000..e29e788
--- /dev/null
+++ b/tests/shell/testcases/chains/0014rename_1
@@ -0,0 +1,14 @@
+#!/bin/bash
+
+set -e
+
+$NFT add table t
+$NFT add chain t c1
+$NFT add chain t c2
+# kernel should return EEXIST
+$NFT rename chain t c1 c2
+
+if [ $? -eq 0 ] ; then
+ echo "E: Renamed with existing chain" >&2
+ exit 0
+fi
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH nft] tests: files: Remove old tests for chain rename.
2017-10-05 8:06 [PATCH nft v2] tests: shell: Add tests for chain rename Varsha Rao
@ 2017-10-05 8:06 ` Varsha Rao
2017-10-06 12:42 ` Pablo Neira Ayuso
2017-10-06 12:41 ` [PATCH nft v2] tests: shell: Add " Pablo Neira Ayuso
1 sibling, 1 reply; 4+ messages in thread
From: Varsha Rao @ 2017-10-05 8:06 UTC (permalink / raw)
To: Pablo Neira Ayuso, netfilter-devel; +Cc: Varsha Rao
These tests are not required as new test cases are added in tests/shell
file.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
tests/files/chain-rename.1 | 7 -------
tests/files/chain-rename.2 | 4 ----
tests/files/chain-rename.3 | 5 -----
3 files changed, 16 deletions(-)
delete mode 100644 tests/files/chain-rename.1
delete mode 100644 tests/files/chain-rename.2
delete mode 100644 tests/files/chain-rename.3
diff --git a/tests/files/chain-rename.1 b/tests/files/chain-rename.1
deleted file mode 100644
index 870416c..0000000
--- a/tests/files/chain-rename.1
+++ /dev/null
@@ -1,7 +0,0 @@
-#! nft -f
-
-# Create table and empty chains for rename test
-add table filter
-
-add chain filter chain1
-add chain filter chain2
diff --git a/tests/files/chain-rename.2 b/tests/files/chain-rename.2
deleted file mode 100644
index 1250dab..0000000
--- a/tests/files/chain-rename.2
+++ /dev/null
@@ -1,4 +0,0 @@
-#! nft -f
-
-# must fail: already exists
-rename chain filter chain1 chain2
diff --git a/tests/files/chain-rename.3 b/tests/files/chain-rename.3
deleted file mode 100644
index 796c1a1..0000000
--- a/tests/files/chain-rename.3
+++ /dev/null
@@ -1,5 +0,0 @@
-#! nft -f
-
-# must succeed
-rename chain filter chain1 chain3
-delete chain filter chain3
--
2.13.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH nft] tests: files: Remove old tests for chain rename.
2017-10-05 8:06 ` [PATCH nft] tests: files: Remove old " Varsha Rao
@ 2017-10-06 12:42 ` Pablo Neira Ayuso
0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-06 12:42 UTC (permalink / raw)
To: Varsha Rao; +Cc: netfilter-devel
On Thu, Oct 05, 2017 at 01:36:47PM +0530, Varsha Rao wrote:
> These tests are not required as new test cases are added in tests/shell
> file.
Also applied, thanks.
It would be great if you can go over those tests/files/ to get rid of
them. Just make a replacement that we can fit into tests/shell/
However, before doing so, you should have a look first that there is
no overlap with any existing test, we should avoid duplicates. I mean,
go over files under tests/shell/ and make sure what you add does not
exists already in the tree.
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH nft v2] tests: shell: Add tests for chain rename.
2017-10-05 8:06 [PATCH nft v2] tests: shell: Add tests for chain rename Varsha Rao
2017-10-05 8:06 ` [PATCH nft] tests: files: Remove old " Varsha Rao
@ 2017-10-06 12:41 ` Pablo Neira Ayuso
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2017-10-06 12:41 UTC (permalink / raw)
To: Varsha Rao; +Cc: netfilter-devel
On Thu, Oct 05, 2017 at 01:36:46PM +0530, Varsha Rao wrote:
> This patch adds test cases for renaming chain with existing and non
> existing chains.
Applied, thanks Varsha.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-10-06 12:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-05 8:06 [PATCH nft v2] tests: shell: Add tests for chain rename Varsha Rao
2017-10-05 8:06 ` [PATCH nft] tests: files: Remove old " Varsha Rao
2017-10-06 12:42 ` Pablo Neira Ayuso
2017-10-06 12:41 ` [PATCH nft v2] tests: shell: Add " Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).