netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Varsha Rao <rvarsha016@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>, netfilter-devel@vger.kernel.org
Cc: Varsha Rao <rvarsha016@gmail.com>
Subject: [PATCH nft v2] tests: shell: Add tests for chain rename.
Date: Thu,  5 Oct 2017 13:36:46 +0530	[thread overview]
Message-ID: <20171005080647.15713-1-rvarsha016@gmail.com> (raw)

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


             reply	other threads:[~2017-10-05  8:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-05  8:06 Varsha Rao [this message]
2017-10-05  8:06 ` [PATCH nft] tests: files: Remove old tests for chain rename Varsha Rao
2017-10-06 12:42   ` Pablo Neira Ayuso
2017-10-06 12:41 ` [PATCH nft v2] tests: shell: Add " Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171005080647.15713-1-rvarsha016@gmail.com \
    --to=rvarsha016@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).