1) README is added to run test suite.
2) Rename two test-case scripts to follow proper numerical order.
3) "echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line" command
should only used when verbose("-v") option is not there else instead of
clearing "[EXECUTING]" prompt it is clearing last prompt of the test file.

Signed-off-by: Arushi Singhal <arushisinghal19971...@gmail.com>
---
 iptables/tests/shell/README                         | 17 +++++++++++++++++
 iptables/tests/shell/run-tests.sh                   |  2 +-
 iptables/tests/shell/testcases/chain/0002newchain_0 |  9 +++++++++
 iptables/tests/shell/testcases/chain/0003rename_1   | 12 ++++++++++++
 iptables/tests/shell/testcases/chain/0004newchain_0 |  9 ---------
 iptables/tests/shell/testcases/chain/0005rename_1   | 12 ------------
 6 files changed, 39 insertions(+), 22 deletions(-)
 create mode 100644 iptables/tests/shell/README
 create mode 100755 iptables/tests/shell/testcases/chain/0002newchain_0
 create mode 100755 iptables/tests/shell/testcases/chain/0003rename_1
 delete mode 100755 iptables/tests/shell/testcases/chain/0004newchain_0
 delete mode 100755 iptables/tests/shell/testcases/chain/0005rename_1

diff --git a/iptables/tests/shell/README b/iptables/tests/shell/README
new file mode 100644
index 0000000..08da486
--- /dev/null
+++ b/iptables/tests/shell/README
@@ -0,0 +1,17 @@
+To run the test suite (as root):
+ $ cd iptables/tests/shell
+ # ./run-tests.sh
+
+Test files are executable files with the pattern <<name_N>> , where N is the
+expected return code of the executable. Since they are located with `find',
+test-files can be spreaded in any sub-directories.
+
+You can turn on a verbose execution by calling:
+ # ./run-tests.sh -v
+
+And to run test suite for pariticular test files:
+ # ./run-tests.sh <PATH_OF_TESTFILES>
+
+Also, test-files will receive the environment variable $XT_MULTI which contains
+the path to the old iptables (xtables-legacy-multi) or new iptables 
(xtables-nft-multi)
+binary being tested.
diff --git a/iptables/tests/shell/run-tests.sh 
b/iptables/tests/shell/run-tests.sh
index a984a45..a39aecb 100755
--- a/iptables/tests/shell/run-tests.sh
+++ b/iptables/tests/shell/run-tests.sh
@@ -67,10 +67,10 @@ do_test() {
                XT_MULTI=$xtables_multi unshare -n ${testfile}
        else
                XT_MULTI=$xtables_multi unshare -n ${testfile} > /dev/null 2>&1
+               echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line
        fi
 
        rc_got=$?
-       echo -en "\033[1A\033[K" # clean the [EXECUTING] foobar line
 
        if [ "$rc_got" == "$rc_spec" ] ; then
                msg_info "[OK]          $testfile"
diff --git a/iptables/tests/shell/testcases/chain/0002newchain_0 
b/iptables/tests/shell/testcases/chain/0002newchain_0
new file mode 100755
index 0000000..53f8a3a
--- /dev/null
+++ b/iptables/tests/shell/testcases/chain/0002newchain_0
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+set -e
+
+$XT_MULTI iptables -N c1
+$XT_MULTI ip6tables -N c1
+
+$XT_MULTI iptables -N c2
+$XT_MULTI ip6tables -N c2
diff --git a/iptables/tests/shell/testcases/chain/0003rename_1 
b/iptables/tests/shell/testcases/chain/0003rename_1
new file mode 100755
index 0000000..975c8e1
--- /dev/null
+++ b/iptables/tests/shell/testcases/chain/0003rename_1
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+$XT_MULTI iptables -N c1 || exit 0
+$XT_MULTI iptables -N c2 || exit 0
+$XT_MULTI iptables -E c1 c2 || exit 1
+
+$XT_MULTI ip6tables -N c1 || exit 0
+$XT_MULTI ip6tables -N c2 || exit 0
+$XT_MULTI ip6tables -E c1 c2 || exit 1
+
+echo "E: Renamed with existing chain" >&2
+exit 0
diff --git a/iptables/tests/shell/testcases/chain/0004newchain_0 
b/iptables/tests/shell/testcases/chain/0004newchain_0
deleted file mode 100755
index 53f8a3a..0000000
--- a/iptables/tests/shell/testcases/chain/0004newchain_0
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-set -e
-
-$XT_MULTI iptables -N c1
-$XT_MULTI ip6tables -N c1
-
-$XT_MULTI iptables -N c2
-$XT_MULTI ip6tables -N c2
diff --git a/iptables/tests/shell/testcases/chain/0005rename_1 
b/iptables/tests/shell/testcases/chain/0005rename_1
deleted file mode 100755
index 975c8e1..0000000
--- a/iptables/tests/shell/testcases/chain/0005rename_1
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-$XT_MULTI iptables -N c1 || exit 0
-$XT_MULTI iptables -N c2 || exit 0
-$XT_MULTI iptables -E c1 c2 || exit 1
-
-$XT_MULTI ip6tables -N c1 || exit 0
-$XT_MULTI ip6tables -N c2 || exit 0
-$XT_MULTI ip6tables -E c1 c2 || exit 1
-
-echo "E: Renamed with existing chain" >&2
-exit 0
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to