summaryrefslogtreecommitdiffstats
path: root/iptables/tests/shell/testcases
diff options
context:
space:
mode:
authorArushi Singhal <arushisinghal19971997@gmail.com>2018-06-09 23:04:27 +0530
committerPablo Neira Ayuso <pablo@netfilter.org>2018-06-12 19:50:58 +0200
commit38b4166d2f7e1cbd9b4e62805b7fad6352710131 (patch)
treec5fcdd81f5c7be37d66081088dacfef5235fb825 /iptables/tests/shell/testcases
parent1e6427abc0221a5e7ed3f943cbf05acb8682c721 (diff)
iptables: tests: shell: add shell test-suite
To run the test suite (as root): % cd iptables/tests/shell % ./run-tests.sh Test files are executables 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 Before each call to the test-files, `kernel_cleanup' will be called. Also, test-files will receive the environment variable $IPTABLES which contains the path to the iptables binary being tested. You can pass an arbitrary $IPTABLES value as well: % IPTABLES=/../../xtables-multi iptables ./run-tests.sh Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/tests/shell/testcases')
-rwxr-xr-xiptables/tests/shell/testcases/chain/0001duplicate_111
-rwxr-xr-xiptables/tests/shell/testcases/chain/0002duplicate_011
-rwxr-xr-xiptables/tests/shell/testcases/chain/0003duplicate_111
-rwxr-xr-xiptables/tests/shell/testcases/chain/0004rename_06
-rwxr-xr-xiptables/tests/shell/testcases/chain/0005rename_112
5 files changed, 51 insertions, 0 deletions
diff --git a/iptables/tests/shell/testcases/chain/0001duplicate_1 b/iptables/tests/shell/testcases/chain/0001duplicate_1
new file mode 100755
index 00000000..6d42cecf
--- /dev/null
+++ b/iptables/tests/shell/testcases/chain/0001duplicate_1
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+$IPTABLES -t filter -N c1
+$IPTABLES -t filter -N c1
+
+if [ $? -eq 0 ]; then
+ echo "E: Duplicate chains" >&2
+ exit 0
+fi
diff --git a/iptables/tests/shell/testcases/chain/0002duplicate_0 b/iptables/tests/shell/testcases/chain/0002duplicate_0
new file mode 100755
index 00000000..6d42cecf
--- /dev/null
+++ b/iptables/tests/shell/testcases/chain/0002duplicate_0
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+$IPTABLES -t filter -N c1
+$IPTABLES -t filter -N c1
+
+if [ $? -eq 0 ]; then
+ echo "E: Duplicate chains" >&2
+ exit 0
+fi
diff --git a/iptables/tests/shell/testcases/chain/0003duplicate_1 b/iptables/tests/shell/testcases/chain/0003duplicate_1
new file mode 100755
index 00000000..6d42cecf
--- /dev/null
+++ b/iptables/tests/shell/testcases/chain/0003duplicate_1
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+set -e
+
+$IPTABLES -t filter -N c1
+$IPTABLES -t filter -N c1
+
+if [ $? -eq 0 ]; then
+ echo "E: Duplicate chains" >&2
+ exit 0
+fi
diff --git a/iptables/tests/shell/testcases/chain/0004rename_0 b/iptables/tests/shell/testcases/chain/0004rename_0
new file mode 100755
index 00000000..a85369a5
--- /dev/null
+++ b/iptables/tests/shell/testcases/chain/0004rename_0
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+set -e
+
+$IPTABLES -N c1
+$IPTABLES -E c1 c2
diff --git a/iptables/tests/shell/testcases/chain/0005rename_1 b/iptables/tests/shell/testcases/chain/0005rename_1
new file mode 100755
index 00000000..7261b6dc
--- /dev/null
+++ b/iptables/tests/shell/testcases/chain/0005rename_1
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+set -e
+
+$IPTABLES -N c1
+$IPTABLES -N c2
+$IPTABLES -E c1 c2
+
+if [ $? -eq 0 ] ; then
+ echo "E: Renamed with existing chain" >&2
+ exit 0
+fi