Skip to contentSkip to conversation

tests: shell: Add tests for chain rename.

PATCH Applied Varsha Rao 2 participants 4 messages Oct 5, 2017 – Oct 6, 2017 netfilter

lore
Share & tools
lore

Varsha Rao

author
#0 lore raw

PATCH v2 1/1 tests: shell: Add tests for chain rename.

This patch adds test cases for renaming chain with existing and non existing chains.

---
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
tests/shell/testcases/chains/0013rename_0 new file +8 -0
new file mode 100755
index 0000000..b9fe11a
@@ -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
tests/shell/testcases/chains/0014rename_1 new file +14 -0
new file mode 100755
index 0000000..e29e788
@@ -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
Signature · 1 line
2.13.6
author
#1 lore raw

PATCH 1/1 tests: files: Remove old tests for chain rename.

These tests are not required as new test cases are added in tests/shell file.

---
 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
tests/files/chain-rename.1 deleted +0 -7
deleted file mode 100644
index 870416c..0000000
@@ -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
tests/files/chain-rename.2 deleted +0 -4
deleted file mode 100644
index 1250dab..0000000
@@ -1,4 +0,0 @@
-#! nft -f
-
-# must fail: already exists
-rename chain filter chain1 chain2
tests/files/chain-rename.3 deleted +0 -5
deleted file mode 100644
index 796c1a1..0000000
@@ -1,5 +0,0 @@
-#! nft -f
-
-# must succeed
-rename chain filter chain1 chain3
-delete chain filter chain3
Signature · 1 line
2.13.6
#2 lore raw

Re: [PATCH nft] tests: files: Remove old tests for chain rename.

In reply to Varsha Rao
Quoted 2 lines · Varsha Rao

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!