diff mbox series

[nft,v2] tests: shell: Add tests for chain rename.

Message ID 20171005080647.15713-1-rvarsha016@gmail.com
State Accepted
Delegated to: Pablo Neira
Headers show
Series [nft,v2] tests: shell: Add tests for chain rename. | expand

Commit Message

Varsha Rao Oct. 5, 2017, 8:06 a.m. UTC
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

Comments

Pablo Neira Ayuso Oct. 6, 2017, 12:41 p.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

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